-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: upload code coverage reports to codecov only if tests pass (#204)
* ci: make the upload to codecov run only if tests pass * refactor: standardize the name of similar steps * ci: put icons on job names instead of workflow names to improve readability
- Loading branch information
1 parent
14cfe3f
commit 040716c
Showing
4 changed files
with
103 additions
and
86 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,58 @@ | ||
name: 🧹 Pull request | ||
name: Lint & changelog | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
|
||
jobs: | ||
syntax_changelog: | ||
name: Syntax & changelog | ||
lint: | ||
name: 🧹 Lint code | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
defaults: | ||
run: | ||
shell: bash | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 2 | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-node@v3 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: .nvmrc | ||
|
||
- name: Install | ||
- name: Install dependencies | ||
run: node common/scripts/install-run-rush.js install | ||
|
||
- name: 🏗 Build | ||
- name: Build projects | ||
run: node common/scripts/install-run-rush.js rebuild | ||
|
||
- name: 📝 Verify missing changelogs | ||
run: node common/scripts/install-run-rush.js change --target-branch origin/$GITHUB_BASE_REF --verify -v | ||
|
||
- name: 💅 Lint | ||
- name: Lint code | ||
# --verbose allows to display warnings from ESLint | ||
run: node common/scripts/install-run-rush.js lint --verbose | ||
|
||
test: | ||
name: Test | ||
changelog: | ||
name: 📝 Checks for changelogs | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
defaults: | ||
run: | ||
shell: bash | ||
strategy: | ||
matrix: | ||
node_version: [18, 19, 20, 21] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 2 | ||
|
||
- uses: actions/setup-node@v3 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node_version }} | ||
node-version-file: .nvmrc | ||
|
||
- name: Install | ||
- name: Install dependencies | ||
run: node common/scripts/install-run-rush.js install | ||
|
||
- name: 🏗 Build | ||
run: node common/scripts/install-run-rush.js rebuild | ||
|
||
- name: 🐛 Test | ||
run: node common/scripts/install-run-rush.js test | ||
- name: Checks for changelogs | ||
run: node common/scripts/install-run-rush.js change --target-branch origin/$GITHUB_BASE_REF --verify -v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
# then merged it in the main branch once the publication has been done. | ||
# | ||
|
||
name: 🚀 Publish packages | ||
name: Publish packages | ||
|
||
on: | ||
workflow_dispatch: | ||
|
@@ -43,7 +43,7 @@ env: | |
jobs: | ||
simulate: | ||
if: inputs.PUBLICATION_MODE == 'simulate' | ||
name: Simulate a publication to npmjs.org with the version policy ${{ inputs.VERSION_POLICY }} | ||
name: 🚀 Simulate a publication to npmjs.org with the version policy ${{ inputs.VERSION_POLICY }} | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
|
@@ -52,12 +52,14 @@ jobs: | |
contents: write | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 2 | ||
ref: ${{ env.SOURCE_BRANCH }} | ||
|
||
- uses: actions/setup-node@v3 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: .nvmrc | ||
|
||
|
@@ -75,7 +77,7 @@ jobs: | |
|
||
publish: | ||
if: inputs.PUBLICATION_MODE == 'publish' | ||
name: Publish to npmjs.org with the version policy ${{ inputs.VERSION_POLICY }} | ||
name: 🚀 Publish to npmjs.org with the version policy ${{ inputs.VERSION_POLICY }} | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
|
@@ -85,12 +87,14 @@ jobs: | |
pull-requests: write | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 2 | ||
ref: ${{ env.SOURCE_BRANCH }} | ||
|
||
- uses: actions/setup-node@v3 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: .nvmrc | ||
|
||
|
@@ -100,10 +104,10 @@ jobs: | |
name: Heart | ||
email: [email protected] | ||
|
||
- name: Install | ||
- name: Install dependencies | ||
run: node common/scripts/install-run-rush.js install | ||
|
||
- name: 🏗 Build | ||
- name: Build projects | ||
run: node common/scripts/install-run-rush.js rebuild | ||
|
||
- name: Create origin/${{ env.TARGET_BRANCH }} branch | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: Tests | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
|
||
jobs: | ||
test: | ||
name: 🐛 Run tests | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
defaults: | ||
run: | ||
shell: bash | ||
strategy: | ||
matrix: | ||
node_version: [18, 19, 20, 21] | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node_version }} | ||
|
||
- name: Install dependencies | ||
run: node common/scripts/install-run-rush.js install | ||
|
||
- name: Build projects | ||
run: node common/scripts/install-run-rush.js rebuild | ||
|
||
- name: Run tests | ||
if: ${{ matrix.node_version != '18' }} | ||
run: node common/scripts/install-run-rush.js test | ||
|
||
- name: Run tests and generate coverage reports | ||
if: ${{ matrix.node_version == '18' }} | ||
run: node common/scripts/install-run-rush.js test --coverage | ||
|
||
- name: Archive code coverage reports | ||
if: ${{ matrix.node_version == '18' }} | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: code-coverage-reports | ||
path: modules/**/clover.xml | ||
retention-days: 1 | ||
|
||
coverage: | ||
needs: test | ||
name: ⬆️ Upload code coverage reports to Codecov | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
defaults: | ||
run: | ||
shell: bash | ||
|
||
steps: | ||
- name: Download reports from previous job | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: code-coverage-reports | ||
|
||
- name: Upload reports to Codecov | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
fail_ci_if_error: true |