Test multiple Yarn versions in CI

This commit is contained in:
Stéphan Kochen
2023-10-29 21:33:20 +01:00
parent ce066ca91d
commit 6ffba9296f
+10 -17
View File
@@ -11,6 +11,9 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
contents: write contents: write
strategy:
matrix:
yarn_version: [3, 4]
env: env:
NIX_PATH: nixpkgs=channel:nixpkgs-unstable NIX_PATH: nixpkgs=channel:nixpkgs-unstable
steps: steps:
@@ -25,24 +28,18 @@ jobs:
- name: Enable corepack - name: Enable corepack
run: corepack enable run: corepack enable
- name: Yarn cache
uses: actions/cache@v3
with:
path: .yarn/cache
key: yarn-${{ hashFiles('yarn.lock') }}
restore-keys: yarn-
- name: Yarn install - name: Yarn install
run: yarn install --immutable run: yarn
- name: TypeScript - name: TypeScript
if: matrix.yarn_version == 4
run: yarn check run: yarn check
- name: Build - name: Build
run: yarn build run: yarn build
- name: Update dist - name: Update dist
if: github.repository_owner == 'stephank' && github.ref == 'refs/heads/main' if: matrix.yarn_version == 4 && github.repository_owner == 'stephank' && github.ref == 'refs/heads/main'
run: | run: |
if [[ "$(git status --porcelain)" != "" ]]; then if [[ "$(git status --porcelain)" != "" ]]; then
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
@@ -51,24 +48,20 @@ jobs:
git push git push
fi fi
- name: Set Yarn version
run: yarn set version ${{ matrix.yarn_version }}
- name: Install plugin - name: Install plugin
run: yarn plugin import ./dist/yarn-plugin-nixify.js run: yarn plugin import ./dist/yarn-plugin-nixify.js
- name: Test without Nix - name: Test without Nix
run: yarn run: yarn --no-immutable
- name: Install Nix - name: Install Nix
uses: cachix/install-nix-action@v23 uses: cachix/install-nix-action@v23
with: with:
nix_path: nixpkgs=channel:nixos-unstable nix_path: nixpkgs=channel:nixos-unstable
- name: Setup Cachix
if: github.event_name == 'push' && github.repository_owner == 'stephank'
uses: cachix/cachix-action@v12
with:
name: stephank
signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}"
- name: Add bin - name: Add bin
run: | run: |
cat > hello.js << EOF cat > hello.js << EOF