CI #1117
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
name: CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
schedule: | |
- cron: '15 0 * * *' | |
permissions: | |
contents: read | |
jobs: | |
test: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
node-version: [12, 14, 16, 18, 20, 21] | |
runs-on: ${{ matrix.os }} | |
env: | |
OS: ${{ matrix.os }} | |
NODE: ${{ matrix.node-version }} | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 | |
- run: npm ci | |
if: ${{ github.event_name != 'schedule' }} | |
- shell: bash | |
run: | | |
npm install -g $(jq -r '.packageManager' < package.json) | |
rm package-lock.json | |
npm i | |
if: ${{ github.event_name == 'schedule' }} | |
- run: npm run build | |
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- run: npm run coverage | |
- uses: codecov/codecov-action@c16abc29c95fcf9174b58eb7e1abf4c866893bc8 # v4.1.1 | |
if: ${{ github.event_name != 'schedule' }} | |
continue-on-error: true | |
timeout-minutes: 5 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
env_vars: OS,NODE | |
eslint: | |
name: ESLint | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name != 'schedule' }} | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 | |
- run: npm ci | |
- run: npx eslint . | |
dprint: | |
name: dprint | |
runs-on: ubuntu-latest | |
if: ${{ github.event_name != 'schedule' }} | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 | |
- run: npm ci | |
- run: npx dprint check | |
required: | |
runs-on: ubuntu-latest | |
if: ${{ always() }} | |
needs: | |
- test | |
- eslint | |
- dprint | |
steps: | |
- name: Check required jobs | |
run: | | |
results=( | |
"${{ needs.test.result }}" | |
"${{ github.event_name != 'schedule' && needs.eslint.result || 'success' }}" | |
"${{ github.event_name != 'schedule' && needs.dprint.result || 'success' }}" | |
) | |
for result in "${results[@]}"; do | |
if [[ "$result" != "success" ]]; then | |
echo "One or more jobs failed" | |
exit 1 | |
fi | |
done |