Altered CI to upload coverage in one step

fixes https://github.com/TryGhost/Toolbox/issues/395

- we seem to be encountering issues with codecov where it randomly
  reports huge jumps in test coverage %
- I'm still not sure of the reason why, but the general trend in CI with
  codecov is to store test coverage files as artifacts and then submit
  them to codecov in one go
- this commit implements that in our CI
- let's see if this improves anything
This commit is contained in:
Daniel Lockyer 2022-09-15 08:50:19 +01:00 committed by Daniel Lockyer
parent 8d607b9490
commit 4d63034bd2

View File

@ -61,8 +61,11 @@ jobs:
# Merge coverage reports and upload
- run: yarn ember coverage-merge
working-directory: ghost/admin
- uses: codecov/codecov-action@v3
- uses: actions/upload-artifact@v3
if: matrix.browser == 'Chrome'
with:
name: coverage
path: ghost/*/coverage/cobertura-coverage.xml
- uses: daniellockyer/action-slack-build@master
if: failure() && github.event_name == 'push' && github.ref == 'refs/heads/main'
@ -163,8 +166,11 @@ jobs:
- run: yarn
- run: yarn workspaces run test:unit
- uses: codecov/codecov-action@v2
- uses: actions/upload-artifact@v3
if: startsWith(matrix.node, '16')
with:
name: coverage
path: ghost/*/coverage/cobertura-coverage.xml
- uses: daniellockyer/action-slack-build@master
if: failure() && github.event_name == 'push' && github.ref == 'refs/heads/main'
@ -342,6 +348,19 @@ jobs:
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
coverage:
name: Coverage
needs: [unit-tests, admin-tests]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Restore coverage
uses: actions/download-artifact@v3
with:
path: ghost
- run: rsync -av --remove-source-files ghost/coverage/* ghost/
- uses: codecov/codecov-action@v3
canary:
needs: [lint, ghost-cli, admin-tests, migrations, unit-tests, database-tests]
if: github.event_name == 'push' && github.ref == 'refs/heads/main'