Skip to content

feat: publish shared configure-nodejs action (#1) #7

feat: publish shared configure-nodejs action (#1)

feat: publish shared configure-nodejs action (#1) #7

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
jobs:
unit:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: ./
with:
node-version: 22.x
- name: Run unit tests
run: npm test
fixture-lookup:
name: Fixture Lookup (${{ matrix.package-manager }})
needs: unit
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- package-manager: npm
fixture: fixtures/npm-basic
install-command: npm ci
lockfile-name: package-lock.json
- package-manager: pnpm
fixture: fixtures/pnpm-basic
install-command: pnpm install --frozen-lockfile
lockfile-name: pnpm-lock.yaml
- package-manager: yarn
fixture: fixtures/yarn-basic
install-command: yarn install --immutable
lockfile-name: yarn.lock
steps:
- uses: actions/checkout@v6
with:
sparse-checkout: |
action.yml
scripts
${{ matrix.fixture }}
sparse-checkout-cone-mode: false
- name: Configure Node.js
id: configure-nodejs
uses: ./
with:
working-directory: ${{ matrix.fixture }}
cache-key-suffix: fixture-tests
lookup-only: "true"
- name: Assert resolved action outputs
shell: bash
run: |
test "${{ steps.configure-nodejs.outputs.package-manager }}" = "${{ matrix.package-manager }}"
test "${{ steps.configure-nodejs.outputs.install-command }}" = "${{ matrix.install-command }}"
test "${{ steps.configure-nodejs.outputs.working-directory }}" = "${{ matrix.fixture }}"
test "${{ steps.configure-nodejs.outputs.lockfile-name }}" = "${{ matrix.lockfile-name }}"
- name: Assert lookup-only behavior
working-directory: ${{ matrix.fixture }}
shell: bash
run: |
if [ "${{ steps.configure-nodejs.outputs.cache-hit }}" = "true" ]; then
test ! -d node_modules
else
test -d node_modules
node check.mjs
fi
fixture-validate:
name: Fixture Validate (${{ matrix.package-manager }})
needs: fixture-lookup
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- package-manager: npm
fixture: fixtures/npm-basic
install-command: npm ci
lockfile-name: package-lock.json
- package-manager: pnpm
fixture: fixtures/pnpm-basic
install-command: pnpm install --frozen-lockfile
lockfile-name: pnpm-lock.yaml
- package-manager: yarn
fixture: fixtures/yarn-basic
install-command: yarn install --immutable
lockfile-name: yarn.lock
steps:
- uses: actions/checkout@v6
with:
sparse-checkout: |
action.yml
scripts
${{ matrix.fixture }}
sparse-checkout-cone-mode: false
- name: Configure Node.js
id: configure-nodejs
uses: ./
with:
working-directory: ${{ matrix.fixture }}
cache-key-suffix: fixture-tests
- name: Assert restore behavior
shell: bash
run: |
test "${{ steps.configure-nodejs.outputs.package-manager }}" = "${{ matrix.package-manager }}"
test "${{ steps.configure-nodejs.outputs.install-command }}" = "${{ matrix.install-command }}"
test "${{ steps.configure-nodejs.outputs.working-directory }}" = "${{ matrix.fixture }}"
test "${{ steps.configure-nodejs.outputs.lockfile-name }}" = "${{ matrix.lockfile-name }}"
test "${{ steps.configure-nodejs.outputs.cache-hit }}" = "true"
- name: Validate installed dependency
working-directory: ${{ matrix.fixture }}
run: node check.mjs