-
Notifications
You must be signed in to change notification settings - Fork 35
169 lines (142 loc) · 4.89 KB
/
test.yml
File metadata and controls
169 lines (142 loc) · 4.89 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
name: Build and Test
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
CARGO_PROFILE_TEST_DEBUG: 0
KICAD_VERSION: 10.0.0 # Update container image below when changing this
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Lint and Check
runs-on: ubicloud-standard-16-ubuntu-2404
timeout-minutes: 10
steps:
- uses: actions/checkout@v5
- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: ${{ runner.os == 'Windows' && 'stable-x86_64-pc-windows-msvc' || 'stable' }}
components: rustfmt, clippy
- name: Check All
run: cargo check --workspace --all
- name: Check formatting
run: cargo fmt --all -- --check
- name: Check stdlib .zen formatting
run: cargo run -p pcb -- fmt --check stdlib
- name: Run Clippy
run: cargo clippy --workspace -- -D warnings
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Type check Python with ty
run: uv sync && uvx ty check
test:
name: Test (${{ matrix.config.name }})
runs-on: ${{ matrix.config.runs-on }}
container: ${{ matrix.config.container }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
config:
- name: Windows
runs-on: diode-windows
- name: macOS
runs-on: macos-15-xlarge
- name: Ubuntu
runs-on: ubicloud-standard-30-ubuntu-2204
container:
image: ghcr.io/diodeinc/kicad:10.0.0 # Keep in sync with KICAD_VERSION
options: --user root
steps:
- uses: actions/checkout@v5
- name: Install Dependencies (Ubuntu)
if: matrix.config.name == 'Ubuntu'
run: |
apt-get update
apt-get install -y curl build-essential pkg-config libssl-dev
- name: Cache KiCad (macOS)
if: contains(matrix.config.name, 'macOS')
id: cache-kicad-mac
uses: actions/cache@v4
with:
path: /Applications/KiCad
key: ${{ runner.os }}-kicad-${{ env.KICAD_VERSION }}
- name: Install KiCad (macOS)
if: contains(matrix.config.name, 'macOS') && steps.cache-kicad-mac.outputs.cache-hit != 'true'
run: |
brew update
# Uninstall existing KiCad if present to avoid conflicts
brew uninstall --cask kicad 2>/dev/null || true
# Remove any remaining KiCad installation
rm -rf /Applications/KiCad 2>/dev/null || true
# Install KiCad fresh
brew install --cask kicad
- name: Install KiCad (Windows)
if: matrix.config.name == 'Windows'
shell: pwsh
run: |
$release = Invoke-RestMethod `
-Uri "https://api.github.com/repos/KiCad/kicad-source-mirror/releases/tags/${env:KICAD_VERSION}"
$asset = $release.assets |
Where-Object { $_.name -like "kicad-$env:KICAD_VERSION*-x86_64.exe" } |
Select-Object -First 1
if (-not $asset) {
throw "No KiCad Windows installer found for release tag $env:KICAD_VERSION"
}
$installer = Join-Path $env:RUNNER_TEMP $asset.name
Invoke-WebRequest -Uri $asset.browser_download_url -OutFile $installer
Start-Process -FilePath $installer -ArgumentList '/S', '/allusers' -Wait
- name: Install Rust (Windows)
if: runner.os == 'Windows'
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
rustflags: ""
toolchain: stable-x86_64-pc-windows-msvc
components: rustfmt, clippy
- name: Install Rust
if: runner.os != 'Windows'
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
components: rustfmt, clippy
- name: Install nextest
uses: taiki-e/install-action@nextest
- name: Test All (Workspace)
env:
RUST_LOG: debug
RUST_BACKTRACE: full
run: cargo nextest run --workspace --profile ci --locked
- name: Run doctests
env:
RUST_LOG: debug
RUST_BACKTRACE: full
run: cargo test --doc --workspace --locked
python-tests:
name: Python Tests
runs-on: ubicloud-standard-4
timeout-minutes: 10
defaults:
run:
working-directory: crates/pcb-layout/src/scripts
steps:
- uses: actions/checkout@v5
- uses: astral-sh/setup-uv@v5
- run: uv sync
working-directory: .
- run: uv run ruff check .
- run: uv run ruff format --check .
- run: uv run pytest lens/tests -v
check_readme:
name: Check README Sync
runs-on: ubicloud-standard-2
steps:
- uses: actions/checkout@v5
- name: Check README sync
run: bin/embed-readme --check README.md