-
-
Notifications
You must be signed in to change notification settings - Fork 19
219 lines (209 loc) · 7.22 KB
/
verify.yml
File metadata and controls
219 lines (209 loc) · 7.22 KB
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
name: Verify
on:
push:
branches:
- master
pull_request:
permissions:
contents: write
jobs:
lighthouse:
name: Lighthouse report
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: treosh/lighthouse-ci-action@v11
with:
urls: |
https://simpleicons.org/
https://simpleicons.org/preview/
uploadArtifacts: true
temporaryPublicStorage: true
lint:
name: Lint (`cargo make lint`)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: wasm32-unknown-unknown
components: clippy
cache-key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }}-lint-${{ hashFiles('**/rust-toolchain.toml') }}
- name: Install tooling dependencies
uses: taiki-e/install-action@v2
with:
tool: cargo-make,cargo-machete
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: npm
- name: Install Node.js dependencies
run: npm ci --no-audit --no-fund
- name: Build
run: cargo make build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Lint
run: cargo make lint
dylint:
name: Lint (`cargo make dylint`)
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get dylint library toolchain
id: get-channel
run: |
channel=$(cat rust-toolchain.toml | grep channel | cut -d'"' -f2)
echo "channel=$channel" >> $GITHUB_OUTPUT
- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ steps.get-channel.outputs.channel }}
target: wasm32-unknown-unknown
components: clippy
cache-key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }}-dylint-${{ steps.get-channel.outputs.channel }}-${{ hashFiles('**/rust-toolchain.toml') }}
cache-directories: |
~/.dylint_drivers
- name: Install tooling dependencies
uses: taiki-e/install-action@v2
with:
tool: cargo-make,dylint-link
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: npm
- name: Install Node.js dependencies
run: npm ci --no-audit --no-fund
- name: Build
run: cargo make build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Lint
run: cargo make dylint
end2end-tests:
name: ${{ matrix.name }}
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
include:
- name: Chrome Desktop${{ github.ref == 'refs/heads/master' && ' and publish' || '' }}
browser: chrome
suite: desktop
window-size: 1920x1080
runs-on: ubuntu-latest
- name: Edge Desktop
browser: edge
suite: desktop
window-size: 1920x1080
runs-on: ubuntu-latest
- name: Firefox Desktop
browser: firefox
suite: desktop
window-size: 1920x1080
runs-on: ubuntu-latest
#- name: Chrome Mobile
# browser: chrome
# runs-on: ubuntu-22.04
# window-size: 412x915
#- name: Chrome Mobile Landscape
# browser: chrome
# runs-on: ubuntu-22.04
# window-size: 915x412
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: wasm32-unknown-unknown
- name: Should publish?
id: check-publish
shell: bash
run: |
if [ "${{ matrix.browser }}" = "chrome" ] && [ "${{ matrix.suite }}" = "desktop" ] && [ "${{ github.ref }}" = "refs/heads/master" ]; then
echo "publish=true" >> $GITHUB_OUTPUT
else
echo "publish=false" >> $GITHUB_OUTPUT
fi
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: .node-version
cache: ${{ steps.check-publish.outputs.publish == 'true' && '' || 'npm' }}
- name: Install tooling dependencies
uses: taiki-e/install-action@v2
with:
tool: cargo-make
- name: Install Node.js dependencies
run: npm ci --no-audit --no-fund
- name: Build
run: cargo make build
env:
RELEASE: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Show dist tree
run: tree -ah -L 1 app/dist
- name: Run chromedriver
if: matrix.browser == 'chrome'
run: chromedriver --port=4444 &
- name: Run geckodriver
if: matrix.browser == 'firefox'
run: geckodriver --port=4444 &
- name: Run msedgedriver
if: matrix.browser == 'edge'
run: msedgedriver --port=4444 &
- uses: JarvusInnovations/background-action@v1
name: Run app server
with:
run: npx serve --no-clipboard -l 8080 app/dist &
wait-on: http://127.0.0.1:8080
wait-for: 5m
- name: Run tests
uses: nick-fields/retry@v3
continue-on-error: ${{ matrix.browser == 'firefox' }}
with:
timeout_minutes: 20
max_attempts: ${{ matrix.browser == 'firefox' && 1 || 3 }}
command: cargo test --package end2end --test ${{ matrix.suite }} -- --fail-fast --concurrency=${{ matrix.browser == 'firefox' && '1' || '12' }}
env:
BROWSER: ${{ matrix.browser }}
WINDOW_SIZE: ${{ matrix.window-size }}
- name: Check is fork
uses: ./.github/actions/check-is-fork
id: check-is-fork
if: steps.check-publish.outputs.publish == 'true'
with:
in-fork-message: 'Publish only can be executed in the main repository, skipping.'
- uses: actions/create-github-app-token@v1
if: |
steps.check-publish.outputs.publish == 'true' &&
steps.check-is-fork.outputs.is-fork == 'false'
id: app-token
with:
app-id: ${{ vars.BOT_APP_ID }}
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
- name: Publish website
if: |
steps.check-publish.outputs.publish == 'true' &&
steps.check-is-fork.outputs.is-fork == 'false'
run: |
git config --global user.name "simple-icons[bot]"
git config --global user.email "simple-icons[bot]@users.noreply.github.com"
mkdir -p gh-pages-temp
cd gh-pages-temp
git init
git remote add origin "https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/${{ github.repository }}.git"
git fetch origin gh-pages --depth=1 || true
git checkout origin/gh-pages -- CNAME 2>/dev/null || true
cp -r ../app/dist/* .
git add -A
git commit -m "Deploy from commit ${{ github.sha }}"
git push --force origin HEAD:gh-pages