Files
diodeinc__pcb/.github/workflows/test.yml
Lenny Khazan 345494f55b Fix symbols with multiple pads per pin + component orientation on back-side components (#34)
* Fix symbols with multiple pads per pin

* remove unused

* update layout syncing

* update snap for kicad 9.0.3

* Fix orientation syncing for back components

* update to kicad 9.0.3 on windows

* more robust kicad version in CI
2025-07-18 14:37:05 -04:00

132 lines
3.8 KiB
YAML

name: Build and Test
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
KICAD_VERSION: 9.0.3 # 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 }}
strategy:
fail-fast: false
matrix:
config:
- name: Windows
runs-on: windows-latest
- name: macOS
runs-on: macos-latest
- name: macOS 14
runs-on: macos-14
- name: Ubuntu
runs-on: ubuntu-latest
container:
image: kicad/kicad:9.0.3 # Keep in sync with KICAD_VERSION
options: --user root
steps:
- uses: actions/checkout@v3
- 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: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt, clippy
- name: Cache Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- 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: Test stdlib builds
shell: bash
run: |
# Save current directory
ORIGINAL_DIR=$(pwd)
# Clone the stdlib repository
git clone https://github.com/diodeinc/stdlib.git /tmp/stdlib
# Find all .star and .zen files and build them
cd /tmp/stdlib
find . -name "*.star" -o -name "*.zen" | while read -r file; do
echo "Building $file..."
if ! (cd "$ORIGINAL_DIR" && cargo run -p pcb -- build "/tmp/stdlib/$file"); then
echo "Failed to build $file"
exit 1
fi
done
echo "All stdlib files built successfully!"