This repository has been archived by the owner on Oct 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (87 loc) · 2.41 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: Test
on:
pull_request:
branches:
- main
push:
branches:
- main
workflow_dispatch:
jobs:
build-lint:
strategy:
matrix:
node-version: [20.x]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: latest
run_install: |
- recursive: true
args: [--no-frozen-lockfile]
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3.8.1
with:
node-version: ${{ matrix.node-version }}
- name: build
run: |
pnpm lint --fix
pnpm build
pnpm package
pnpm test
action-test:
strategy:
matrix:
node-version: [20.x]
args: [
{
'yarn': 'false', 'path': './tests/package-test.json', 'ignore': '[]'
},
{
'yarn': 'true', 'path': './tests/package-test.json', 'ignore': '[]'
},
{
'yarn': 'false', 'path': './tests/package-test.json',
'ignore': '[ "@types/jest", "jest", "jest-circus", "ts-jest" ]'
},
{
'yarn': 'true', 'path': './tests/package-test.json',
'ignore': '[ "@types/jest", "jest", "jest-circus", "ts-jest" ]'
}
]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3.8.1
with:
node-version: ${{ matrix.node-version }}
- name: prepare
id: prepare
run: |
TEMP=$(mktemp -d);
PKG_JSON=${TEMP}/package.json
cp -pR ${{ matrix.args.path }} ${PKG_JSON}
echo "TEMP=${TEMP}" >> $GITHUB_ENV
echo "PKG_JSON=${PKG_JSON}" >> "$GITHUB_OUTPUT"
lock_file=package-lock.json
if [ ${{ matrix.args.yarn }} = 'true' ]; then
lock_file=yarn.lock
fi
echo "LOCK_FILE=${TEMP}/${lock_file}" >> "$GITHUB_OUTPUT"
- name: update and test
uses: './'
with:
yarn: ${{ matrix.args.yarn }}
debug: true
path: ${{ steps.prepare.outputs.PKG_JSON }}
ignore: |
${{ matrix.args.ignore }}
- name: verify test result
env:
LOCK_FILE: ${{ steps.prepare.outputs.LOCK_FILE }}
run: test -e "${{ steps.prepare.outputs.LOCK_FILE }}" || exit 1