Files
Akhil Velagapudi 22ea42fff5 Bump kicad to 9.0.5 (#225)
Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
2025-10-10 14:35:02 -04:00

147 lines
4.4 KiB
YAML

name: Build and Test
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
KICAD_VERSION: 9.0.5 # Update container image below when changing this
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build_and_test:
name: Build and 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: windows-large
- name: macOS
runs-on: macos-15-xlarge
- name: Ubuntu
runs-on: ubicloud-standard-30-ubuntu-2204
container:
image: ghcr.io/diodeinc/kicad:9.0.5-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: Cache KiCad (Windows)
if: matrix.config.name == 'Windows'
id: cache-kicad-windows
uses: actions/cache@v4
with:
path: C:\Program Files\KiCad
key: ${{ runner.os }}-kicad-${{ env.KICAD_VERSION }}
- 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: Build All (Workspace)
run: cargo build --verbose --workspace
- name: Check formatting
run: cargo fmt --all -- --check
- name: Run Clippy
run: cargo clippy --workspace -- -D warnings
- name: Test All (Workspace)
env:
RUST_LOG: debug
RUST_BACKTRACE: full
run: cargo test --verbose --workspace
- name: Run slow tests
env:
RUST_LOG: debug
RUST_BACKTRACE: full
run: cargo test --verbose -p pcb -- --ignored
- name: Build examples
run: cargo run -- build examples
- name: Test CLI (E2E)
env:
RUST_LOG: info,pcb::release=debug,pcb::bom=debug
run: |
# Test workspace with pcb.toml and workspace-relative loads
cargo run -- bom test-workspaces/with-pcb-toml/boards/WorkspaceTestBoard.zen
cargo run -- release -b WorkspaceTestBoard test-workspaces/with-pcb-toml
cargo run -- vendor test-workspaces/with-pcb-toml
cargo run -- build test-workspaces/with-pcb-toml/boards --offline
- name: Checkout stdlib
uses: actions/checkout@v5
with:
repository: diodeinc/stdlib
path: stdlib
- name: Test stdlib builds
shell: bash
run: |
# Save path to pcb binary
PCB_BIN="$(pwd)/target/debug/pcb"
# Find and build all .zen files
find stdlib -name "*.zen" -exec "$PCB_BIN" build {} +
echo "All stdlib files built successfully!"
check_readme:
name: Check README Sync
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Check README sync
run: bin/embed-readme --check README.md