-
Notifications
You must be signed in to change notification settings - Fork 330
120 lines (111 loc) · 3.69 KB
/
main.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
name: CI
on:
push:
branches: ["main"]
pull_request:
merge_group:
types: [checks_requested]
env:
CARGO_NET_GIT_FETCH_WITH_CLI: true
jobs:
Test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
rust: [1.56.0, stable, beta, nightly]
exclude:
- os: macos-latest
rust: 1.56.0
- os: windows-latest
rust: 1.56.0
- os: macos-latest
rust: beta
- os: windows-latest
rust: beta
- os: macos-latest
rust: nightly
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- run: cargo build --all-targets
# Run tests
- name: Run tests
run: cargo test
# Run tests enabling the serde feature
- name: Run tests with the serde feature
run: cargo test --features "url/serde,url/expose_internals"
# The #[debugger_visualizer] attribute is currently gated behind a feature flag until #[debugger_visualizer]
# is available in all rustc versions past our MSRV. As such, we only run the tests on newer rustc versions.
- name: Download Latest Windows Debugger
if: |
matrix.os == 'windows-latest' &&
matrix.rust != '1.56.0'
run: |
# Download and install the Windows SDK with the latest debugging tools
Invoke-WebRequest -Uri "https://go.microsoft.com/fwlink/?linkid=2120843" -OutFile "winsdksetup.exe"
Start-Process -FilePath ".\winsdksetup.exe" -ArgumentList "/quiet", "/installpath=C:\WinSDK", "/features +DebuggingTools" -Wait
- name: Verify CDB installation and print version
if: |
matrix.os == 'windows-latest' &&
matrix.rust != '1.56.0'
run: |
$cdb_path = "C:\WinSDK\Debuggers\x64\cdb.exe"
if (Test-Path $cdb_path) {
Write-Host "CDB installed at $cdb_path"
& $cdb_path -version
} else {
Write-Host "CDB installation failed"
exit 1
}
- name: Run debugger_visualizer tests
if: |
matrix.os == 'windows-latest' &&
matrix.rust != '1.56.0'
run: cargo test --test debugger_visualizer --features "url/debugger_visualizer,url_debug_tests/debugger_visualizer" -- --test-threads=1
- name: Test `no_std` support
run: cargo test --no-default-features --features=alloc
WASM:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- run: cargo build --target wasm32-unknown-unknown
- run: cd url && wasm-pack test --headless --chrome
- run: cd url && wasm-pack test --headless --firefox
Lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- run: cargo fmt --all --check
- run: cargo clippy --workspace --all-targets -- -D warnings
if: always()
Audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: EmbarkStudios/cargo-deny-action@v1
Result:
name: Result
runs-on: ubuntu-latest
needs:
- "Test"
- "WASM"
- "Lint"
- "Audit"
steps:
- name: Mark the job as successful
run: exit 0
if: success()
- name: Mark the job as unsuccessful
run: exit 1
if: "!success()"