87 lines
2.4 KiB
YAML
87 lines
2.4 KiB
YAML
# SPDX-License-Identifier: LGPL-2.1-or-later
|
|
name: Build and Test
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: app-builder
|
|
|
|
env:
|
|
CCACHE_DIR: /var/cache/ccache/kindred-create
|
|
CCACHE_COMPRESS: "true"
|
|
CCACHE_COMPRESSLEVEL: "6"
|
|
CCACHE_MAXSIZE: "4G"
|
|
CCACHE_SLOPPINESS: "include_file_ctime,include_file_mtime,pch_defines,time_macros"
|
|
|
|
steps:
|
|
- name: Install node if needed
|
|
shell: bash
|
|
run: |
|
|
if ! command -v node &> /dev/null; then
|
|
curl -fsSL https://nodejs.org/dist/v20.18.0/node-v20.18.0-linux-x64.tar.xz | sudo tar -xJ -C /usr/local --strip-components=1
|
|
fi
|
|
node --version
|
|
|
|
- name: Checkout repository
|
|
uses: https://github.com/actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
fetch-depth: 0
|
|
|
|
- name: Install pixi if needed
|
|
shell: bash
|
|
run: |
|
|
if ! command -v pixi &> /dev/null; then
|
|
curl -fsSL https://pixi.sh/install.sh | bash
|
|
echo "$HOME/.pixi/bin" >> $GITHUB_PATH
|
|
export PATH="$HOME/.pixi/bin:$PATH"
|
|
fi
|
|
pixi --version
|
|
|
|
- name: Prepare ccache
|
|
shell: bash
|
|
run: |
|
|
sudo mkdir -p $CCACHE_DIR
|
|
sudo chown $(whoami):$(whoami) $CCACHE_DIR
|
|
pixi run ccache -z
|
|
pixi run ccache -p
|
|
|
|
- name: Configure (CMake)
|
|
shell: bash
|
|
run: |
|
|
# Use conda Clang with modern CPU optimizations
|
|
pixi run cmake --preset conda-linux-release \
|
|
-DCMAKE_C_FLAGS="-march=x86-64-v3" \
|
|
-DCMAKE_CXX_FLAGS="-march=x86-64-v3"
|
|
|
|
- name: Build
|
|
run: pixi run cmake --build build/release -j$(nproc)
|
|
|
|
- name: Show ccache statistics
|
|
run: pixi run ccache -s
|
|
|
|
- name: Run C++ unit tests
|
|
shell: bash
|
|
run: |
|
|
set -x
|
|
pixi run ctest --test-dir build/release --output-on-failure --timeout 120 -V 2>&1 || {
|
|
echo "=== Tests failed, showing last test log ==="
|
|
cat build/release/Testing/Temporary/LastTest.log 2>/dev/null || true
|
|
exit 1
|
|
}
|
|
|
|
- name: Install
|
|
run: pixi run install-release
|
|
|
|
- name: Run Python CLI tests
|
|
run: pixi run build/release/bin/FreeCADCmd -t 0 || true
|
|
|
|
- name: Run GUI tests (headless)
|
|
run: pixi run xvfb-run build/release/bin/FreeCAD -t 0 || true
|