Skip to content

Commit 18b9b39

Browse files
authored
Merge pull request #43 from azriel91/maintenance/update-to-edition-2024
2 parents e0de5d0 + ed42f88 commit 18b9b39

26 files changed

+213
-626
lines changed

.github/workflows/ci.yml

Lines changed: 108 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
- main
55
pull_request:
66
branches:
7-
- '**'
7+
- "**"
88

99
name: CI
1010

@@ -15,32 +15,32 @@ jobs:
1515
timeout-minutes: 10
1616
steps:
1717
- uses: actions/checkout@v4
18-
- uses: actions-rust-lang/audit@v1
19-
name: Audit Rust Dependencies
18+
- name: "Generate Cargo.lock"
19+
run: cargo generate-lockfile
20+
- uses: rustsec/audit-check@v2
2021
with:
21-
denyWarnings: true
22-
createIssues: false
22+
token: ${{ secrets.GITHUB_TOKEN }}
2323

2424
licenses:
2525
name: Licenses
2626
runs-on: ubuntu-latest
2727
steps:
28-
- uses: actions/checkout@v4
29-
- uses: EmbarkStudios/cargo-deny-action@v2
28+
- uses: actions/checkout@v4
29+
- uses: EmbarkStudios/cargo-deny-action@v2
3030

31-
- name: cargo-about cache
32-
id: cargo-about-cache
33-
uses: actions/cache@v4
34-
with:
35-
path: ~/.cargo/bin/cargo-about
36-
key: cargo-about-${{ runner.os }}
31+
- name: cargo-about cache
32+
id: cargo-about-cache
33+
uses: actions/cache@v4
34+
with:
35+
path: ~/.cargo/bin/cargo-about
36+
key: cargo-about-${{ runner.os }}
3737

38-
- name: cargo-about install
39-
if: steps.cargo-about-cache.outputs.cache-hit != 'true'
40-
run: cargo install --locked cargo-about
38+
- name: cargo-about install
39+
if: steps.cargo-about-cache.outputs.cache-hit != 'true'
40+
run: cargo install --locked cargo-about
4141

42-
- name: cargo-about generate licenses
43-
run: cargo about generate --workspace --features "server_side_graphviz" about.hbs > doc/src/licenses.html
42+
- name: cargo-about generate licenses
43+
run: cargo about generate --workspace about.hbs > doc/src/licenses.html
4444

4545
fmt:
4646
name: Rustfmt
@@ -82,14 +82,14 @@ jobs:
8282
toolchain: nightly
8383
components: clippy
8484

85-
- name: 'Run clippy (client side graphviz)'
85+
- name: "Run clippy (client side graphviz)"
8686
run: |
8787
cargo clippy --workspace -- -D warnings
8888
89-
- name: 'Run clippy (server side graphviz)'
89+
- name: "Run clippy (server side graphviz)"
9090
# we cannot use `--all-features` because `dot_ix` has features that are mutually exclusive.
9191
run: |
92-
cargo clippy --workspace --features "server_side_graphviz" -- -D warnings
92+
cargo clippy --workspace -- -D warnings
9393
9494
coverage:
9595
name: Coverage
@@ -104,14 +104,14 @@ jobs:
104104

105105
- uses: taiki-e/install-action@cargo-llvm-cov
106106

107-
- name: 'Collect coverage'
107+
- name: "Collect coverage"
108108
run: ./coverage.sh
109109

110-
- name: 'Print directory sizes'
110+
- name: "Print directory sizes"
111111
run: du -sh target/coverage target/llvm-cov-target
112112

113113
- name: Upload to codecov.io
114-
uses: codecov/codecov-action@v4
114+
uses: codecov/codecov-action@v5
115115
with:
116116
files: ./target/coverage/lcov.info
117117
token: ${{ secrets.CODECOV_TOKEN }}
@@ -124,11 +124,11 @@ jobs:
124124
- uses: actions/checkout@v4
125125
- uses: dtolnay/rust-toolchain@stable
126126

