# 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: ubuntu-latest env: CCACHE_DIR: /tmp/ccache-kindred-create CCACHE_COMPRESS: "true" CCACHE_COMPRESSLEVEL: "6" CCACHE_MAXSIZE: "4G" CCACHE_SLOPPINESS: "include_file_ctime,include_file_mtime,pch_defines,time_macros" CCACHE_BASEDIR: ${{ github.workspace }} DEBIAN_FRONTEND: noninteractive steps: - name: Install system prerequisites run: | apt-get update -qq apt-get install -y --no-install-recommends \ ca-certificates curl git xvfb xauth openssl sudo \ libgl1-mesa-dev libglu1-mesa-dev libx11-dev libxkbcommon-dev \ libxcb-xkb-dev libfontconfig1-dev - name: Checkout repository uses: https://github.com/actions/checkout@v4 with: submodules: recursive fetch-depth: 1 - name: Fetch tags (for git describe) run: git fetch --tags --no-recurse-submodules origin - name: Install pixi run: | curl -fsSL https://pixi.sh/install.sh | bash echo "$HOME/.pixi/bin" >> $GITHUB_PATH export PATH="$HOME/.pixi/bin:$PATH" pixi --version - name: Restore ccache id: ccache-restore uses: https://github.com/actions/cache/restore@v4 with: path: /tmp/ccache-kindred-create key: ccache-build-${{ github.ref_name }}-${{ github.sha }} restore-keys: | ccache-build-${{ github.ref_name }}- ccache-build-main- - name: Prepare ccache run: | mkdir -p $CCACHE_DIR pixi run ccache -z - name: Configure (CMake) run: pixi run cmake --preset conda-linux-release - name: Build run: pixi run cmake --build build/release -j$(nproc) - name: Show ccache statistics run: pixi run ccache -s - name: Save ccache if: always() uses: https://github.com/actions/cache/save@v4 with: path: /tmp/ccache-kindred-create key: ccache-build-${{ github.ref_name }}-${{ github.sha }} - name: Run C++ unit tests continue-on-error: true timeout-minutes: 15 run: | export CTEST_DISCOVERY_TIMEOUT=60 pixi run xvfb-run -a ctest --test-dir build/release \ --output-on-failure \ --timeout 120 \ --exclude-regex "Assembly_tests" \ 2>&1 || true - name: Install run: pixi run cmake --install build/release --prefix build/release/install - name: Run Python CLI tests timeout-minutes: 10 run: pixi run timeout 300 build/release/bin/FreeCADCmd -t 0 || true - name: Run GUI tests (headless) timeout-minutes: 10 run: pixi run timeout 300 xvfb-run -a build/release/bin/FreeCAD -t 0 || true - name: Package build artifacts run: | ARTIFACT_NAME="kindred-create-$(git describe --tags --always)-linux-x86_64" cd build/release cp -a install "${ARTIFACT_NAME}" tar -cJf "${ARTIFACT_NAME}.tar.xz" "${ARTIFACT_NAME}" sha256sum "${ARTIFACT_NAME}.tar.xz" > "${ARTIFACT_NAME}.tar.xz.sha256" echo "ARTIFACT_NAME=${ARTIFACT_NAME}" >> $GITHUB_ENV - name: Upload build artifact uses: https://github.com/actions/upload-artifact@v3 with: name: ${{ env.ARTIFACT_NAME }} path: | build/release/*.tar.xz build/release/*.sha256 retention-days: 14