ci: simplify coverage CI/CD job (#46441)
* ci: simplify coverage CI/CD job * Fix typo in dependent job
This commit is contained in:
parent
98854582e3
commit
04fb52aeca
59
.github/workflows/ci.yaml
vendored
59
.github/workflows/ci.yaml
vendored
@ -15,18 +15,6 @@ concurrency:
|
|||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
prechecks:
|
|
||||||
needs: [ changes ]
|
|
||||||
uses: ./.github/workflows/valid-style.yml
|
|
||||||
secrets: inherit
|
|
||||||
with:
|
|
||||||
with_coverage: ${{ needs.changes.outputs.core }}
|
|
||||||
all-prechecks:
|
|
||||||
needs: [ prechecks ]
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Success
|
|
||||||
run: "true"
|
|
||||||
# Check which files have been updated by the PR
|
# Check which files have been updated by the PR
|
||||||
changes:
|
changes:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@ -79,35 +67,34 @@ jobs:
|
|||||||
needs: [ prechecks, changes ]
|
needs: [ prechecks, changes ]
|
||||||
uses: ./.github/workflows/bootstrap.yml
|
uses: ./.github/workflows/bootstrap.yml
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
unit-tests:
|
unit-tests:
|
||||||
if: ${{ github.repository == 'spack/spack' && needs.changes.outputs.core == 'true' }}
|
if: ${{ github.repository == 'spack/spack' && needs.changes.outputs.core == 'true' }}
|
||||||
needs: [ prechecks, changes ]
|
needs: [ prechecks, changes ]
|
||||||
uses: ./.github/workflows/unit_tests.yaml
|
uses: ./.github/workflows/unit_tests.yaml
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
upload-coverage:
|
|
||||||
needs: [ unit-tests, prechecks ]
|
prechecks:
|
||||||
runs-on: ubuntu-latest
|
needs: [ changes ]
|
||||||
steps:
|
uses: ./.github/workflows/valid-style.yml
|
||||||
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
|
secrets: inherit
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
with_coverage: ${{ needs.changes.outputs.core }}
|
||||||
- name: Download coverage files
|
|
||||||
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16
|
all-prechecks:
|
||||||
with:
|
needs: [ prechecks ]
|
||||||
pattern: coverage-*
|
runs-on: ubuntu-latest
|
||||||
path: coverage
|
steps:
|
||||||
merge-multiple: true
|
- name: Success
|
||||||
- run: pip install --upgrade coverage
|
run: "true"
|
||||||
- run: ls -la coverage
|
|
||||||
- run: coverage combine -a coverage/.coverage*
|
coverage:
|
||||||
- run: coverage xml
|
needs: [ unit-tests, prechecks ]
|
||||||
- name: "Upload coverage"
|
uses: ./.github/workflows/coverage.yml
|
||||||
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673
|
secrets: inherit
|
||||||
with:
|
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
all:
|
||||||
verbose: true
|
needs: [ coverage, bootstrap ]
|
||||||
all:
|
|
||||||
needs: [ upload-coverage, bootstrap ]
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Success
|
- name: Success
|
||||||
|
34
.github/workflows/coverage.yml
vendored
Normal file
34
.github/workflows/coverage.yml
vendored
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
name: coverage
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
# Upload coverage reports to codecov once as a single bundle
|
||||||
|
upload:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
|
||||||
|
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3
|
||||||
|
with:
|
||||||
|
python-version: '3.11'
|
||||||
|
cache: 'pip'
|
||||||
|
|
||||||
|
- name: Install python dependencies
|
||||||
|
run: pip install -r .github/workflows/requirements/coverage/requirements.txt
|
||||||
|
|
||||||
|
- name: Download coverage artifact files
|
||||||
|
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16
|
||||||
|
with:
|
||||||
|
pattern: coverage-*
|
||||||
|
path: coverage
|
||||||
|
merge-multiple: true
|
||||||
|
|
||||||
|
- run: ls -la coverage
|
||||||
|
- run: coverage combine -a coverage/.coverage*
|
||||||
|
- run: coverage xml
|
||||||
|
|
||||||
|
- name: "Upload coverage report to CodeCov"
|
||||||
|
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673
|
||||||
|
with:
|
||||||
|
verbose: true
|
1
.github/workflows/requirements/coverage/requirements.txt
vendored
Normal file
1
.github/workflows/requirements/coverage/requirements.txt
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
coverage==7.6.1
|
Loading…
Reference in New Issue
Block a user