diff --git a/.github/workflows/codecov_py.yaml b/.github/workflows/codecov_py.yaml new file mode 100644 index 00000000..7dbf18c0 --- /dev/null +++ b/.github/workflows/codecov_py.yaml @@ -0,0 +1,32 @@ +# Workflow to codecov + +name: Run codecov +# Runs on push to any branch +on: + push: + pull_request: + branches: + - master + # Workflow can be triggered manually from the Actions tab + workflow_dispatch: + +jobs: + # Run tests + codecov: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + name: Checkout + - uses: actions/setup-python@v4 + name: Set up Python 3.10 + with: + python-version: '3.10' + - name: Install python dependencies + run: pip install -r controller/requirements.txt + - name: Run unit tests with code coverage + run: coverage run -m pytest + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v3 + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + timeout-minutes: 1 diff --git a/.github/workflows/codecov.yaml b/.github/workflows/codecov_ts.yaml similarity index 74% rename from .github/workflows/codecov.yaml rename to .github/workflows/codecov_ts.yaml index fffb1443..d6acb6c9 100644 --- a/.github/workflows/codecov.yaml +++ b/.github/workflows/codecov_ts.yaml @@ -16,9 +16,15 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + name: Checkout - uses: actions/setup-node@v1 + name: Set up with Node 16 with: node-version: '16.x' + - name: Install CI dependencies + run: npm ci + - name: Run unit tests with code coverage + run: npm run coverage - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v3 env: diff --git a/package.json b/package.json index e90d9677..ee36ab53 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ }, "scripts": { "test": "jest test", + "coverage": "jest --coverage --collectCoverageFrom='src/**/*.{ts,tsx}'", "ts-coverage": "typescript-coverage-report", "server": "npx ts-node src/server/server.ts" },