Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
c730ec352This file is pinned to the selected release. Download the original to open it in your design tool.
on:
workflow_call:
jobs:
macos:
name: ${{ matrix.name }}
runs-on: ${{ matrix.runner }}
env:
OS: 'mac'
ARCH: ${{ matrix.arch }}
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(?)
CARGO_INCREMENTAL: 0 # Avoid creating additional build artifacts
CI_BRANCH_NAME: ${{ github.ref }}
CCACHE_MAXSIZE: '500MB'
CCACHE_DIR: '/Users/runner/ccache-dir'
CARGO_HOME: '/Users/runner/cargo-home'
QT_URL: ${{ matrix.qt_url }}
QT_SHA256: ${{ matrix.qt_sha256 }}
QT_ROOT: '/Users/runner/qt'
OCC_VERSION: '7_9_1'
OCC_SHA256: 'de442298cd8860f5580b01007f67f0ecd0b8900cfa4da467fa3c823c2d1a45df'
OCC_ROOT: '/Users/runner/occ'
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.deployment_target }} # Picked up by CMake and Rust
CMAKE_PREFIX_PATH: '/Users/runner/qt/lib/cmake/Qt6:/Users/runner/occ/lib/cmake/opencascade'
CMAKE_XCODE_ATTRIBUTE_ENABLE_HARDENED_RUNTIME: 'YES' # Required for notarizing
strategy:
fail-fast: false
matrix:
include:
- name: MacOS ARM64
runner: macos-14 # Must be an ARM64 CPU: https://github.com/actions/runner-images
arch: arm64
deployment_target: '11'
# Qt 6.7.3 is the last version that runs on macOS 11.
qt_url: 'https://download.qt.io/archive/qt/6.7/6.7.3/single/qt-everywhere-src-6.7.3.tar.xz'
qt_sha256: 'a3f1d257cbb14c6536585ffccf7c203ce7017418e1a0c2ed7c316c20c729c801'
- name: MacOS x86_64
runner: macos-15-intel # Must be an x86_64 CPU: https://github.com/actions/runner-images
arch: x86_64
deployment_target: '10.14'
# Qt 6.5.8 is the last version that runs on macOS 10.14.
qt_url: 'https://qt.mirror.constant.com/archive/qt/6.5/6.5.8/src/single/qt-everywhere-opensource-src-6.5.8.tar.xz'
qt_sha256: '4eeb391891b325cd00aed6e42cb4ef966ffeef0877e188c9667a702944760c27'
steps:
# Clone Repository
- uses: actions/checkout@v6
with:
submodules: recursive
- name: Print Environment
run: ./ci/print_environment.sh
# Install System Dependencies
- name: Install System Dependencies
run: |
source ./ci/install_dependencies.sh
# Pass modified PATH to following steps:
echo "$PATH" > "$GITHUB_PATH"
# Restore Caches
- id: restore_ccache
name: Restore .ccache
uses: actions/cache/restore@v5
with:
key: ccache-${{ matrix.runner }}-${{ github.ref }}-${{ github.run_id }}
restore-keys: |
ccache-${{ matrix.runner }}-${{ github.ref }}
ccache-${{ matrix.runner }}-refs/heads/master
ccache-${{ matrix.runner }}
path: ${{ env.CCACHE_DIR }}
- id: restore_cargo
name: Restore .cargo
uses: actions/cache/restore@v5
with:
key: cargo-${{ matrix.runner }}-${{ hashFiles('libs/librepcb/**/Cargo.lock') }}-${{ github.ref }}-${{ github.run_id }}
restore-keys: |
cargo-${{ matrix.runner }}-${{ hashFiles('libs/librepcb/**/Cargo.lock') }}-${{ github.ref }}
cargo-${{ matrix.runner }}-${{ hashFiles('libs/librepcb/**/Cargo.lock') }}-refs/heads/master
cargo-${{ matrix.runner }}-${{ hashFiles('libs/librepcb/**/Cargo.lock') }}
cargo-${{ matrix.runner }}
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/
- id: restore_qt
name: Restore Qt Cache
uses: actions/cache/restore@v5
with:
key: ${{ matrix.runner }}-${{ env.MACOSX_DEPLOYMENT_TARGET }}-qt-${{ env.QT_SHA256 }}-v7
path: ${{ env.QT_ROOT }}
- id: restore_occ
name: Restore OpenCascade Cache
uses: actions/cache/restore@v5
with:
key: ${{ matrix.runner }}-${{ env.MACOSX_DEPLOYMENT_TARGET }}-occ-${{ env.OCC_VERSION }}-v7
path: ${{ env.OCC_ROOT }}
# Install Dependencies
- id: install_qt
name: Build & Install Qt
run: ./ci/install_qt.sh
if: ${{ (steps.restore_qt.outputs.cache-hit != 'true') && (!cancelled()) }}
- id: install_occ
name: Build & Install OpenCascade
run: ./ci/install_occ.sh
if: ${{ (steps.restore_occ.outputs.cache-hit != 'true') && (!cancelled()) }}
- name: Install Python Packages
run: ./ci/install_python_packages.sh
env:
SLINT_UI_TESTING_AUTH: ${{ secrets.SLINT_UI_TESTING_AUTH }}
- name: Print New Environment
run: ./ci/print_environment.sh
# Build
- id: build
name: Build LibrePCB
run: ./ci/build_librepcb.sh
env:
LIBREPCB_BUILD_AUTHOR: "LibrePCB CI"
- name: Build Bundle
run: ./ci/build_mac_bundle.sh
- name: Build DMG
run: ./ci/build_mac_dmg.sh
# Test
- name: Run rust-core Tests
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: ./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/LibrePCB.app/Contents/MacOS/librepcb-cli"
if: ${{ (steps.build.outcome == 'success') && (!cancelled()) }}
- name: Run LibrePCB Functional Tests
run: uv --directory ./tests/funq run --no-dev pytest -vvv --librepcb-executable="../../build/install/LibrePCB.app/Contents/MacOS/librepcb" --reruns 5 --reruns-delay 10
if: ${{ (steps.build.outcome == 'success') && (!cancelled()) }}
- name: Run LibrePCB UI Tests
run: uv --directory ./tests/ui run --no-dev pytest -vvv --librepcb-executable="../../build/install/LibrePCB.app/Contents/MacOS/librepcb"
if: ${{ (steps.build.outcome == 'success') && (!cancelled()) && env.SLINT_UI_TESTING_AUTH }}
env:
SLINT_UI_TESTING_AUTH: ${{ secrets.SLINT_UI_TESTING_AUTH }}
# Upload Artifacts
- name: Tar & Upload Artifacts
run: |
./ci/tar_artifacts.sh
./ci/upload_artifacts.sh
if: ${{ (steps.build.outcome == 'success') && (!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()) }}
- name: Cache Qt
uses: actions/cache/save@v5
with:
key: ${{ steps.restore_qt.outputs.cache-primary-key }}
path: ${{ env.QT_ROOT }}
if: ${{ (steps.install_qt.outcome == 'success') && always() }}
- name: Cache OpenCascade
uses: actions/cache/save@v5
with:
key: ${{ steps.restore_occ.outputs.cache-primary-key }}
path: ${{ env.OCC_ROOT }}
if: ${{ (steps.install_occ.outcome == 'success') && always() }}