Skip to content

Bump actions/setup-node from 4.0.1 to 4.0.2 #201

Bump actions/setup-node from 4.0.1 to 4.0.2

Bump actions/setup-node from 4.0.1 to 4.0.2 #201

Workflow file for this run

name: build
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
matrix:
yarn_version: [3, 4]
env:
NIX_PATH: nixpkgs=channel:nixpkgs-unstable
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4.0.2
with:
node-version: 18.x
- name: Enable corepack
run: corepack enable
- name: Yarn install
run: yarn
- name: TypeScript
if: matrix.yarn_version == 4
run: yarn check
- name: Build
run: yarn build
- name: Update dist
if: matrix.yarn_version == 4 && github.repository_owner == 'stephank' && github.ref == 'refs/heads/main'
run: |
if [[ "$(git status --porcelain)" != "" ]]; then
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git commit -m 'Update dist' dist/yarn-plugin-nixify.js
git push
fi
- name: Set Yarn version
run: yarn set version ${{ matrix.yarn_version }}
- name: Install plugin
run: yarn plugin import ./dist/yarn-plugin-nixify.js
- name: Test without Nix
run: yarn --no-immutable
- name: Install Nix
uses: cachix/install-nix-action@v25
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Add bin
run: |
cat > hello.js << EOF
#!/usr/bin/env node
require('webpack')
console.log('Hello nixify!')
EOF
chmod a+x hello.js
jq '.bin = { hello: "./hello.js" }' package.json > new
mv new package.json
- name: Test with Nix
run: yarn --no-immutable
- name: Test nix-build
run: |
# This delete tests refetching the cache with Nix.
nix-store --delete /nix/store/*-yarn-cache
nix-build
- name: Test bin
run: ./result/bin/hello
# TODO: Check there really is a separate derivation,
# and that Yarn actually reuses the build.
- name: Test isolated builds
run: |
# Matches example in ISOLATED_BUILDS.md
echo 'individualNixPackaging: true' >> .yarnrc.yml
echo 'isolatedNixBuilds: ["sqlite3"]' >> .yarnrc.yml
cat > default.nix << EOF
{ pkgs ? import <nixpkgs> { } }:
pkgs.callPackage ./yarn-project.nix { } {
src = ./.;
overrideSqlite3Attrs = old: {
npm_config_sqlite = "/"; # Don't accidentally use the wrong sqlite.
buildInputs = old.buildInputs ++ (with pkgs; [ python3 sqlite ]);
};
}
EOF
yarn add sqlite3
# This delete tests refetching a package with Nix.
nix-store --delete /nix/store/*--yarnpkg-core-npm-*
nix-build