diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8b51542b8..fe37de6ff 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,7 +4,10 @@ permissions: contents: read id-token: write -on: [pull_request] +on: + pull_request: + push: + branches: [master] jobs: shared-ci: diff --git a/.github/workflows/shared-ci.yml b/.github/workflows/shared-ci.yml index da5de694f..e21ae61dd 100644 --- a/.github/workflows/shared-ci.yml +++ b/.github/workflows/shared-ci.yml @@ -81,6 +81,26 @@ jobs: if: ${{ matrix.test-category == 'coverage' }} run: npm run coverage-${{ matrix.test-type }} + - name: Write the line coverage report (${{ matrix.test-type }}) + # One leg per test type uploads; the daily run tests other refs and uploads none. + if: ${{ matrix.test-category == 'coverage' && matrix.node-version == '22.x' && inputs.ref == '' }} + env: + TEST_TYPE: ${{ matrix.test-type }} + run: | + set -euo pipefail + if [ "$TEST_TYPE" = browser ]; then data=.karma_output; else data=.nyc_output; fi + npx nyc report -t "$data" --reporter=lcovonly --report-dir "$RUNNER_TEMP/lcov" + mkdir -p local-coverage + sed "s|^SF:$GITHUB_WORKSPACE/|SF:|" "$RUNNER_TEMP/lcov/lcov.info" > "local-coverage/$TEST_TYPE.lcov" + + - name: Upload the line coverage report (${{ matrix.test-type }}) + if: ${{ matrix.test-category == 'coverage' && matrix.node-version == '22.x' && inputs.ref == '' }} + uses: actions/upload-artifact@v4 + with: + name: local-coverage-${{ matrix.test-type }} + path: local-coverage/*.lcov + if-no-files-found: error + - name: Publish locally for vector tests if: ${{ matrix.test-category == 'vectors' && !inputs.test-published-packages }} run: npm run verdaccio-publish diff --git a/test-server/src/main.ts b/test-server/src/main.ts index f4b8e8453..caee23d60 100644 --- a/test-server/src/main.ts +++ b/test-server/src/main.ts @@ -16,3 +16,7 @@ createServer().listen(port, '127.0.0.1', () => { `esdk-test-server (javascript) listening at http://127.0.0.1:${port}` ) }) + +// Exit normally on SIGTERM, which is how the orchestrator stops the server; +// Node then runs its exit hooks, such as writing NODE_V8_COVERAGE data. +process.on('SIGTERM', () => process.exit(0))