-
Notifications
You must be signed in to change notification settings - Fork 24
152 lines (128 loc) · 4.17 KB
/
test.yml
File metadata and controls
152 lines (128 loc) · 4.17 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
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: 9.0.7 # 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: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Cache Cargo
uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Check All
run: cargo check --workspace --all
- name: Check formatting
run: cargo fmt --all -- --check
- 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:9.0.7-trixie-full # 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' && steps.cache-kicad-windows.outputs.cache-hit != 'true'
run: |
choco install kicad --version ${{ env.KICAD_VERSION }} -y
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Cache Cargo
uses: Swatinem/rust-cache@v2
with:
# Only save cache from main branch to prevent cache proliferation
save-if: ${{ github.ref == 'refs/heads/main' }}
- 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