Skip to content

Add pixi support

Add pixi support #23

name: CI - MacOS/Linux/Windows via Pixi
on:
schedule:
- cron: '0 0 * * 1'
push:
paths-ignore:
- doc/**
- .gitlab-ci.yml
- .gitignore
- '*.md'
- CITATION.*
- COPYING.LESSER
- colcon.pkg
- .pre-commit-config.yaml
- CHANGELOG.md
pull_request:
paths-ignore:
- doc/**
- .gitlab-ci.yml
- .gitignore
- '*.md'
- CITATION.*
- COPYING.LESSER
- colcon.pkg
- .pre-commit-config.yaml
- CHANGELOG.md
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
pinocchio-pixi:
name: ${{ matrix.os }} - Env ${{ matrix.environment }} ${{ matrix.build_type }} ${{ matrix.compiler }}
runs-on: ${{ matrix.os }}
env:
CCACHE_BASEDIR: ${GITHUB_WORKSPACE}
CCACHE_DIR: ${GITHUB_WORKSPACE}/.ccache
CCACHE_COMPRESS: true
CCACHE_COMPRESSLEVEL: 5
BUILD_ADVANCED_TESTING: ${{ matrix.BUILD_ADVANCED_TESTING }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, macos-13]
environment: [all, all-py39]
build_type: [Release, Debug]
include:
# Disable BUILD_ADVANCED_TESTING as the test can take many time to run
- os: ubuntu-latest
BUILD_ADVANCED_TESTING: OFF
- os: macos-latest
BUILD_ADVANCED_TESTING: OFF
- os: macos-13
BUILD_ADVANCED_TESTING: OFF
- os: windows-latest
environment: all
build_type: Release
BUILD_ADVANCED_TESTING: OFF
- os: windows-latest
environment: all-clang-cl
build_type: Release
BUILD_ADVANCED_TESTING: OFF
steps:
# extract branch name or checkout devel branch for scheduled events
- name: Get branch name or checkout devel
shell: bash -el {0}
run: |
if [ "${{ github.event_name }}" == "schedule" ]; then
echo "BRANCH_NAME=devel" >> $GITHUB_ENV
echo "LABELS=build_all" >> $GITHUB_ENV
else
echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV
fi
- uses: actions/checkout@v4
with:
ref: ${{ env.BRANCH_NAME }}
submodules: recursive
- uses: actions/cache@v4
with:
path: .ccache
key: ccache-macos-linux-conda-${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.python-version }}-${{ github.sha }}
restore-keys: ccache-macos-linux-conda-${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.python-version }}-
- uses: prefix-dev/[email protected]
with:
pixi-version: v0.33.0
cache: true
environments: ${{ matrix.environment }}
# Avoid filling all disk space with debug symbols
- name: Setup CMAKE_TOOLCHAIN_FILE
if: (contains(matrix.os, 'macos') || contains(matrix.os, 'ubuntu')) && contains(matrix.build_type, 'Debug')
run: |
echo "CMAKE_TOOLCHAIN_FILE=${GITHUB_WORKSPACE}/.github/workflows/cmake/linux-debug-toolchain.cmake" >> "$GITHUB_ENV"
- name: Get Compilation Flags
id: get_labels
uses: actions/github-script@v7
env:
LABELS: ${{ env.LABELS }}
with:
script: |
const script = require('./.github/workflows/scripts/get_compilation_flags.js');
await script({github, context, core})
result-encoding: string
- name: Build Pinocchio [MacOS/Linux/Windows]
shell: bash -el {0}
env:
CMAKE_BUILD_PARALLEL_LEVEL: 2
PINOCCHIO_BUILD_TYPE: ${{ matrix.build_type }}
run: |
# Launch configure but overwrite default options
pixi run -e ${{ matrix.environment }} configure \
-DBUILD_ADVANCED_TESTING=${{ env.BUILD_ADVANCED_TESTING }} \
${{ steps.get_labels.outputs.cmakeFlags }}
pixi run -e ${{ matrix.environment }} cmake --build build --target all
pixi run -e ${{ matrix.environment }} ctest --test-dir build --output-on-failure
pixi run -e ${{ matrix.environment }} cmake --install build
- name: Uninstall Pinocchio
shell: bash -el {0}
run: |
cmake --build build --target uninstall
check:
if: always()
name: check-macos-linux-windows-pixi
needs:
- pinocchio-pixi
runs-on: Ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}