Some checks failed
Build and Test / build (pull_request) Has been cancelled
Node.js actions (checkout, cache, upload-artifact, download-artifact) use their own TLS stack and don't trust the system CA store. Setting NODE_EXTRA_CA_CERTS points Node to the system bundle which includes the Cloudflare origin CA.
146 lines
4.9 KiB
YAML
146 lines
4.9 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: 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
|
|
NODE_EXTRA_CA_CERTS: /etc/ssl/certs/ca-certificates.crt
|
|
|
|
steps:
|
|
- name: Trust Cloudflare origin CA
|
|
run: |
|
|
apt-get update -qq
|
|
apt-get install -y --no-install-recommends ca-certificates
|
|
update-ca-certificates
|
|
|
|
- name: Free disk space
|
|
run: |
|
|
echo "=== Disk usage before cleanup ==="
|
|
df -h /
|
|
rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache 2>/dev/null || true
|
|
rm -rf /usr/local/share/boost /usr/share/swift 2>/dev/null || true
|
|
apt-get autoremove -y 2>/dev/null || true
|
|
apt-get clean 2>/dev/null || true
|
|
echo "=== Disk usage after cleanup ==="
|
|
df -h /
|
|
|
|
- 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://git.kindred-systems.com/actions/checkout.git@v4
|
|
with:
|
|
submodules: recursive
|
|
fetch-depth: 1
|
|
|
|
- name: Fetch latest tag (for git describe)
|
|
run: |
|
|
latest_tag=$(git ls-remote --tags --sort=-v:refname origin 'refs/tags/v*' | grep -v '\^{}' | head -n1 | awk '{print $2}')
|
|
if [ -n "$latest_tag" ]; then
|
|
git fetch --no-recurse-submodules --force --depth=1 origin "+${latest_tag}:${latest_tag}"
|
|
fi
|
|
|
|
- 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: Compute cache date key
|
|
id: cache-date
|
|
run: echo "date=$(date -u +%Y%m%d)" >> $GITHUB_OUTPUT
|
|
|
|
- name: Restore ccache
|
|
id: ccache-restore
|
|
uses: https://git.kindred-systems.com/actions/cache.git/restore@v4
|
|
with:
|
|
path: /tmp/ccache-kindred-create
|
|
key: ccache-build-${{ github.ref_name }}-${{ steps.cache-date.outputs.date }}
|
|
restore-keys: |
|
|
ccache-build-${{ github.ref_name }}-
|
|
ccache-build-main-
|
|
|
|
- name: Prepare ccache
|
|
run: |
|
|
mkdir -p $CCACHE_DIR
|
|
pixi run ccache -z
|
|
pixi run ccache -p
|
|
|
|
- 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() && steps.ccache-restore.outputs.cache-hit != 'true'
|
|
uses: https://git.kindred-systems.com/actions/cache.git/save@v4
|
|
with:
|
|
path: /tmp/ccache-kindred-create
|
|
key: ccache-build-${{ github.ref_name }}-${{ steps.cache-date.outputs.date }}
|
|
|
|
- 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://git.kindred-systems.com/actions/upload-artifact.git@v3
|
|
with:
|
|
name: ${{ env.ARTIFACT_NAME }}
|
|
path: |
|
|
build/release/*.tar.xz
|
|
build/release/*.sha256
|
|
retention-days: 14
|