Update dependencies and workflows #434
Workflow file for this run
This file contains hidden or 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: Tests | |
| on: [push, pull_request] | |
| jobs: | |
| resolve-node-versions: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| matrix: ${{ steps.generate.outputs.matrix }} | |
| steps: | |
| - id: set-matrix | |
| run: | | |
| versions=$(curl -s https://nodejs.org/dist/index.json | jq -r ' | |
| [ .[] | |
| | select(.lts != false) | |
| | .version | |
| | ltrimstr("v") | |
| ] | |
| | sort_by(split(".") | map(tonumber)) | |
| | reverse | |
| | unique_by(split(".")[0]) # keep latest patch per major | |
| | .[0:4] # latest 4 LTS majors | |
| ') | |
| echo "matrix={\"node-version\": $versions}" >> $GITHUB_OUTPUT | |
| test: | |
| needs: resolve-node-versions | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJson(needs.resolve-node-versions.outputs.matrix) }} | |
| name: Node ${{ matrix.node-version }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| - name: Enable Corepack | |
| run: corepack enable | |
| - name: Detect Yarn version | |
| id: yarn-version | |
| run: | | |
| YARN_VERSION=$(node -p " | |
| try { | |
| const pm = require('./package.json').packageManager ?? ''; | |
| const match = pm.match(/^yarn@(\d+)/); | |
| match ? match[1] : ''; | |
| } catch { '' } | |
| ") | |
| if [ -z "$YARN_VERSION" ]; then | |
| YARN_VERSION=$(yarn --version | cut -d. -f1) | |
| fi | |
| echo "major=$YARN_VERSION" >> "$GITHUB_OUTPUT" | |
| echo "Detected Yarn major version: $YARN_VERSION" | |
| - name: Install dependencies | |
| run: | | |
| if [ "${{ steps.yarn-version.outputs.major }}" = "1" ]; then | |
| yarn install --frozen-lockfile --non-interactive --prefer-offline | |
| else | |
| yarn install --immutable | |
| fi | |
| - name: Lint | |
| run: yarn lint | |
| - name: Test | |
| run: yarn test |