Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
9d2aa90beThis file is pinned to the selected release. Download the original to open it in your design tool.
name: CI
on: [push, pull_request]
env:
CI_BRANCH_NAME: ${{ github.ref }}
# Specify build author as an environment variable because on Apple Silicon
# build_librepcb.sh is run locally where we want to use a different author.
LIBREPCB_BUILD_AUTHOR: "LibrePCB CI"
# Configure ccache.
CCACHE_MAXSIZE: 1G
# Incremental builds make no sense on CI -> disable it to avoid creating
# additional build artifacts.
CARGO_INCREMENTAL: 0
jobs:
windows-x64:
name: Windows x86_64
runs-on: windows-2025
env:
# Docker image tag: windowsservercore-ltsc2025-qt6.6-64bit-2
# Using digest for easier verification of the transparent build chain.
# https://github.com/LibrePCB/docker-librepcb-dev/actions/runs/16144496203/job/45559638212
IMAGE_DIGEST: d1ad2916b9cc865c22b6bba1471e8f784c89cb51c07e0f25dac9274db846572a
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Start Docker Container
run: >
docker run -d -t --name ci -w C:/work
-v ${{ github.workspace }}:C:/work
-e OS="windows"
-e ARCH="x86_64"
-e CI_BRANCH_NAME="${{ env.CI_BRANCH_NAME }}"
-e CCACHE_DIR="C:/work/build/.ccache-dir"
-e CCACHE_MAXSIZE="${{ env.CCACHE_MAXSIZE }}"
-e CARGO_HOME="C:/work/build/.cargo-home"
-e CARGO_INCREMENTAL="${{ env.CARGO_INCREMENTAL }}"
-e LIBREPCB_BUILD_AUTHOR="${{ env.LIBREPCB_BUILD_AUTHOR }}"
"ghcr.io/librepcb/docker-librepcb-dev@sha256:${{ env.IMAGE_DIGEST }}"
- name: Print Environment
run: docker exec ci bash ./ci/print_environment.sh
- name: Install Dependencies
run: >
docker exec
-e SLINT_UI_TESTING_AUTH="${{ secrets.SLINT_UI_TESTING_AUTH }}"
ci bash ./ci/install_dependencies.sh
# caching --->
- name: Cache .ccache
uses: actions/cache@v4
with:
key: ${{ github.job }}-${{ github.ref }}
restore-keys: ${{ github.job }}-refs/heads/master
path: build/.ccache-dir
- name: Cache .cargo
uses: actions/cache@v4
with:
key: ${{ github.job }}-${{ hashFiles('libs/librepcb/**/Cargo.lock') }}-${{ github.ref }}
restore-keys: ${{ github.job }}-${{ hashFiles('libs/librepcb/**/Cargo.lock') }}-refs/heads/master
path: |
./build/.cargo-home/bin/
./build/.cargo-home/registry/index/
./build/.cargo-home/registry/cache/
./build/.cargo-home/git/db/
./build/cargo/
./libs/librepcb/rust-core/target/
# <--- caching
- name: Print New Environment # Print again since it has been modified
run: docker exec ci bash ./ci/print_environment.sh
- name: Build LibrePCB
run: docker exec ci bash ./ci/build_librepcb.sh
- name: Build Archive
run: docker exec ci bash ./ci/build_windows_archive.sh
- name: Build Installer
run: docker exec ci bash ./ci/build_windows_installer.sh
- name: Run rust-core tests
run: docker exec -w C:/work/libs/librepcb/rust-core ci cargo test --features=fail-on-warnings
- name: Run LibrePCB Unittests
run: docker exec ci build\\tests\\unittests\\librepcb-unittests.exe
- name: Run LibrePCB-CLI Functional Tests
run: docker exec ci uv --directory ./tests/cli run --no-dev pytest -vvv --librepcb-executable="../../build/install/bin/librepcb-cli.exe"
- name: Run LibrePCB Functional Tests
run: docker exec ci uv --directory ./tests/funq run --no-dev pytest -vvv --librepcb-executable="../../build/install/bin/librepcb.exe" --reruns 5 --reruns-delay 10
- name: Run LibrePCB UI Tests
if: ${{ success() && env.SLINT_UI_TESTING_AUTH }}
run: docker exec ci uv --directory ./tests/ui run --no-dev pytest -vvv --librepcb-executable="../../build/install/bin/librepcb.exe"
env:
SLINT_UI_TESTING_AUTH: ${{ secrets.SLINT_UI_TESTING_AUTH }}
- name: Tar Artifacts
run: docker exec ci bash ./ci/tar_artifacts.sh
- name: Upload Artifacts
if: ${{ success() && (github.event_name == 'push') && env.UPLOAD_URL }}
run: >
docker exec
-e UPLOAD_URL="${{ secrets.UPLOAD_URL }}"
-e UPLOAD_USER="${{ secrets.UPLOAD_USER }}"
-e UPLOAD_PASS="${{ secrets.UPLOAD_PASS }}"
-e UPLOAD_SIGN_KEY="${{ secrets.UPLOAD_SIGN_KEY }}"
ci bash ./ci/upload_artifacts.sh
env:
UPLOAD_URL: ${{ secrets.UPLOAD_URL }} # Required to use it in 'if' condition
# Temporary upload action to investigate spurious CI failure.
- name: Upload sources after failure
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: sources-${{matrix.os}}
path: |
build/**/*.cpp
build/**/*.h
libs/slint/api/cpp/include
- name: Stop Container
if: ${{ always() }}
run: docker stop -t 30 ci
macos-arm64:
name: MacOS ARM64
# Make sure the 'runs-on' really refers to an Apple Silicon CPU:
# https://docs.github.com/en/actions/using-github-hosted-runners/using-github-hosted-runners/about-github-hosted-runners
runs-on: macos-14
env:
OS: 'mac'
ARCH: 'arm64'
COPYFILE_DISABLE: 1 # Stop creating shit files (https://superuser.com/questions/259703/get-mac-tar-to-stop-putting-filenames-in-tar-archives)
HOMEBREW_NO_INSTALL_CLEANUP: 1 # Might speed up homebrew commands(?)
CCACHE_DIR: '/Users/runner/ccache-dir'
CARGO_HOME: '/Users/runner/cargo-home'
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Print Environment
run: ./ci/print_environment.sh
- name: Install Dependencies
run: |
source ./ci/install_dependencies.sh
# Pass modified PATH to following steps:
echo "$PATH" > "$GITHUB_PATH"
env:
SLINT_UI_TESTING_AUTH: ${{ secrets.SLINT_UI_TESTING_AUTH }}
# caching --->
- name: Cache .ccache
uses: actions/cache@v4
with:
key: ${{ github.job }}-${{ github.ref }}
restore-keys: ${{ github.job }}-refs/heads/master
path: ${{ env.CCACHE_DIR }}
- name: Cache .cargo
uses: actions/cache@v4
with:
key: ${{ github.job }}-${{ hashFiles('libs/librepcb/**/Cargo.lock') }}-${{ github.ref }}
restore-keys: ${{ github.job }}-${{ hashFiles('libs/librepcb/**/Cargo.lock') }}-refs/heads/master
path: |
${{ env.CARGO_HOME }}/bin/
${{ env.CARGO_HOME }}/registry/index/
${{ env.CARGO_HOME }}/registry/cache/
${{ env.CARGO_HOME }}/git/db/
./build/cargo/
./libs/librepcb/rust-core/target/
# <--- caching
- name: Print New Environment
run: ./ci/print_environment.sh
- name: Build LibrePCB
run: ./ci/build_librepcb.sh
- name: Build Bundle
run: ./ci/build_mac_bundle.sh
- name: Run rust-core tests
run: cd libs/librepcb/rust-core && cargo test --features=fail-on-warnings
- name: Run LibrePCB Unittests
run: ./build/tests/unittests/librepcb-unittests
- name: Run LibrePCB-CLI Functional Tests
run: uv --directory ./tests/cli run --no-dev pytest -vvv --librepcb-executable="../../build/install/LibrePCB.app/Contents/MacOS/librepcb-cli"
# Note: Functional tests need to be run with the non-bundled app,
# otherwise we get errors due to multiple definitions of Qt symbols.
- name: Run LibrePCB Functional Tests
run: uv --directory ./tests/funq run --no-dev pytest -vvv --librepcb-executable="../../build/install/bin/librepcb.app/Contents/MacOS/librepcb" --reruns 5 --reruns-delay 10
- name: Run LibrePCB UI Tests
if: ${{ success() && env.SLINT_UI_TESTING_AUTH }}
run: uv --directory ./tests/ui run --no-dev pytest -vvv --librepcb-executable="../../build/install/bin/librepcb.app/Contents/MacOS/librepcb"
env:
SLINT_UI_TESTING_AUTH: ${{ secrets.SLINT_UI_TESTING_AUTH }}
- name: Tar & Upload Artifacts
if: ${{ success() && (github.event_name == 'push') && env.UPLOAD_URL }}
run: |
./ci/tar_artifacts.sh
./ci/upload_artifacts.sh
env:
UPLOAD_URL: ${{ secrets.UPLOAD_URL }}
UPLOAD_USER: ${{ secrets.UPLOAD_USER }}
UPLOAD_PASS: ${{ secrets.UPLOAD_PASS }}
UPLOAD_SIGN_KEY: ${{ secrets.UPLOAD_SIGN_KEY }}
# Temporary upload action to investigate spurious CI failure.
- name: Upload sources after failure
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: sources-${{matrix.os}}
path: |
build/**/*.cpp
build/**/*.h
libs/slint/api/cpp/include