Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
name: CI
# Variables
env:
IP_ROOT: ./test/designs/.ip-root
# Events that trigger workflow
on:
# Runs on all pushes to branches
push:
branches:
- "main"
- "dev"
- "version-*"
- "stable"
tags-ignore:
- "**"
# Runs on all PRs
pull_request:
# Runs every day at midnight UTC
schedule:
- cron: "0 0 * * *"
# Manual Dispatch
workflow_dispatch:
concurrency:
# Behavior:
# - Group all pull requests: latest push cancels previous ones
# - Group all branches:
# - If main/version- branches: run serially
# - Else, latest push cancels previous ones
group: >
${{
(github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number)) ||
(github.event_name == 'push' && format('branch-{0}', github.ref_name)) ||
''
}}
cancel-in-progress: ${{ github.event_name == 'pull_request' || !(startsWith(github.ref_name, 'version-') || github.ref_name == 'main' || github.ref_name == 'dev') }}
jobs:
prepare:
name: Prepare Variables
runs-on: ubuntu-24.04
outputs:
new_version: ${{ steps.version.outputs.new_version }}
design_matrix: ${{ steps.set-matrix.outputs.design_matrix }}
sky130_hash: ${{ steps.set-rev.outputs.sky130_hash }}
gf180mcu_hash: ${{ steps.set-rev.outputs.gf180mcu_hash }}
ihp-sg13g2_hash: ${{ steps.set-rev.outputs.ihp-sg13g2_hash }}
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Check for new version
id: version
if: ${{ github.event_name == 'push' && (
github.ref_name == 'main' ||
github.ref_name == 'dev' ||
startsWith(github.ref_name, 'version-')
) }}
run: |
VERSION="$(perl -ne 'print $1 if /^version\s*=\s*\"(.+?)\"/' pyproject.toml)"
if ! gh release view $VERSION 2>&1 > /dev/null; then
echo "Uploading new version $VERSION if CI passes."
echo "new_version=$VERSION" >> $GITHUB_OUTPUT
fi
env:
GH_TOKEN: ${{ github.token }}
- name: Python Dependencies
run: |
pip3 install poetry poetry-plugin-export
poetry export --all-groups --without-hashes --format=requirements.txt --output=requirements_tmp.txt
pip3 install -r requirements_tmp.txt
- name: Determine If Running Extended Test Set
run: |
python3 ./.github/scripts/determine_test_set.py ${{ github.event_name }}
- name: Set Matrix
id: set-matrix
run: |
python3 ./.github/test_sets/get_test_matrix.py --scl sky130A/sky130_fd_sc_hd --scl sky130A/sky130_fd_sc_hdll --scl sky130A/sky130_fd_sc_ls --scl sky130A/sky130_fd_sc_ms --scl gf180mcuD/gf180mcu_fd_sc_mcu7t5v0 --scl gf180mcuD/gf180mcu_fd_sc_mcu9t5v0 --scl gf180mcuD/gf180mcu_as_sc_mcu7t3v3 --scl ihp-sg13g2/sg13g2_stdcell $TEST_SETS
echo "design_matrix=$(python3 ./.github/test_sets/get_test_matrix.py --scl sky130A/sky130_fd_sc_hd --scl sky130A/sky130_fd_sc_hdll --scl sky130A/sky130_fd_sc_ls --scl sky130A/sky130_fd_sc_ms --scl gf180mcuD/gf180mcu_fd_sc_mcu7t5v0 --scl gf180mcuD/gf180mcu_fd_sc_mcu9t5v0 --scl gf180mcuD/gf180mcu_as_sc_mcu7t3v3 --scl ihp-sg13g2/sg13g2_stdcell $TEST_SETS)" >> $GITHUB_OUTPUT
- name: Get Open PDKs Revision
id: set-rev
run: |
echo "sky130_hash=$(python3 ./.github/scripts/get_pdk_hash.py ./librelane/pdk_hashes.yaml --pdk-family sky130)" >> $GITHUB_OUTPUT
echo "gf180mcu_hash=$(python3 ./.github/scripts/get_pdk_hash.py ./librelane/pdk_hashes.yaml --pdk-family gf180mcu)" >> $GITHUB_OUTPUT
echo "ihp-sg13g2_hash=$(python3 ./.github/scripts/get_pdk_hash.py ./librelane/pdk_hashes.yaml --pdk-family ihp-sg13g2)" >> $GITHUB_OUTPUT
- name: Cache sky130 PDK
uses: actions/cache@v6
with:
path: ./.ciel-sky130
key: cache-sky130-pdk-${{ steps.set-rev.outputs.sky130_hash }}
enableCrossOsArchive: true
- name: Enable sky130 PDK
run: |
ciel enable --github-token ${{ secrets.GITHUB_TOKEN }} --pdk sky130 --pdk-root ./.ciel-sky130 ${{ steps.set-rev.outputs.sky130_hash }}
find ./.ciel-sky130 -maxdepth 4
- name: Cache gf180mcu PDK
uses: actions/cache@v6
with:
path: ./.ciel-gf180mcu
key: cache-gf180mcu-pdk-${{ steps.set-rev.outputs.gf180mcu_hash }}
enableCrossOsArchive: true
- name: Enable gf180mcu PDK
run: |
ciel enable --github-token ${{ secrets.GITHUB_TOKEN }} --pdk gf180mcu --pdk-root ./.ciel-gf180mcu ${{ steps.set-rev.outputs.gf180mcu_hash }} --include-libraries all
find ./.ciel-gf180mcu -maxdepth 4
- name: Cache ihp-sg13g2 PDK
uses: actions/cache@v6
with:
path: ./.ciel-ihp-sg13g2
key: cache-ihp-sg13g2-pdk-${{ steps.set-rev.outputs.ihp-sg13g2_hash }}
enableCrossOsArchive: true
- name: Enable ihp-sg13g2 PDK
run: |
ciel enable --github-token ${{ secrets.GITHUB_TOKEN }} --pdk ihp-sg13g2 --pdk-root ./.ciel-ihp-sg13g2 ${{ steps.set-rev.outputs.ihp-sg13g2_hash }}
find ./.ciel-ihp-sg13g2 -maxdepth 4
lint:
name: Lint
runs-on: ubuntu-24.04
steps:
- name: Check out repo
uses: actions/checkout@v7
- name: Set Up Python
uses: actions/setup-python@v6
with:
python-version: "3.10"
- name: Install Linters
run: make venv
- name: Lint
run: |
PATH=$PWD/venv/bin:$PATH make lint
build-py:
runs-on: ubuntu-24.04
needs: [lint, prepare]
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"] # , "3.14"] # lxml, klayout still not built
fail-fast: false
name: Build and Unit Test (Python ${{ matrix.python-version }})
steps:
- name: Check out repo
uses: actions/checkout@v7
- name: Set Up Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Run Unit Tests
run: |
make venv
./venv/bin/coverage run -m pytest -n auto
./venv/bin/coverage report
./venv/bin/coverage html
build-linux-x86_64:
needs: [lint, prepare]
runs-on: ubuntu-24.04
outputs:
devshell_bin: ${{ steps.set-devshell-bin.outputs.devshell_bin }}
name: Build (Nix/x86_64-linux)
steps:
- uses: actions/checkout@v7
- name: Initialize Step Unit Test Submodule
run: |
git submodule update --init test/steps/all
- name: Set up GITHUB_TOKEN
run: |
echo "GITHUB_TOKEN=${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
- name: Cache x86-64 Nix Store
uses: actions/cache@v6
with:
path: /nix/store
key: nix-store-x86_64-linux-${{ github.run_id }}
- uses: ./.github/actions/setup_nix
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
nix_cache_domain: ${{ vars.NIX_CACHE }}
nix_public_key: ${{ vars.NIX_PUBLIC_KEY }}
- name: Cache sky130 PDK
uses: actions/cache@v6
with:
path: ./.ciel-sky130
key: cache-sky130-pdk-${{ needs.prepare.outputs.sky130_hash }}
enableCrossOsArchive: true
- name: Build with Nix
uses: ./.github/actions/build_nix
with:
nix_system: x86_64-linux
run_tests: "true"
pdk_root: ./.ciel-sky130
- name: Cache to S3
uses: fossi-foundation/nix-eda/.github/actions/nix_sign_cache_s3@main
with:
flake_outputs: .#packages.x86_64-linux.librelane
nix_public_key: ${{ vars.NIX_PUBLIC_KEY }}
nix_private_key: ${{ secrets.NIX_PRIVATE_KEY }}
s3_bucket_name: ${{ vars.NIX_CACHE }}
aws_region: ${{ secrets.AWS_REGION }}
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Write Devshell as Output
id: set-devshell-bin
run: |
DEVSHELL_STORE_PATH=$(nix build .#devShells.x86_64-linux.dev --no-link --print-out-paths)
echo "devshell_bin=$DEVSHELL_STORE_PATH/bin/devshell" >> $GITHUB_OUTPUT
build-linux-aarch64:
needs: [lint, prepare]
runs-on: ubuntu-24.04-arm
name: Build (Nix/aarch64-linux)
steps:
- uses: actions/checkout@v7
- name: Initialize Step Unit Test Submodule
run: |
git submodule update --init test/steps/all
- name: Set up GITHUB_TOKEN
run: |
echo "GITHUB_TOKEN=${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
- uses: ./.github/actions/setup_nix
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
nix_cache_domain: ${{ vars.NIX_CACHE }}
nix_public_key: ${{ vars.NIX_PUBLIC_KEY }}
- name: Cache sky130 PDK
uses: actions/cache@v6
with:
path: ./.ciel-sky130
key: cache-sky130-pdk-${{ needs.prepare.outputs.sky130_hash }}
- name: Build with Nix
uses: ./.github/actions/build_nix
with:
nix_system: aarch64-linux
run_tests: "true"
pdk_root: ./.ciel-sky130
- name: Cache to S3
uses: fossi-foundation/nix-eda/.github/actions/nix_sign_cache_s3@main
with:
flake_outputs: .#packages.aarch64-linux.librelane
nix_public_key: ${{ vars.NIX_PUBLIC_KEY }}
nix_private_key: ${{ secrets.NIX_PRIVATE_KEY }}
s3_bucket_name: ${{ vars.NIX_CACHE }}
aws_region: ${{ secrets.AWS_REGION }}
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
build-darwin:
strategy:
matrix:
os:
[
{
name: "macOS 15 (Intel)",
family: "darwin",
runner: "macos-15",
arch: "x86_64",
nix: "x86_64-darwin",
},
{
name: "macOS 15",
family: "darwin",
runner: "macos-15",
arch: "aarch64",
nix: "aarch64-darwin",
},
]
fail-fast: false
needs: [lint, prepare]
runs-on: ${{ matrix.os.runner }}
name: Build (Nix/${{ matrix.os.nix }})
steps:
- uses: actions/checkout@v7
- name: Initialize Step Unit Test Submodule
run: |
git submodule update --init test/steps/all
- name: Set up GITHUB_TOKEN
run: |
echo "GITHUB_TOKEN=${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
- uses: ./.github/actions/setup_nix
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
nix_cache_domain: ${{ vars.NIX_CACHE }}
nix_public_key: ${{ vars.NIX_PUBLIC_KEY }}
- name: Cache sky130 PDK
uses: actions/cache@v6
with:
path: ./.ciel-sky130
key: cache-sky130-pdk-${{ needs.prepare.outputs.sky130_hash }}
- name: Build with Nix
uses: ./.github/actions/build_nix
with:
nix_system: ${{ matrix.os.nix }}
shell: "zsh {0}"
run_tests: "true"
pdk_root: ./.ciel-sky130
- name: Cache to S3
uses: fossi-foundation/nix-eda/.github/actions/nix_sign_cache_s3@main
with:
flake_outputs: .#packages.${{ matrix.os.nix }}.librelane
nix_public_key: ${{ vars.NIX_PUBLIC_KEY }}
nix_private_key: ${{ secrets.NIX_PRIVATE_KEY }}
s3_bucket_name: ${{ vars.NIX_CACHE }}
aws_region: ${{ secrets.AWS_REGION }}
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
build-appimages:
strategy:
matrix:
os:
# 24.04 has more "security" i.e. cannot write uid_map: Operation not permitted
# Ubuntu was a mistake
[
{
name: "Ubuntu 22.04",
family: "linux",
runner: "ubuntu-22.04",
arch: "x86_64",
nix: "x86_64-linux",
},
{
name: "Ubuntu 22.04",
family: "linux",
runner: "ubuntu-22.04-arm",
arch: "aarch64",
nix: "aarch64-linux",
},
]
runs-on: ${{ matrix.os.runner }}
needs: [build-linux-x86_64, build-linux-aarch64]
name: Build AppImage (${{ matrix.os.arch }})
steps:
- name: Maximize build space
uses: AdityaGarg8/remove-unwanted-software@v5
with:
remove-dotnet: "true"
remove-android: "true"
remove-haskell: "true"
remove-codeql: "true"
remove-docker-images: "true"
- name: Check out repo
uses: actions/checkout@v7
- name: Install Lix
run: |
curl --proto '=https' --tlsv1.2 -sSf -L https://install.lix.systems/lix | sh -s -- install --no-confirm --extra-conf "
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
experimental-features = nix-command flakes
"
echo "extra-substituters = https://nix-cache.fossi-foundation.org" | sudo tee -a /etc/nix/nix.conf
echo "extra-trusted-public-keys = nix-cache.fossi-foundation.org:3+K59iFwXqKsL7BNu6Guy0v+uTlwsxYQxjspXzqLYQs=" | sudo tee -a /etc/nix/nix.conf
- name: Build with Nix
id: nix_build_action
uses: ./.github/actions/build_nix
with:
nix_system: ${{ matrix.os.nix }}
- name: Build AppImage
run: |
IMAGE_PATH="$PWD/librelane-devshell-${{ matrix.os.arch }}.AppImage"
nix bundle\
--out-link $IMAGE_PATH\
--bundler github:ralismark/nix-appimage\
.#devShells.${{ matrix.os.nix }}.default
echo "IMAGE_PATH=$IMAGE_PATH" >> $GITHUB_ENV
- name: Smoke-Test AppImage
run: |
$IMAGE_PATH librelane --smoke-test
- name: Upload AppImage Artifact
uses: actions/upload-artifact@v7
with:
name: appimage-${{ matrix.os.arch }}
path: ${{ env.IMAGE_PATH }}
build-docker:
strategy:
matrix:
os:
[
{
name: "Ubuntu 24.04",
family: "linux",
runner: "ubuntu-24.04",
arch: "x86_64",
nix: "x86_64-linux",
},
{
name: "Ubuntu 24.04",
family: "linux",
runner: "ubuntu-24.04-arm",
arch: "aarch64",
nix: "aarch64-linux",
},
]
runs-on: ${{ matrix.os.runner }}
needs: [build-linux-x86_64, build-linux-aarch64]
name: Build Docker Image (${{ matrix.os.arch }})
steps:
- name: Maximize build space
uses: AdityaGarg8/remove-unwanted-software@v5
with:
remove-dotnet: "true"
remove-android: "true"
remove-haskell: "true"
remove-codeql: "true"
remove-docker-images: "true"
- name: Check out repo
uses: actions/checkout@v7
- name: Install Lix # CppNix crashes on Docker build
run: |
curl --proto '=https' --tlsv1.2 -sSf -L https://install.lix.systems/lix | sh -s -- install --no-confirm --extra-conf "
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
experimental-features = nix-command flakes
"
echo "extra-substituters = https://nix-cache.fossi-foundation.org" | sudo tee -a /etc/nix/nix.conf
echo "extra-trusted-public-keys = nix-cache.fossi-foundation.org:3+K59iFwXqKsL7BNu6Guy0v+uTlwsxYQxjspXzqLYQs=" | sudo tee -a /etc/nix/nix.conf
- name: Build with Nix
id: nix_build_action
uses: ./.github/actions/build_nix
with:
nix_system: ${{ matrix.os.nix }}
- name: Build Docker Image
run: |
IMAGE_PATH=$(nix build\
--print-out-paths\
--no-link\
--accept-flake-config\
--option system ${{ matrix.os.nix }}\
--extra-platforms ${{ matrix.os.nix }}\
.#packages.${{ matrix.os.nix }}.librelane-docker)
echo "IMAGE_PATH=$IMAGE_PATH" >> $GITHUB_ENV
cat $IMAGE_PATH | docker load
- name: Upload Docker Artifact
uses: actions/upload-artifact@v7
with:
name: docker-image-${{ matrix.os.arch }}
path: ${{ env.IMAGE_PATH }}
test-containers:
strategy:
matrix:
runner: [ubuntu-24.04, ubuntu-26.04]
engine: [podman, docker]
fail-fast: false
runs-on: ${{ matrix.runner }}
needs: [build-docker]
name: Test Containers (${{ matrix.runner }}/${{ matrix.engine }})
steps:
- name: Maximize build space
uses: AdityaGarg8/remove-unwanted-software@v5
with:
remove-dotnet: "true"
remove-android: "true"
remove-haskell: "true"
remove-codeql: "true"
remove-docker-images: "true"
- name: Check out repo
uses: actions/checkout@v7
- name: Set Up Python
uses: actions/setup-python@v6
with:
python-version: "3.10"
- if: ${{ matrix.engine == 'docker' }}
name: Set up Docker (If applicable)
run: |
# Docker already installed
echo "LIBRELANE_CONTAINER_ENGINE=docker" >> $GITHUB_ENV
echo "lln_no_tty=--docker-no-tty" >> $GITHUB_ENV
echo "lln_containerized=--dockerized" >> $GITHUB_ENV
- if: ${{ matrix.engine == 'podman' }}
name: Set up Podman (If applicable)
run: |
sudo apt-get install -y podman
echo "LIBRELANE_CONTAINER_ENGINE=podman" >> $GITHUB_ENV
echo "lln_no_tty=--container-no-tty" >> $GITHUB_ENV
echo "lln_containerized=--containerized" >> $GITHUB_ENV
- name: Download Image (Docker/x86_64)
uses: actions/download-artifact@v8
with:
name: docker-image-x86_64
path: /tmp/docker
- name: Load Images (Docker)
run: |
for file in /tmp/docker/*; do
cat $file | $LIBRELANE_CONTAINER_ENGINE load
done
# Do not cache the PDK. We would like to test the typical Docker flow here.
- name: Smoke-Test Container Image
run: |
make venv
mkdir -p $HOME/.ciel
chmod -R 755 $HOME/.ciel
export LIBRELANE_IMAGE_OVERRIDE=librelane:tmp-x86_64-linux
./venv/bin/python3 -m librelane\
$lln_no_tty\
$lln_containerized\
--smoke-test
test:
runs-on: ubuntu-24.04
needs: [build-linux-x86_64, prepare]
name: Test Design ${{ matrix.design.test_name }} (${{ matrix.design.pdk }}/${{matrix.design.scl}})
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.prepare.outputs.design_matrix) }}
steps:
- name: Maximize build space
uses: AdityaGarg8/remove-unwanted-software@v5
with:
remove-dotnet: "true"
remove-android: "true"
remove-haskell: "true"
remove-codeql: "true"
remove-docker-images: "true"
- uses: actions/checkout@v7
with:
submodules: recursive
- name: Prepare the Nix Store
run: |
sudo mkdir -p /nix
sudo chown -R $(id -u):$(id -g) /nix
- name: Restore Nix Store
id: restore-nix-store
uses: actions/cache@v6
with:
path: /nix/store
key: nix-store-x86_64-linux-${{ github.run_id }}
- if: steps.restore-nix-store.outputs.cache-hit != 'true'
run: |
sudo rm -rf /nix
- if: steps.restore-nix-store.outputs.cache-hit != 'true'
uses: ./.github/actions/setup_nix
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
nix_cache_domain: ${{ vars.NIX_CACHE }}
nix_public_key: ${{ vars.NIX_PUBLIC_KEY }}
- if: steps.restore-nix-store.outputs.cache-hit != 'true'
name: Build with Nix
uses: ./.github/actions/build_nix
with:
nix_system: x86_64-linux
- if: steps.restore-nix-store.outputs.cache-hit != 'true'
name: Avail the Devshell
run: |
nix build .#devShells.x86_64-linux.dev --no-link --print-out-paths
- name: Get PDK hash
run: |
echo "PDK_HASH=$(python3 ./.github/scripts/get_pdk_hash.py ./librelane/pdk_hashes.yaml --pdk-family ${{ matrix.design.pdk_family }})" >> $GITHUB_ENV
- name: Cache PDK
id: cache-pdk
uses: actions/cache@v6
with:
path: ./.ciel-${{ matrix.design.pdk_family }}
key: cache-${{ matrix.design.pdk_family }}-pdk-${{ env.PDK_HASH }}
enableCrossOsArchive: true
- name: Enable PDKs
if: steps.cache-pdk.outputs.cache-hit != 'true'
run: |
pipx run ciel==$(perl -ne 'print /version\s*=\s*"([\d\.]+)"/ if $c; $c = /name\s*=\s*"ciel"/' ./poetry.lock )\
-- enable --pdk ${{ matrix.design.pdk_family }} \
--pdk-root ./.ciel-${{ matrix.design.pdk_family }} \
${{ env.PDK_HASH }}
- name: Run Test
id: test_run
continue-on-error: true
env:
DEVSHELL_BIN: ${{ needs.build-linux-x86_64.outputs.devshell_bin }}
run: |
if test ${{ matrix.design.script }} = "None"
then
$DEVSHELL_BIN -- \
python3 -m librelane\
--run-tag ${{ matrix.design.pdk }}-${{ matrix.design.scl }}\
--pdk ${{ matrix.design.pdk }}\
--scl ${{ matrix.design.scl }}\
--pdk-root ./.ciel-${{ matrix.design.pdk_family }}\
--condensed\
${{ matrix.design.config }}
else
export PYTHONPATH="$PWD"
$DEVSHELL_BIN -- \
python3 ${{ matrix.design.script }}\
--run-tag ${{ matrix.design.pdk }}-${{ matrix.design.scl }}\
--pdk ${{ matrix.design.pdk }}\
--scl ${{ matrix.design.scl }}\
--pdk-root ./.ciel-${{ matrix.design.pdk_family }}\
--condensed
fi
- name: Upload Run Folder
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.design.test_name }}-${{ matrix.design.pdk }}-${{ matrix.design.scl }}
path: ${{ matrix.design.run_dir }}
- name: Fetch Metrics
env:
DEVSHELL_BIN: ${{ needs.build-linux-x86_64.outputs.devshell_bin }}
run: |
$DEVSHELL_BIN -- python3 -m librelane.state latest\
${{ matrix.design.run_dir }}\
--extract-metrics-to ${{ matrix.design.pdk }}-${{ matrix.design.scl }}-${{ matrix.design.test_name }}.metrics.json
- name: Upload Metrics
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.design.pdk }}-${{ matrix.design.scl }}-${{ matrix.design.test_name }}.metrics.json
path: ${{ matrix.design.pdk }}-${{ matrix.design.scl }}-${{ matrix.design.test_name }}.metrics.json
- name: Propagate test failure after uploading metrics
if: steps.test_run.outcome == 'failure'
run: exit -1
smoke:
runs-on: ubuntu-24.04
needs: [build-linux-x86_64, build-linux-aarch64]
name: Smoke Test on ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [x86_64-linux, aarch64-linux]
steps:
- name: Maximize build space
uses: AdityaGarg8/remove-unwanted-software@v5
with:
remove-dotnet: "true"
remove-android: "true"
remove-haskell: "true"
remove-codeql: "true"
remove-docker-images: "true"
- uses: actions/checkout@v7
with:
submodules: recursive
- name: Check if Git
run: |
git status || true
tree .git || true
- uses: ./.github/actions/setup_nix
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
nix_cache_domain: ${{ vars.NIX_CACHE }}
nix_public_key: ${{ vars.NIX_PUBLIC_KEY }}
- name: Build with Nix
uses: ./.github/actions/build_nix
with:
nix_system: x86_64-linux
- name: Check Nix
run: |
sudo du -hs /nix/store/* | sort -h | tail -n 10
sudo tree /nix/store/*-librelane || true
- name: Smoke (sky130)
run: |
nix run . -- \
--pdk sky130A \
--smoke-test
- name: Smoke (ihp-sg13g2)
run: |
nix run . -- \
--pdk ihp-sg13g2 \
--smoke-test
- name: Smoke (gf180mcu)
run: |
nix run . -- \
--pdk gf180mcuD \
--smoke-test
merge_metrics:
name: Merge Metrics
runs-on: ubuntu-24.04
needs: test
if: always()
steps:
- id: metric_merge
name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
with:
name: metrics
pattern: "*.metrics.json"
upload_metrics:
name: Cache Metrics to Repo
runs-on: ubuntu-24.04
needs: [test, merge_metrics]
# if there isn't at least one metric this exercise is pointless
if: needs.merge_metrics.result == 'success' && github.event_name == 'push' && vars.METRICS_REPO
steps:
- name: Download Metrics
uses: actions/download-artifact@v8
with:
name: metrics
path: current
- name: "Upload Metrics"
env:
GH_USER: '${{ vars.BOT_USERNAME }}'
GH_TOKEN: '${{ secrets.BOT_GITHUB_TOKEN }}'
BOT_NAME: '${{ vars.BOT_NAME }}'
BOT_EMAIL: '${{ vars.BOT_EMAIL }}'
REPO: '${{ vars.METRICS_REPO }}'
run: |
if [ "$GH_TOKEN" == "" ]; then
exit 0
fi
BRANCH_NAME="commit-${{ github.sha }}"
echo "Uploading to 'github.com/$REPO@$BRANCH_NAME'…"
cd current
git init -b $BRANCH_NAME
git add .
git config user.name "$BOT_NAME"
git config user.email "$BOT_EMAIL"
git commit -m "Upload"
git remote add origin "https://$GH_USER:$GH_TOKEN@github.com/$REPO.git"
git push -fu origin $BRANCH_NAME # Force for if we have to re-run the CI for some reason
publish:
runs-on: ubuntu-24.04
needs: [prepare, test-containers, build-py, build-appimages]
if: ${{ needs.prepare.outputs.new_version != '' }}
environment: pypi
permissions:
# Enable Trusted Publishing
id-token: write
# Enable Tagging & Releasing
contents: write
# Enable Uploading Containers
# ref: https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#upgrading-a-workflow-that-accesses-a-registry-using-a-personal-access-token
packages: write
name: Publish
steps:
- name: Maximize build space
uses: AdityaGarg8/remove-unwanted-software@v5
with:
remove-dotnet: "true"
remove-android: "true"
remove-haskell: "true"
remove-codeql: "true"
remove-docker-images: "true"
- name: Check out repo
uses: actions/checkout@v7
- name: Set Up Python
uses: actions/setup-python@v7
with:
python-version: "3.10"
- name: Build Distribution
run: |
make dist
- name: Log in to GHCR
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
# Splitting load to help with disk space issue
- name: Download Container Image (x86_64)
uses: actions/download-artifact@v8
with:
name: docker-image-x86_64
path: /tmp/docker
- name: Load Container Image (x86_64)
run: |
for file in /tmp/docker/*; do
cat $file | docker load
rm $file
done
- name: Download Container Image (aarch64)
uses: actions/download-artifact@v8
with:
name: docker-image-aarch64
path: /tmp/docker
- name: Load Container Image (aarch64)
run: |
for file in /tmp/docker/*; do
cat $file | docker load
rm $file
done
- name: Push Container Images and Multi-Arch Manifest to GHCR
run: |
version="${{ needs.prepare.outputs.new_version }}"
docker tag librelane:tmp-x86_64-linux ghcr.io/${{ github.repository }}:$version-x86_64
docker push ghcr.io/${{ github.repository }}:$version-x86_64
docker tag librelane:tmp-aarch64-linux ghcr.io/${{ github.repository }}:$version-aarch64
docker push ghcr.io/${{ github.repository }}:$version-aarch64
docker manifest create\
ghcr.io/${{ github.repository }}:$version\
ghcr.io/${{ github.repository }}:$version-x86_64\
ghcr.io/${{ github.repository }}:$version-aarch64
docker manifest push ghcr.io/${{ github.repository }}:$version
yes | docker system prune -a --volumes
- name: Download AppImage (x86_64)
uses: actions/download-artifact@v8
with:
name: appimage-x86_64
path: /tmp/appimage
- name: Download AppImage (aarch64)
uses: actions/download-artifact@v8
with:
name: appimage-aarch64
path: /tmp/appimage
# 2nd to last because it is immutable but likely to fail, so if it fails
# I don't want PyPI publishing
- name: Create release
run: |
prerelease_arg=()
version="${{ needs.prepare.outputs.new_version }}"
if [[ "$version" = *b* ]] || [[ "$version" = *a* ]] || [[ "$version" = *.dev* ]] || [[ "$version" = *rc* ]]; then
prerelease_arg+=( "--prerelease" )
fi
echo "Installation instructions: https://librelane.readthedocs.io/en/latest/installation/index.html" > ../release_notes.md
echo "Changelog: ${{ github.server_url }}/${{ github.repository }}/blob/$version/Changelog.md" >> ../release_notes.md
gh release create $version \
--generate-notes \
--notes-file ../release_notes.md \
--target "${{ github.ref_name }}" \
"${prerelease_arg[@]}" \
/tmp/appimage/*.AppImage
env:
GH_TOKEN: ${{ github.token }}
# last step because it is immutable and least likely to fail
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
f24e0ea5dThis file is pinned to the selected release. Download the original to open it in your design tool.