127-
- name: 'Build and test'
127+
- name: "Build and test"
128128
run: cargo test --workspace
129129

130-
build_playground_linux:
131-
name: Build Playground (Linux)
130+
build_playground_linux_leptos:
131+
name: Build Playground (Linux) - cargo-leptos
132132
# On `ubuntu-latest`, this job fails because the CI runner is CPU bound
133133
# when `monaco` is built.
134134
#
@@ -137,32 +137,82 @@ jobs:
137137
# See <https://github.com/actions/runner-images/issues/6680>
138138
runs-on: ubuntu-22.04
139139
timeout-minutes: 25
140+
env:
141+
# Seems to solve this issue:
142+
#
143+
# ```text
144+
# 0: Unexpected token Semicolon at :1360:9
145+
# ```
146+
LEPTOS_TAILWIND_VERSION: "v4.1.4"
140147
steps:
141148
- uses: actions/checkout@v4
142-
- name: 'Install Rust'
149+
- name: "Install Rust"
143150
uses: dtolnay/rust-toolchain@master
144151
with:
145152
toolchain: stable
146153
targets: wasm32-unknown-unknown
147154

148-
- name: cargo-leptos cache
149-
id: cargo-leptos-cache
150-
uses: actions/cache@v4
155+
- name: cargo-leptos cache restore
156+
id: cargo_leptos_cache_restore
157+
uses: actions/cache/restore@v4
151158
with:
152159
path: ~/.cargo/bin/cargo-leptos
153-
key: cargo-leptos-${{ runner.os }}
160+
key: ${{ runner.os }}-cargo-leptos
161+
162+
- run: cargo install cargo-leptos
163+
if: steps.cargo_leptos_cache_restore.outputs.cache-hit != 'true'
154164

155-
- name: cargo-leptos install
156-
if: steps.cargo-leptos-cache.outputs.cache-hit != 'true'
157-
run: cargo install cargo-leptos
165+
- name: cargo-leptos cache save
166+
id: cargo_leptos_cache_save
167+
uses: actions/cache/save@v4
168+
if: always() && steps.cargo_leptos_cache_restore.outputs.cache-hit != 'true'
169+
with:
170+
path: ~/.cargo/bin/cargo-leptos
171+
key: ${{ runner.os }}-cargo-leptos
158172

159-
- name: 'Build playground'
173+
- name: "Build playground"
160174
working-directory: ./playground
161175
run: cargo leptos build -v
162176

163-
- name: 'Build playground (server side graphviz)'
177+
build_playground_linux_trunk:
178+
name: Build Playground (Linux) - trunk
179+
# On `ubuntu-latest`, this job fails because the CI runner is CPU bound
180+
# when `monaco` is built.
181+
#
182+
# Trying 22.04 to see if it alleviates the problem.
183+
#
184+
# See <https://github.com/actions/runner-images/issues/6680>
185+
runs-on: ubuntu-22.04
186+
timeout-minutes: 25
187+
steps:
188+
- uses: actions/checkout@v4
189+
- name: "Install Rust"
190+
uses: dtolnay/rust-toolchain@master
191+
with:
192+
toolchain: stable
193+
targets: wasm32-unknown-unknown
194+
195+
- name: trunk cache restore
196+
id: trunk_cache_restore
197+
uses: actions/cache/restore@v4
198+
with:
199+
path: ~/.cargo/bin/trunk
200+
key: ${{ runner.os }}-trunk
201+
202+
- run: cargo install trunk
203+
if: steps.trunk_cache_restore.outputs.cache-hit != 'true'
204+
205+
- name: trunk cache save
206+
id: trunk_cache_save
207+
uses: actions/cache/save@v4
208+
if: always() && steps.trunk_cache_restore.outputs.cache-hit != 'true'
209+
with:
210+
path: ~/.cargo/bin/trunk
211+
key: ${{ runner.os }}-trunk
212+
213+
- name: "Build playground"
164214
working-directory: ./playground
165-
run: cargo leptos build --features "server_side_graphviz" -v
215+
run: trunk build -v
166216

