chore: migrate to Yarn v3 #3147
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: Node.js CI | |
on: | |
push: | |
branches: [v*, next] | |
paths-ignore: | |
- 'docs/*' | |
- '*.md' | |
pull_request: | |
branches: [v*, next] | |
paths-ignore: | |
- 'docs/*' | |
- '*.md' | |
jobs: | |
Build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
node-version: [18.12.0, 18.x, 20.x] | |
permissions: | |
checks: write | |
pull-requests: write | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@v4 | |
- name: Install Yarn | |
run: corepack enable | |
- name: Setup NodeJS ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn install --immutable | |
- name: Build projects | |
run: yarn build | |
- name: Run tests | |
run: yarn test | |
- name: Publish Test Results | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
if: matrix.os == 'ubuntu-latest' | |
with: | |
junit_files: 'test-results/*.xml' | |
- name: Upload unit-tests coverage to Codecov | |
uses: codecov/codecov-action@v3.1.4 | |
with: | |
directory: coverage/library | |
flags: unittests | |
- name: Upload examples code coverage to Codecov | |
uses: codecov/codecov-action@v3.1.4 | |
with: | |
directory: coverage/integration | |
flags: integration | |
Lint-Files: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@v4 | |
- name: Install Yarn | |
run: corepack enable | |
- name: Setup NodeJS | |
uses: actions/setup-node@v3 | |
with: | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn install --immutable | |
- name: Check licenses | |
run: yarn license-checker | |
- name: Lint project | |
run: yarn lint -f @microsoft/eslint-formatter-sarif -o eslint.sarif | |
- name: Upload linter SARIF file | |
uses: github/codeql-action/upload-sarif@v2 | |
with: | |
sarif_file: eslint.sarif | |
CodeQL-Analysis: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@v4 | |
- name: Initialize CodeQL | |
uses: github/codeql-action/init@v2 | |
with: | |
languages: javascript | |
- name: Install Yarn | |
run: corepack enable | |
- name: Setup NodeJS | |
uses: actions/setup-node@v3 | |
with: | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn install --immutable | |
- name: Build projects | |
run: yarn build | |
- name: Perform CodeQL Analysis | |
uses: github/codeql-action/analyze@v2 | |
automerge: | |
name: 'Merge Dependabot updates' | |
if: github.event_name == 'pull_request' | |
needs: [Build, Lint-Files, CodeQL-Analysis] | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
contents: write | |
steps: | |
- uses: fastify/github-action-merge-dependabot@v3.9.1 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} |