From 27f964e11e21932a44b2998933f2096f257f33f3 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Bigourdan <10694593+PyvesB@users.noreply.github.com> Date: Thu, 11 Jul 2024 19:45:13 +0200 Subject: [PATCH] Add code coverage action (#10340) * Add code coverage action * Run on Node 22 * Separate service tests out * Temporarily run on all pushes to test out * Switch to daily schedule --- .github/workflows/coveralls-code-coverage.yml | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 .github/workflows/coveralls-code-coverage.yml diff --git a/.github/workflows/coveralls-code-coverage.yml b/.github/workflows/coveralls-code-coverage.yml new file mode 100644 index 0000000000..235e8b8ea6 --- /dev/null +++ b/.github/workflows/coveralls-code-coverage.yml @@ -0,0 +1,72 @@ +name: Coveralls Code Coverage +on: + schedule: + - cron: '10 7 * * *' + # At 07:10, daily + workflow_dispatch: + +jobs: + coveralls-code-coverage: + runs-on: ubuntu-latest + + services: + postgres: + image: postgres + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: ci_test + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + - 5432:5432 + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup + uses: ./.github/actions/setup + with: + # Even though we're currently deploying on Node 20, we run coverage test on Node 22 + # to work around https://github.com/bcoe/v8-coverage/pull/2. + node-version: 22 + env: + NPM_CONFIG_ENGINE_STRICT: 'false' + + - name: Migrate DB + run: npm run migrate up + env: + POSTGRES_URL: postgresql://postgres:postgres@localhost:5432/ci_test + shell: bash + + - name: Coverage for Main Tests + run: npm run coverage:test + env: + GH_TOKEN: '${{ secrets.GH_PAT }}' + POSTGRES_URL: postgresql://postgres:postgres@localhost:5432/ci_test + shell: bash + + - name: Coverage for Service Tests + run: npm run coverage:test:services + continue-on-error: true + env: + RETRY_COUNT: 3 + GH_TOKEN: '${{ secrets.GH_PAT }}' + LIBRARIESIO_TOKENS: '${{ secrets.SERVICETESTS_LIBRARIESIO_TOKENS }}' + OBS_USER: '${{ secrets.SERVICETESTS_OBS_USER }}' + OBS_PASS: '${{ secrets.SERVICETESTS_OBS_PASS }}' + PEPY_KEY: '${{ secrets.SERVICETESTS_PEPY_KEY }}' + SL_INSIGHT_USER_UUID: '${{ secrets.SERVICETESTS_SL_INSIGHT_USER_UUID }}' + SL_INSIGHT_API_TOKEN: '${{ secrets.SERVICETESTS_SL_INSIGHT_API_TOKEN }}' + TWITCH_CLIENT_ID: '${{ secrets.SERVICETESTS_TWITCH_CLIENT_ID }}' + TWITCH_CLIENT_SECRET: '${{ secrets.SERVICETESTS_TWITCH_CLIENT_SECRET }}' + WHEELMAP_TOKEN: '${{ secrets.SERVICETESTS_WHEELMAP_TOKEN }}' + YOUTUBE_API_KEY: '${{ secrets.SERVICETESTS_YOUTUBE_API_KEY }}' + shell: bash + + - name: Coveralls GitHub Action + uses: coverallsapp/github-action@v2 -- GitLab