-
Notifications
You must be signed in to change notification settings - Fork 9
246 lines (220 loc) · 9.98 KB
/
integration-tests.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
name: Integration Tests
on:
workflow_dispatch:
pull_request:
branches:
- main
push:
branches:
- main
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: yarn
- name: Install dependencies
run: yarn install
- name: Build package
run: yarn build
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: vue-mess-detector
retention-days: 1
path: |
./package.json
./dist
./node_modules
./yarn.lock
./index.d.ts
test-create-vue:
runs-on: ${{ matrix.platform }}
needs: build
strategy:
matrix:
platform: [macos-latest, ubuntu-latest, windows-latest]
package-manager: [npm, yarn, pnpm, bun]
name: Testing Vue with ${{ matrix.package-manager }} on ${{ matrix.platform }}
steps:
- name: Create directories
run: |
mkdir ./package
mkdir ./test-repo
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: vue-mess-detector
path: ./package
- if: matrix.package-manager != 'bun'
name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- if: matrix.package-manager == 'pnpm'
name: Check PNPM
uses: pnpm/action-setup@v4
with:
version: 9.9.0
- if: matrix.package-manager == 'yarn'
name: Check Yarn
run: |
corepack prepare yarn@stable --activate
yarn set version stable
- if: matrix.package-manager == 'bun'
name: Check Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.1.26
- if: runner.os != 'Windows'
name: Create and Run Vue Mess Detector (Linux/Mac)
working-directory: ./test-repo
run: |
if [ "${{ matrix.package-manager }}" == "pnpm" ]; then
yes "my-package" | head -n 1 | pnpm create vue@latest . --default --typescript
pnpm add file:${{ github.workspace }}/package/ -D
pnpm install
pnpm vue-mess-detector analyze --output=json --file-output=vmd-output.json
elif [ "${{ matrix.package-manager }}" == "yarn" ]; then
yes "my-package" | head -n 1 | yarn --cwd . create vue . --default --typescript
touch ./yarn.lock
yarn add vue-mess-detector@file:${{ github.workspace }}/package/ -D
yarn install
yarn vue-mess-detector analyze --output=json --file-output=vmd-output.json
elif [ "${{ matrix.package-manager }}" == "bun" ]; then
yes "my-package" | head -n 1 | bun create vue . --default --typescript --cwd=. --ignore-scripts
bun add file:${{ github.workspace }}/package/ --dev
bun install --ignore-scripts
bun run vue-mess-detector analyze --output=json --file-output=vmd-output.json
else
yes "my-package" | head -n 1 | npm create vue@latest -- . --default --typescript
npm install file:${{ github.workspace }}/package/ --save-dev
npm install
npx vue-mess-detector analyze --output=json --file-output=vmd-output.json
fi
node -e "const fs = require('fs'); try { const data = JSON.parse(fs.readFileSync('vmd-output.json', 'utf8')); console.log(JSON.stringify(data, null, 2)); } catch (e) { throw new Error('Something went wrong'); }"
- if: runner.os == 'Windows'
name: Create and Run Vue Mess Detector (Windows)
working-directory: ./test-repo
run: |
if ($Env:matrix_package_manager -eq 'pnpm') {
echo "my-package" | pnpm create vue@latest . --default --typescript
pnpm add file:${{ github.workspace }}/package/ -D
pnpm install
pnpm vue-mess-detector analyze --output=json --file-output=vmd-output.json
} elseif ($Env:matrix_package_manager -eq 'yarn') {
echo "my-package" | yarn create vue . --default --typescript
touch ./yarn.lock
yarn add vue-mess-detector@file:${{ github.workspace }}/package/ -D
yarn install
yarn vue-mess-detector analyze --output=json --file-output=vmd-output.json
} elseif ($Env:matrix_package_manager -eq 'bun') {
echo "my-package" | bun create vue . --default --typescript --ignore-scripts
bun add file:${{ github.workspace }}/package/ --d
bun install --ignore-scripts
bun run vue-mess-detector analyze --output=json --file-output=vmd-output.json
} else {
echo "my-package" | npm create vue@latest -- . --default --typescript
npm install file:${{ github.workspace }}/package/ --save-dev
npm install
npx vue-mess-detector analyze --output=json --file-output=vmd-output.json
}
node -e "const fs = require('fs'); try { const data = JSON.parse(fs.readFileSync('vmd-output.json', 'utf8')); console.log(JSON.stringify(data, null, 2)); } catch (e) { throw new Error('Something went wrong'); }"
test-nuxi:
runs-on: ${{ matrix.platform }}
needs: build
strategy:
matrix:
platform: [macos-latest, ubuntu-latest, windows-latest]
package-manager: [npm, yarn, pnpm, bun]
name: Testing Nuxt with ${{ matrix.package-manager }} on ${{ matrix.platform }}
steps:
- name: Create directories
run: |
mkdir ./package
mkdir ./test-repo
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: vue-mess-detector
path: ./package
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- if: matrix.package-manager == 'pnpm'
name: Check PNPM
uses: pnpm/action-setup@v4
with:
version: latest
- if: matrix.package-manager == 'yarn'
name: Check Yarn
run: |
corepack prepare yarn@stable --activate
yarn set version stable
- if: matrix.package-manager == 'bun'
name: Check Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- if: runner.os != 'Windows'
name: Create and Run Vue Mess Detector (Linux/Mac)
working-directory: ./test-repo
run: |
if [ "${{ matrix.package-manager }}" == "pnpm" ]; then
(cd .. && pnpm dlx nuxi@latest init test-repo --package-manager pnpm --git-init -t themes/content-wind)
pnpm add file:${{ github.workspace }}/package/ -D
pnpm install
pnpm vue-mess-detector analyze ./ --output=json --file-output=vmd-output.json
elif [ "${{ matrix.package-manager }}" == "yarn" ]; then
(cd .. && yarn dlx nuxi@latest init test-repo --package-manager yarn --git-init -t themes/content-wind --no-install)
touch yarn.lock
yarn add vue-mess-detector@file:${{ github.workspace }}/package/ -D
yarn install
yarn vue-mess-detector analyze ./ --output=json --file-output=vmd-output.json
elif [ "${{ matrix.package-manager }}" == "bun" ]; then
(cd .. && bun x nuxi@latest init test-repo --package-manager bun --git-init -t themes/content-wind)
bun add file:${{ github.workspace }}/package/ --dev
bun install --ignore-scripts
bun run vue-mess-detector analyze ./ --output=json --file-output=vmd-output.json
else
(cd .. && npx nuxi@latest init test-repo --package-manager npm --git-init -t themes/content-wind)
npm install file:${{ github.workspace }}/package/ --save-dev
npm install
npx vue-mess-detector analyze ./ --output=json --file-output=vmd-output.json
fi
node -e "const fs = require('fs'); try { const data = JSON.parse(fs.readFileSync('vmd-output.json', 'utf8')); console.log(JSON.stringify(data, null, 2)); } catch (e) { throw new Error('Something went wrong'); }"
- if: runner.os == 'Windows'
name: Create and Run Vue Mess Detector (Windows)
working-directory: ./test-repo
run: |
if ($Env:matrix_package_manager -eq 'pnpm') {
(cd .. && pnpm dlx nuxi@latest init test-repo --package-manager pnpm --git-init -t themes/content-wind)
pnpm add file:${{ github.workspace }}/package/ -D
pnpm install
pnpm vue-mess-detector analyze ./ --output=json --file-output=vmd-output.json
} elseif ($Env:matrix_package_manager -eq 'yarn') {
(cd .. && yarn dlx nuxi@latest init test-repo --package-manager yarn --git-init -t themes/content-wind --no-install)
touch ./yarn.lock
yarn add vue-mess-detector@file:${{ github.workspace }}/package/ -D
yarn install
yarn vue-mess-detector analyze ./ --output=json --file-output=vmd-output.json
} elseif ($Env:matrix_package_manager -eq 'bun') {
(cd .. && bun x nuxi@latest init test-repo --package-manager bun --git-init -t themes/content-wind)
bun add file:${{ github.workspace }}/package/ --dev
bun install --ignore-scripts
bun run vue-mess-detector analyze ./ --output=json --file-output=vmd-output.json
} else {
(cd .. && npx nuxi@latest init test-repo --package-manager npm --git-init -t themes/content-wind)
npm install file:${{ github.workspace }}/package/ --save-dev
npm install
npx vue-mess-detector analyze ./ --output=json --file-output=vmd-output.json
}
node -e "const fs = require('fs'); try { const data = JSON.parse(fs.readFileSync('vmd-output.json', 'utf8')); console.log(JSON.stringify(data, null, 2)); } catch (e) { throw new Error('Something went wrong'); }"