From 06359c64db578e6cebf736abeef6b5a4e9ec22d9 Mon Sep 17 00:00:00 2001 From: "Jason R. Stevens, CFA" <jason@thinkjrs.dev> Date: Tue, 21 Jan 2025 14:24:38 -0500 Subject: [PATCH] ci: add codecov github action --- .github/workflows/codecov.yml | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/codecov.yml diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml new file mode 100644 index 0000000..66554e1 --- /dev/null +++ b/.github/workflows/codecov.yml @@ -0,0 +1,37 @@ +name: Code Coverage + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + test-and-coverage: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Install dependencies + run: npm install + + - name: Run tests with coverage + run: npm test -- --coverage + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v5.1.2 + with: + token: ${{ secrets.CODECOV_TOKEN }} # Set in GitHub repository secrets + files: ./coverage/lcov.info # Adjust path if necessary + flags: unittests # Optional flags for tracking different types of tests + name: codecov-coverage-report # Optional, useful for identifying reports + fail_ci_if_error: true # Fails CI if Codecov upload fails