167217
build_and_test_windows:
168218
name: Build and Test (Windows)
@@ -175,41 +225,42 @@ jobs:
175225
- uses: actions/checkout@v4
176226
- uses: dtolnay/rust-toolchain@stable
177227

178-
- name: 'Build and test'
228+
- name: "Build and test"
179229
run: cargo test --workspace
180230

181-
build_playground_windows:
182-
name: Build Playground (Windows)
231+
build_playground_windows_trunk:
232+
name: Build Playground (Windows) - trunk
183233
runs-on: windows-latest
184234
timeout-minutes: 30
185235
steps:
186236
- name: Prepare symlink configuration
187237
run: git config --global core.symlinks true
188238

189239
- uses: actions/checkout@v4
190-
- name: 'Install Rust'
240+
- name: "Install Rust"
191241
uses: dtolnay/rust-toolchain@master
192242
with:
193243
toolchain: stable
194244
targets: wasm32-unknown-unknown
195245

196-
- name: cargo-leptos cache
197-
id: cargo-leptos-cache
198-
uses: actions/cache@v4
246+
- name: trunk cache restore
247+
id: trunk_cache_restore
248+
uses: actions/cache/restore@v4
199249
with:
200-
path: 'C:\Users\runneradmin\.cargo\bin\cargo-leptos.exe'
201-
key: cargo-leptos-${{ runner.os }}
250+
path: 'C:\Users\runneradmin\.cargo\bin\trunk.exe'
251+
key: ${{ runner.os }}-trunk
202252

203-
- name: cargo-leptos install
204-
if: steps.cargo-leptos-cache.outputs.cache-hit != 'true'
205-
# --locked: fix is in-progress at https://github.com/leptos-rs/cargo-leptos/pull/274
206-
run: |-
207-
cargo install cargo-leptos --locked
253+
- run: cargo install trunk
254+
if: steps.trunk_cache_restore.outputs.cache-hit != 'true'
208255

209-
- name: 'Build playground'
210-
working-directory: ./playground
211-
run: cargo leptos build -v
256+
- name: trunk cache save
257+
id: trunk_cache_save
258+
uses: actions/cache/save@v4
259+
if: always() && steps.trunk_cache_restore.outputs.cache-hit != 'true'
260+
with:
261+
path: 'C:\Users\runneradmin\.cargo\bin\trunk.exe'
262+
key: ${{ runner.os }}-trunk
212263

213-
- name: 'Build playground (server side graphviz)'
264+
- name: "Build playground"
214265
working-directory: ./playground
215-
run: cargo leptos build --features "server_side_graphviz" -v
266+
run: trunk build -v

.github/workflows/pages.yml

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,29 +32,15 @@ jobs:
3232
- name: Checkout
3333
uses: actions/checkout@v4
3434

35-
- name: 'Install Rust'
35+
- name: "Install Rust"
3636
uses: dtolnay/rust-toolchain@master
3737
with:
3838
toolchain: nightly
3939
targets: wasm32-unknown-unknown
4040

41-
- name: cargo-leptos cache
42-
id: cargo-leptos-cache
43-
uses: actions/cache@v4
44-
with:
45-
path: ~/.cargo/bin/cargo-leptos
46-
key: cargo-leptos-${{ runner.os }}
47-
48-
- name: cargo-leptos install
49-
if: steps.cargo-leptos-cache.outputs.cache-hit != 'true'
50-
run: cargo install cargo-leptos
51-
5241
- name: Setup Pages
5342
uses: actions/configure-pages@v5
5443

55-
- name: Download and install tailwindcss binary
56-
run: npm install -D tailwindcss
57-
5844
- name: Download and install Trunk binary
5945
run: wget -qO- https://github.com/thedodd/trunk/releases/latest/download/trunk-x86_64-unknown-linux-gnu.tar.gz | tar -xzf-
6046

