action-setup/.github/workflows/test.yaml

178 lines
3.6 KiB
YAML
Raw Normal View History

2020-05-08 14:31:14 +08:00
name: Test Action
on:
- push
- pull_request
2020-08-27 09:25:30 +08:00
- workflow_dispatch
2020-05-08 14:31:14 +08:00
jobs:
test_default_inputs:
name: Test with default inputs
2020-05-08 18:01:10 +08:00
runs-on: ${{ matrix.os }}
2020-05-08 14:31:14 +08:00
strategy:
fail-fast: false
matrix:
pnpm:
- 4.11.1
2020-05-08 18:01:10 +08:00
os:
- ubuntu-latest
- macos-latest
- windows-latest
2020-05-08 14:31:14 +08:00
steps:
- uses: actions/checkout@v4
2020-05-08 14:31:14 +08:00
- name: Run the action
uses: ./
with:
version: 4.11.1
- name: 'Test: which'
run: which pnpm; which pnpx
- name: 'Test: install'
run: pnpm install
test_dest:
name: Test with dest
2020-05-08 14:31:14 +08:00
runs-on: ${{ matrix.os }}
2020-05-08 14:31:14 +08:00
strategy:
fail-fast: false
matrix:
pnpm:
- 4.11.1
os:
- ubuntu-latest
- macos-latest
- windows-latest
2020-05-08 14:31:14 +08:00
steps:
- uses: actions/checkout@v4
2020-05-08 14:31:14 +08:00
- name: Run the action
uses: ./
with:
version: 4.11.1
2020-05-08 15:27:11 +08:00
dest: ~/test/pnpm
2020-05-08 14:31:14 +08:00
- name: 'Test: which'
2020-05-08 15:56:55 +08:00
run: which pnpm && which pnpx
2020-05-08 14:31:14 +08:00
- name: 'Test: install'
run: pnpm install
2020-05-09 22:26:17 +08:00
test_standalone:
name: Test with standalone
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
standalone:
- true
- false
steps:
- uses: actions/checkout@v4
- name: Run the action
uses: ./
with:
version: 7.0.0
standalone: ${{ matrix.standalone }}
- name: install Node.js
uses: actions/setup-node@v4
with:
# pnpm@7.0.0 is not compatible with Node.js 12
node-version: 12.22.12
- name: 'Test: which (pnpm)'
run: which pnpm
- name: 'Test: which (pnpx)'
if: matrix.standalone == false
run: which pnpx
- name: 'Test: install when standalone is true'
if: matrix.standalone
run: pnpm install
- name: 'Test: install when standalone is false'
if: matrix.standalone == false
# Since the default shell on windows runner is pwsh, we specify bash explicitly
shell: bash
run: |
if pnpm install; then
echo "pnpm install should fail"
exit 1
else
echo "pnpm install failed as expected"
fi
2020-05-09 22:26:17 +08:00
test_run_install:
2020-05-09 22:35:09 +08:00
name: 'Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }})'
2020-05-09 22:26:17 +08:00
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
pnpm:
- 4.11.1
os:
- ubuntu-latest
- macos-latest
- windows-latest
run_install:
- name: 'null'
value: 'null'
- name: 'empty object'
value: '{}'
- name: 'recursive'
value: |
recursive: true
- name: 'global'
value: |
2020-05-09 22:33:18 +08:00
args:
- --global
- --global-dir=./pnpm-global
- npm
- yarn
- pnpm
2020-05-09 22:26:17 +08:00
- name: 'array'
value: |
- {}
- recursive: true
2020-05-09 22:33:18 +08:00
- args:
- --global
- --global-dir=./pnpm-global
- npm
- yarn
- pnpm
2020-05-09 22:26:17 +08:00
steps:
- uses: actions/checkout@v4
2020-05-09 22:26:17 +08:00
- name: Run the action
uses: ./
with:
version: 4.11.1
run_install: ${{ matrix.run_install.value }}
- name: 'Test: which'
run: which pnpm; which pnpx
- name: 'Test: install'
run: pnpm install