Skip to content

Commit 822d99a

Browse files
Merge remote-tracking branch 'origin/genius-playlist'
# Conflicts: # crates/mt-tauri/src/lastfm/client.rs
2 parents 75df683 + dc8a7d7 commit 822d99a

4 files changed

Lines changed: 77 additions & 62 deletions

File tree

.github/actions/setup-tauri-build/action.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,22 @@ inputs:
99
runs:
1010
using: 'composite'
1111
steps:
12+
- name: Read pinned Rust toolchain from .tool-versions (Unix)
13+
if: runner.os != 'Windows'
14+
id: rust-version-unix
15+
shell: bash
16+
run: |
17+
version=$(grep '^rust ' .tool-versions | awk '{print $2}')
18+
echo "toolchain=${version}" >> "$GITHUB_OUTPUT"
19+
20+
- name: Read pinned Rust toolchain from .tool-versions (Windows)
21+
if: runner.os == 'Windows'
22+
id: rust-version-windows
23+
shell: pwsh
24+
run: |
25+
$version = (Select-String -Path .tool-versions -Pattern '^rust ').Line -replace '^rust\s+',''
26+
echo "toolchain=$version" >> $env:GITHUB_OUTPUT
27+
1228
- name: Setup macOS self-hosted runner PATH
1329
if: runner.os == 'macOS'
1430
shell: bash
@@ -46,10 +62,11 @@ runs:
4662
run: npm ci
4763

4864

49-
- name: Setup Rust nightly toolchain
65+
- name: Setup Rust toolchain (${{ steps.rust-version-unix.outputs.toolchain || steps.rust-version-windows.outputs.toolchain }})
5066
uses: actions-rust-lang/setup-rust-toolchain@v1
5167
with:
52-
toolchain: nightly
68+
toolchain: ${{ steps.rust-version-unix.outputs.toolchain || steps.rust-version-windows.outputs.toolchain }}
69+
target: ${{ runner.os == 'Windows' && 'x86_64-pc-windows-msvc' || '' }}
5370
cache: false
5471

5572
- name: Setup CI environment (macOS/Linux)

.github/workflows/test.yml

Lines changed: 34 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,13 @@ env:
2626
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
2727

2828
jobs:
29-
rust-lint:
30-
name: Rust Lint and Format Check
31-
runs-on: [self-hosted, macOS, ARM64]
32-
timeout-minutes: 15
29+
rust:
30+
name: Rust Lint, Format, and Test
31+
runs-on: [macOS, ARM64, studio]
32+
timeout-minutes: 20
33+
env:
34+
CARGO_INCREMENTAL: 1
35+
CARGO_TERM_COLOR: always
3336

3437
steps:
3538
- name: Setup macOS self-hosted runner PATH
@@ -40,19 +43,36 @@ jobs:
4043
4144
- uses: actions/checkout@v6
4245

43-
- name: Setup Rust
44-
uses: actions-rust-lang/setup-rust-toolchain@v1
45-
with:
46-
toolchain: nightly
47-
components: clippy, rustfmt
48-
cache: false
49-
50-
- name: Cargo clippy
51-
run: cargo clippy --workspace -- -D warnings
46+
- name: Setup Tauri build environment
47+
uses: ./.github/actions/setup-tauri-build
5248

5349
- name: Cargo fmt check
5450
run: cargo fmt --all -- --check
5551

52+
- name: Cargo clippy
53+
run: cargo clippy --workspace --all-features -- -D warnings
54+
55+
- uses: cargo-bins/cargo-binstall@main
56+
57+
- name: Install cargo-tarpaulin
58+
run: cargo binstall --no-confirm --force cargo-tarpaulin
59+
60+
- name: Run Rust tests with coverage
61+
run: |
62+
cargo tarpaulin --workspace --out Html --out Json --output-dir coverage \
63+
--ignore-tests --skip-clean \
64+
--exclude-files 'crates/mt-tauri/src/commands/*' 'crates/mt-tauri/src/lib.rs' 'crates/mt-tauri/src/main.rs' 'crates/mt-tauri/src/watcher.rs' 'crates/mt-tauri/src/dialog.rs' 'crates/mt-tauri/src/media_keys.rs' \
65+
--fail-under 50
66+
67+
- name: Upload coverage report
68+
if: always()
69+
continue-on-error: true
70+
uses: actions/upload-artifact@v7
71+
with:
72+
name: rust-coverage
73+
path: coverage/
74+
retention-days: 30
75+
5676
deno-lint:
5777
name: Deno Lint and Format Check
5878
runs-on: blacksmith-4vcpu-ubuntu-2404
@@ -74,7 +94,7 @@ jobs:
7494

7595
build:
7696
name: Build (${{ matrix.platform }})
77-
needs: [rust-lint, deno-lint, vitest-tests, playwright-tests, rust-tests]
97+
needs: [rust, deno-lint, vitest-tests, playwright-tests]
7898
strategy:
7999
fail-fast: false
80100
matrix:
@@ -215,41 +235,3 @@ jobs:
215235
path: test-results/
216236
retention-days: 30
217237