@@ -81,7 +67,7 @@ jobs:
8167
uses: actions/upload-pages-artifact@v3
8268
with:
8369
# Upload playground/dist directory
84-
path: 'playground/dist'
70+
path: "playground/dist"
8571

8672
- name: Deploy to GitHub Pages
8773
id: deployment

.github/workflows/publish.yml

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
on:
22
push:
33
tags:
4-
- '*'
4+
- "*"
55

66
name: Publish
77

@@ -12,11 +12,11 @@ jobs:
1212
timeout-minutes: 10
1313
steps:
1414
- uses: actions/checkout@v4
15-
- uses: actions-rust-lang/audit@v1
16-
name: Audit Rust Dependencies
15+
- name: "Generate Cargo.lock"
16+
run: cargo generate-lockfile
17+
- uses: rustsec/audit-check@v2
1718
with:
18-
denyWarnings: true
19-
createIssues: false
19+
token: ${{ secrets.GITHUB_TOKEN }}
2020

2121
build_and_test_linux:
2222
name: Build and Test (Linux)
@@ -26,7 +26,7 @@ jobs:
2626
- uses: actions/checkout@v4
2727
- uses: dtolnay/rust-toolchain@stable
2828

29-
- name: 'Build and test'
29+
- name: "Build and test"
3030
run: cargo test --workspace
3131

3232
build_and_test_windows:
@@ -40,7 +40,7 @@ jobs:
4040
- uses: actions/checkout@v4
4141
- uses: dtolnay/rust-toolchain@stable
4242

43-
- name: 'Build and test'
43+
- name: "Build and test"
4444
run: cargo test --workspace
4545

4646
crates_io_publish:
@@ -56,34 +56,30 @@ jobs:
5656
- uses: actions/checkout@v4
5757
- uses: dtolnay/rust-toolchain@stable
5858

59-
- name: cargo-release Cache
60-
id: cargo_release_cache
61-
uses: actions/cache@v4
59+
- name: cargo-release cache restore
60+
id: cargo_release_cache_restore
61+
uses: actions/cache/restore@v4
6262
with:
6363
path: ~/.cargo/bin/cargo-release
6464
key: ${{ runner.os }}-cargo-release
6565

6666
- run: cargo install cargo-release
67-
if: steps.cargo_release_cache.outputs.cache-hit != 'true'
67+
if: steps.cargo_release_cache_restore.outputs.cache-hit != 'true'
68+
69+
- name: cargo-release cache save
70+
id: cargo_release_cache_save
71+
uses: actions/cache/save@v4
72+
if: always() && steps.cargo_release_cache_restore.outputs.cache-hit != 'true'
73+
with:
74+
path: ~/.cargo/bin/cargo-release
75+
key: ${{ runner.os }}-cargo-release
6876

6977
- name: cargo login
70-
run: cargo login ${{ secrets.CRATES_IO_API_TOKEN }}
78+
run: |-
79+
echo "${{ secrets.CRATES_IO_API_TOKEN }}" | cargo login
7180
7281
# allow-branch HEAD is because GitHub actions switches
7382
# to the tag while building, which is a detached head
74-
75-
# Publishing is currently messy, because:
76-
#
77-
# * `peace_rt_model_core` exports `NativeError` or `WebError` depending on the target.
78-
# * `peace_rt_model_web` fails to build when publishing the workspace for a native target.
79-
# * `peace_rt_model_web` still needs its dependencies to be published before it can be
80-
# published.
81-
# * `peace_rt_model_hack` needs `peace_rt_model_web` to be published before it can be
82-
# published.
83-
#
84-
# We *could* pass through `--no-verify` so `cargo` doesn't build the crate before publishing,
85-
# which is reasonable, since this job only runs after the Linux, Windows, and WASM builds
86-
# have passed.
8783
- name: "cargo release publish"
8884
run: |-
8985
cargo release \

0 commit comments

Comments
 (0)