Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
59219ad85This file is pinned to the selected release. Download the original to open it in your design tool.
on:
workflow_call:
jobs:
linux:
name: ${{ matrix.name }}
runs-on: ubuntu-24.04
container: ${{ matrix.image }}
env:
OS: 'linux'
ARCH: 'x86_64'
CARGO_INCREMENTAL: 0 # Avoid creating additional build artifacts
CCACHE_MAXSIZE: '500MB'
CCACHE_DIR: ${{ github.workspace }}/.ccache
CARGO_HOME: ${{ github.workspace }}/.cargo
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
CMAKE_OPTIONS: ${{ matrix.cmake_options }}
LIBREPCB_BUILD_AUTHOR: "LibrePCB CI"
CI_BRANCH_NAME: ${{ github.ref }}
strategy:
fail-fast: false
matrix:
include:
- name: Ubuntu 22.04 Qt6.11 GCC
image: librepcb/librepcb-dev:ubuntu-22.04-qt6.11-1
deploy: true
- name: Ubuntu 24.04 Clang
image: librepcb/librepcb-dev:ubuntu-24.04-5
cc: clang
cxx: clang++
cmake_options: '-DCMAKE_CXX_FLAGS="-DQT_FORCE_ASSERTS=1"'
extend_ld_library_path: true
- name: Ubuntu 26.04 Unbundled
image: librepcb/librepcb-dev:ubuntu-26.04-1
cmake_options: '-DCMAKE_CXX_FLAGS="-DQT_FORCE_ASSERTS=1" -DUNBUNDLE_DXFLIB=1 -DUNBUNDLE_GTEST=1 -DUNBUNDLE_MUPARSER=1 -DUNBUNDLE_POLYCLIPPING=1'
unbundle: true
extend_ld_library_path: true
steps:
# Clone Repository
- uses: actions/checkout@v6
with:
submodules: recursive
# https://github.com/actions/checkout/issues/1048
- name: Fix Git Permissions
run: git config --global --add safe.directory $GITHUB_WORKSPACE
- name: Unbundle Libraries
run: |
rm -rv libs/dxflib
rm -rv libs/googletest
rm -rv libs/muparser
rm -rv libs/polyclipping
if: ${{ matrix.unbundle && (!cancelled()) }}
- name: Print Environment
run: ./ci/print_environment.sh
# Restore Caches
- id: restore_ccache
name: Restore .ccache
uses: actions/cache/restore@v5
with:
key: ccache-${{ matrix.image }}-${{ github.ref }}-${{ github.run_id }}
restore-keys: |
ccache-${{ matrix.image }}-${{ github.ref }}
ccache-${{ matrix.image }}-refs/heads/master
ccache-${{ matrix.image }}
path: ${{ env.CCACHE_DIR }}
- id: restore_cargo
name: Restore .cargo
uses: actions/cache/restore@v5
with:
key: cargo-${{ matrix.image }}-${{ hashFiles('libs/librepcb/**/Cargo.lock') }}-${{ github.ref }}-${{ github.run_id }}
restore-keys: |
cargo-${{ matrix.image }}-${{ hashFiles('libs/librepcb/**/Cargo.lock') }}-${{ github.ref }}
cargo-${{ matrix.image }}-${{ hashFiles('libs/librepcb/**/Cargo.lock') }}-refs/heads/master
cargo-${{ matrix.image }}-${{ hashFiles('libs/librepcb/**/Cargo.lock') }}
cargo-${{ matrix.image }}
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/
# Install Dependencies
- name: Install Python Packages
run: ./ci/install_python_packages.sh
env:
UV_INDEX_SLINT_PRIVATE_USERNAME: ${{ secrets.UV_INDEX_SLINT_PRIVATE_USERNAME }}
UV_INDEX_SLINT_PRIVATE_PASSWORD: ${{ secrets.UV_INDEX_SLINT_PRIVATE_PASSWORD }}
- name: Extend LD_LIBRARY_PATH
run: echo "LD_LIBRARY_PATH=${{ github.workspace }}/build/install/lib:${{ env.LD_LIBRARY_PATH }}" >> $GITHUB_ENV
if: ${{ matrix.extend_ld_library_path && (!cancelled()) }}
- name: Print New Environment
run: ./ci/print_environment.sh
# Build
- id: build
name: Build LibrePCB
run: ./ci/build_librepcb.sh
- name: Build Portable Packages
run: ./ci/build_linux_portables.sh
if: ${{ (steps.build.outcome == 'success') && matrix.deploy && (!cancelled()) }}
# Test
- name: Run rust-core Tests (With Coverage)
run: >
cd libs/librepcb/rust-core &&
cargo llvm-cov --features=fail-on-warnings --html &&
cargo llvm-cov report
--fail-uncovered-lines 0
--fail-uncovered-regions 0
--fail-uncovered-functions 0
--show-missing-lines
if: ${{ (steps.build.outcome == 'success') && (!cancelled()) }}
- name: Run LibrePCB Unittests
run: xvfb-run -a ./build/tests/unittests/librepcb-unittests
if: ${{ (steps.build.outcome == 'success') && (!cancelled()) }}
- name: Run LibrePCB-CLI Functional Tests
run: uv --directory ./tests/cli run --no-dev pytest -vvv --librepcb-executable="../../build/install/bin/librepcb-cli"
if: ${{ (steps.build.outcome == 'success') && (!cancelled()) }}
- name: Run LibrePCB Functional Tests
run: xvfb-run -a --server-args="-screen 0 1024x768x24" uv --directory ./tests/funq run --no-dev pytest -vvv --librepcb-executable="../../build/install/bin/librepcb" --reruns 5 --reruns-delay 10
if: ${{ (steps.build.outcome == 'success') && (!cancelled()) }}
- name: Run LibrePCB UI Tests
run: xvfb-run -a --server-args="-screen 0 1600x1200x24" uv --directory "./tests/ui" run --no-dev pytest -vvv --librepcb-executable="../../build/install/bin/librepcb"
if: ${{ (steps.build.outcome == 'success') && (!cancelled()) && env.UV_INDEX_SLINT_PRIVATE_PASSWORD }}
env:
UV_INDEX_SLINT_PRIVATE_USERNAME: ${{ secrets.UV_INDEX_SLINT_PRIVATE_USERNAME }}
UV_INDEX_SLINT_PRIVATE_PASSWORD: ${{ secrets.UV_INDEX_SLINT_PRIVATE_PASSWORD }}
# Upload Artifacts
- name: Tar & Upload Artifacts
run: |
./ci/tar_artifacts.sh
./ci/upload_artifacts.sh
if: ${{ (steps.build.outcome == 'success') && matrix.deploy && (!cancelled()) && (github.event_name == 'push') && env.UPLOAD_URL }}
env:
UPLOAD_URL: ${{ secrets.UPLOAD_URL }}
UPLOAD_USER: ${{ secrets.UPLOAD_USER }}
UPLOAD_PASS: ${{ secrets.UPLOAD_PASS }}
UPLOAD_SIGN_KEY: ${{ secrets.UPLOAD_SIGN_KEY }}
- name: Upload Test Results
uses: actions/upload-artifact@v7
if: ${{ (steps.build.outcome == 'success') && (!cancelled()) }}
with:
name: ${{ matrix.name }}
if-no-files-found: ignore
path: |
libs/librepcb/rust-core/target/llvm-cov/html/
tests/ui/screenshot.png
# Save Caches
- name: Cache .ccache
uses: actions/cache/save@v5
with:
key: ${{ steps.restore_ccache.outputs.cache-primary-key }}
path: ${{ env.CCACHE_DIR }}
if: ${{ steps.restore_ccache && (!cancelled()) }}
- name: Cache .cargo
uses: actions/cache/save@v5
with:
key: ${{ steps.restore_cargo.outputs.cache-primary-key }}
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/
if: ${{ steps.restore_cargo && (!cancelled()) }}