218-
rust-tests:
219-
name: Rust Tests with Coverage
220-
needs: rust-lint
221-
runs-on: [macOS, ARM64, studio]
222-
timeout-minutes: 10
223-
env:
224-
CARGO_INCREMENTAL: 1
225-
CARGO_TERM_COLOR: always
226-
227-
steps:
228-
- uses: actions/checkout@v6
229-
230-
- name: Setup Tauri build environment
231-
uses: ./.github/actions/setup-tauri-build
232-
233-
- name: Check Rust build
234-
run: cargo check --workspace --all-features
235-
236-
- uses: cargo-bins/cargo-binstall@main
237-
238-
- name: Install cargo-tarpaulin
239-
run: cargo binstall --no-confirm --force cargo-tarpaulin
240-
241-
- name: Run Rust tests with coverage
242-
run: |
243-
cargo tarpaulin --workspace --out Html --out Json --output-dir coverage \
244-
--ignore-tests --skip-clean \
245-
--exclude-files 'crates/mt-tauri/src/commands/*' 'crates/mt-tauri/src/lib.rs' 'crates/mt-tauri/src/main.rs' 'crates/mt-tauri/src/watcher.rs' 'crates/mt-tauri/src/dialog.rs' 'crates/mt-tauri/src/media_keys.rs' \
246-
--fail-under 50
247-
248-
- name: Upload coverage report
249-
if: always()
250-
continue-on-error: true
251-
uses: actions/upload-artifact@v7
252-
with:
253-
name: rust-coverage
254-
path: coverage/
255-
retention-days: 30

crates/mt-tauri/src/lastfm/client.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,19 @@ impl LastFmClient {
2424
}
2525
}
2626

27+
#[cfg(all(test, feature = "agent"))]
28+
pub(crate) fn new_unconfigured() -> Self {
29+
Self {
30+
config: ApiKeyConfig {
31+
api_key: None,
32+
api_secret: None,
33+
},
34+
rate_limiter: Arc::new(RateLimiter::new()),
35+
http_client: reqwest::Client::new(),
36+
base_url: "https://ws.audioscrobbler.com/2.0/".to_string(),
37+
}
38+
}
39+
2740
/// Check if API is properly configured
2841
pub(crate) fn is_configured(&self) -> bool {
2942
self.config.is_configured()

taskfiles/ci.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@ vars:
1515
CONFIG: '{{.CONFIG | default ""}}'
1616
CONFIG_FLAG: '{{if .CONFIG}}--config {{.CONFIG}}{{end}}'
1717
EXE_EXT: '{{if eq OS "windows"}}.exe{{end}}'
18+
PINNED_RUST:
19+
sh: grep '^rust ' {{.ROOT_DIR}}/.tool-versions | awk '{print $2}'
1820

1921
env:
2022
PATH: "{{.CARGO_BIN}}:{{.MISE_SHIMS}}:{{.PATH}}"
2123
RUSTC_WRAPPER: ""
22-
RUSTUP_TOOLCHAIN: nightly
24+
RUSTUP_TOOLCHAIN: "{{.PINNED_RUST}}"
2325

2426
tasks:
2527
setup:
@@ -33,27 +35,28 @@ tasks:
3335
platforms: [darwin, linux]
3436
cmds:
3537
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs |
36-
sh -s -- -y --default-toolchain nightly --no-modify-path
37-
- rustup toolchain install nightly --profile minimal --no-self-update
38-
- rustup default nightly
38+
sh -s -- -y --default-toolchain {{.PINNED_RUST}} --no-modify-path
39+
- rustup toolchain install {{.PINNED_RUST}} --profile minimal --no-self-update
40+
- rustup default {{.PINNED_RUST}}
3941
- rustc --version
4042
- cargo --version
4143
status:
4244
- test -x "{{.CARGO_BIN}}/rustup"
4345
- test -x "{{.CARGO_BIN}}/rustc"
4446
- test -x "{{.CARGO_BIN}}/cargo"
45-
- rustup run nightly rustc --version
47+
- rustup run {{.PINNED_RUST}} rustc --version
4648

4749
setup-rust-windows:
4850
desc: "Configure rustup nightly toolchain (Windows)"
4951
platforms: [windows]
5052
cmds:
51-
- rustup toolchain install nightly --profile minimal --no-self-update --target x86_64-pc-windows-msvc
52-
- rustup default nightly
53+
- rustup toolchain install {{.PINNED_RUST}} --profile minimal --no-self-update --target x86_64-pc-windows-msvc
54+
- rustup default {{.PINNED_RUST}}
5355
- rustc --version
5456
- cargo --version
5557
status:
56-
- rustup run nightly rustc --version
58+
- rustup run {{.PINNED_RUST}} rustc --version
59+
- rustup target list --installed --toolchain {{.PINNED_RUST}} | findstr x86_64-pc-windows-msvc
5760

5861
setup-cargo-tools:
5962
desc: "Install cargo-binstall and tauri-cli"

0 commit comments

Comments
 (0)