-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
184 lines (151 loc) · 5.42 KB
/
project-creation-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
name: Project creation tests
on:
workflow_dispatch:
release:
types:
- released # A release was published, or a pre-release was changed to a release.
pull_request:
types: [opened, synchronize]
branches:
- 'dev'
paths:
- '.github/workflows/project-creation-tests.yml'
- 'create-quasar/**'
jobs:
lint:
if: >-
${{
github.event_name == 'workflow_dispatch' ||
github.event_name == 'pull_request' ||
startsWith(github.event.release.tag_name, 'quasar') ||
startsWith(github.event.release.tag_name, '@quasar/extras') ||
startsWith(github.event.release.tag_name, '@quasar/app-webpack') ||
startsWith(github.event.release.tag_name, '@quasar/app-vite')
}}
permissions:
contents: read # to fetch code (actions/checkout)
runs-on: ubuntu-latest
defaults:
run:
working-directory: create-quasar
name: Lint create-quasar
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v3
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- name: Install dependencies
run: pnpm i
- name: Lint the code
run: pnpm lint
test:
needs: lint
permissions:
contents: read # to fetch code (actions/checkout)
runs-on: ubuntu-latest
env:
# See https://github.com/yarnpkg/yarn/issues/9015
SKIP_YARN_COREPACK_CHECK: 1
defaults:
run:
working-directory: create-quasar
strategy:
fail-fast: false
matrix:
script-type: [js, ts]
app-engine: [vite-1, vite-2, webpack-3, webpack-4]
node-version: [18, 20]
package-manager: [yarn, npm, pnpm]
name: Test ${{ matrix.script-type }}-${{ matrix.app-engine }} (Node v${{ matrix.node-version }} - ${{ matrix.package-manager }})
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v3
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install dependencies
run: pnpm i
# pnpm
- name: Get pnpm store directory
if: ${{ matrix.package-manager == 'pnpm' }}
id: pnpm-cache
run: |
echo "PNPM_CACHE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
if: ${{ matrix.package-manager == 'pnpm' }}
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.PNPM_CACHE_PATH }}
key: pnpm-cache-${{ matrix.app-engine }}-${{ matrix.script-type }}
restore-keys: |
pnpm-cache-${{ matrix.app-engine }}-
pnpm-cache-
# yarn
- name: Get yarn cache directory
if: ${{ matrix.package-manager == 'yarn' }}
id: yarn-cache
run: |
echo "YARN_CACHE_PATH=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Setup yarn cache
if: ${{ matrix.package-manager == 'yarn' }}
uses: actions/cache@v4
with:
path: ${{ steps.yarn-cache.outputs.YARN_CACHE_PATH }}
key: yarn-cache-${{ matrix.app-engine }}-${{ matrix.script-type }}
restore-keys: |
yarn-cache-${{ matrix.app-engine }}-
yarn-cache-
# npm
- name: Get npm cache directory
if: ${{ matrix.package-manager == 'npm' }}
id: npm-cache
run: |
echo "NPM_CACHE_PATH=$(npm config get cache)" >> $GITHUB_OUTPUT
- name: Setup npm cache
if: ${{ matrix.package-manager == 'npm' }}
uses: actions/cache@v4
with:
path: ${{ steps.npm-cache.outputs.NPM_CACHE_PATH }}
key: npm-cache-${{ matrix.app-engine }}-${{ matrix.script-type }}
restore-keys: |
npm-cache-${{ matrix.app-engine }}-
npm-cache-
- name: Create the test project
run: pnpm create-test-project ${{ matrix.script-type }} ${{ matrix.app-engine }} ${{ matrix.package-manager }}
- name: Lint the project
working-directory: create-quasar/test-project
run: ${{ matrix.package-manager }} run lint
- name: Test the build
working-directory: create-quasar/test-project
run: ${{ matrix.package-manager }} run build
- name: Test the development server
working-directory: create-quasar/test-project
env:
# For Vite, see https://github.com/jeffbski/wait-on/issues/78#issuecomment-867813529
WAIT_ON_CONFIG: |
{
"headers": {
"accept": "text/html"
}
}
# wait-on is pinned for stability and safety reasons, it can be updated manually after testing a new version
run: |
${{ matrix.package-manager }} run dev &
if [[ '${{ matrix.app-engine }}' == vite* ]]; then
echo $WAIT_ON_CONFIG > wait-on.json
npx [email protected] --config wait-on.json --timeout 5000 http-get://127.0.0.1:9000
else
PORT=$([[ '${{ matrix.app-engine }}' == 'webpack-4' ]] && echo '9000' || echo '8080')
# 15s is almost enough, but due to possible fluctuations in the CI environment, we set it higher than that
npx [email protected] --timeout 20000 http-get://127.0.0.1:$PORT
fi
kill $!