From 9fb45fdbe6ce68a2bd710a95145efcebb418342e Mon Sep 17 00:00:00 2001 From: Verus20 Date: Sat, 17 Aug 2024 11:11:09 -0700 Subject: [PATCH 1/3] run and upload coverage results to codecov --- .github/workflows/codecov.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/codecov.yaml b/.github/workflows/codecov.yaml index fffb1443..0a33750b 100644 --- a/.github/workflows/codecov.yaml +++ b/.github/workflows/codecov.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 ts-coverage - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v3 env: From 649f3602994464d627d58d27e522e1b73834ad8e Mon Sep 17 00:00:00 2001 From: Verus20 Date: Sat, 17 Aug 2024 11:18:26 -0700 Subject: [PATCH 2/3] change coverage commands to jest --- .github/workflows/codecov.yaml | 2 +- package.json | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/codecov.yaml b/.github/workflows/codecov.yaml index 0a33750b..d6acb6c9 100644 --- a/.github/workflows/codecov.yaml +++ b/.github/workflows/codecov.yaml @@ -24,7 +24,7 @@ jobs: - name: Install CI dependencies run: npm ci - name: Run unit tests with code coverage - run: npm run ts-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..ae4f11d0 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ }, "scripts": { "test": "jest test", + "coverage": "jest --coverage", "ts-coverage": "typescript-coverage-report", "server": "npx ts-node src/server/server.ts" }, From 50fb7831c4c97bf61adfb4927247d5a29f317a6a Mon Sep 17 00:00:00 2001 From: Verus20 Date: Sat, 17 Aug 2024 11:35:22 -0700 Subject: [PATCH 3/3] add coverage results for python --- .github/workflows/codecov_py.yaml | 32 +++++++++++++++++++ .../{codecov.yaml => codecov_ts.yaml} | 0 package.json | 2 +- 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/codecov_py.yaml rename .github/workflows/{codecov.yaml => codecov_ts.yaml} (100%) 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 100% rename from .github/workflows/codecov.yaml rename to .github/workflows/codecov_ts.yaml diff --git a/package.json b/package.json index ae4f11d0..ee36ab53 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ }, "scripts": { "test": "jest test", - "coverage": "jest --coverage", + "coverage": "jest --coverage --collectCoverageFrom='src/**/*.{ts,tsx}'", "ts-coverage": "typescript-coverage-report", "server": "npx ts-node src/server/server.ts" },