-
Notifications
You must be signed in to change notification settings - Fork 417
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Add a workflow that use Pixi and remove conda workflow
- Loading branch information
Showing
5 changed files
with
142 additions
and
321 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: CI - OSX/Linux via Conda | ||
name: CI - MacOS/Linux/Windows via Pixi | ||
|
||
on: | ||
schedule: | ||
|
@@ -28,8 +28,8 @@ concurrency: | |
cancel-in-progress: true | ||
|
||
jobs: | ||
pinocchio-conda: | ||
name: ${{ matrix.os }} - Python ${{ matrix.python-version }} ${{ matrix.build_type }} with Conda | ||
pinocchio-pixi: | ||
name: ${{ matrix.os }} - Env ${{ matrix.environment }} ${{ matrix.build_type }} ${{ matrix.compiler }} | ||
runs-on: ${{ matrix.os }} | ||
env: | ||
CCACHE_BASEDIR: ${GITHUB_WORKSPACE} | ||
|
@@ -41,20 +41,32 @@ jobs: | |
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, macos-latest] | ||
os: [ubuntu-latest, macos-latest, macos-13] | ||
environment: [all, all-py39] | ||
build_type: [Release, Debug] | ||
python-version: ['3.8', '3.12'] | ||
|
||
include: | ||
# Disable BUILD_ADVANCED_TESTING as the test can take many time to run | ||
- os: ubuntu-latest | ||
BUILD_ADVANCED_TESTING: OFF | ||
# Disable BUILD_ADVANCED_TESTING as the test can take many time to run | ||
- 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 | ||
|
@@ -71,18 +83,16 @@ jobs: | |
- uses: actions/cache@v4 | ||
with: | ||
path: .ccache | ||
save-always: true | ||
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: conda-incubator/setup-miniconda@v3 | ||
- uses: prefix-dev/setup-[email protected] | ||
with: | ||
activate-environment: pinocchio-linux | ||
auto-update-conda: true | ||
environment-file: .github/workflows/conda/environment_macos_linux.yml | ||
python-version: ${{ matrix.python-version }} | ||
auto-activate-base: false | ||
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: | | ||
|
@@ -99,38 +109,31 @@ jobs: | |
await script({github, context, core}) | ||
result-encoding: string | ||
|
||
- name: Build Pinocchio | ||
- name: Build Pinocchio [MacOS/Linux/Windows] | ||
shell: bash -el {0} | ||
env: | ||
CMAKE_BUILD_PARALLEL_LEVEL: 2 | ||
PINOCCHIO_BUILD_TYPE: ${{ matrix.build_type }} | ||
run: | | ||
conda list | ||
echo $CONDA_PREFIX | ||
mkdir build | ||
cd build | ||
cmake .. \ | ||
-G "Ninja" \ | ||
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ | ||
-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \ | ||
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ | ||
# Launch configure but overwrite default options | ||
pixi run -e ${{ matrix.environment }} configure \ | ||
-DBUILD_ADVANCED_TESTING=${{ env.BUILD_ADVANCED_TESTING }} \ | ||
${{ steps.get_labels.outputs.cmakeFlags }} | ||
cmake --build . -j2 | ||
ctest --output-on-failure | ||
cmake --install . | ||
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: | | ||
cd build | ||
cmake --build . --target uninstall | ||
cmake --build build --target uninstall | ||
check: | ||
if: always() | ||
name: check-macos-linux-conda | ||
name: check-macos-linux-windows-pixi | ||
|
||
needs: | ||
- pinocchio-conda | ||
- pinocchio-pixi | ||
|
||
runs-on: Ubuntu-latest | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,102 +1,117 @@ | ||
// Inspired by https://github.com/emmenko/action-verify-pr-labels/tree/master | ||
module.exports = async ({github, context, core}) => { | ||
const getPullRequestNumber = (ref) => { | ||
core.debug(`Parsing ref: ${ref}`); | ||
// This assumes that the ref is in the form of `refs/pull/:prNumber/merge` | ||
const prNumber = ref.replace(/refs\/pull\/(\d+)\/merge/, '$1'); | ||
return parseInt(prNumber, 10); | ||
// Create the default CMakeOptions | ||
function CMakeOptions() { | ||
this.BUILD_WITH_COLLISION_SUPPORT = "OFF"; | ||
this.BUILD_WITH_CASADI_SUPPORT = "OFF"; | ||
this.BUILD_WITH_AUTODIFF_SUPPORT = "OFF"; | ||
this.BUILD_WITH_EXTRA_SUPPORT = "OFF"; | ||
this.BUILD_WITH_CODEGEN_SUPPORT = "OFF"; | ||
this.BUILD_WITH_OPENMP_SUPPORT = "OFF"; | ||
this.BUILD_PYTHON_BINDINGS_WITH_BOOST_MPFR_SUPPORT = "OFF"; | ||
this.INSTALL_DOCUMENTATION = "ON"; | ||
this.GENERATE_PYTHON_STUBS = "ON"; | ||
this.BUILD_WITH_ACCELERATE_SUPPORT = "OFF"; | ||
this.BUILD_WITH_SDF_SUPPORT = "OFF"; | ||
} | ||
|
||
// Return an object with an association between labels and | ||
// options that should be set to ON | ||
function makeLabelToOptions() { | ||
const os = process.env.RUNNER_OS; | ||
if(os == "Windows") { | ||
return { | ||
build_all: [ | ||
'BUILD_WITH_COLLISION_SUPPORT', | ||
'BUILD_WITH_CASADI_SUPPORT', | ||
'BUILD_WITH_AUTODIFF_SUPPORT', | ||
'BUILD_WITH_EXTRA_SUPPORT', | ||
'BUILD_PYTHON_BINDINGS_WITH_BOOST_MPFR_SUPPORT', | ||
'BUILD_WITH_SDF_SUPPORT' | ||
], | ||
build_collision: ['BUILD_WITH_COLLISION_SUPPORT'], | ||
build_casadi: ['BUILD_WITH_CASADI_SUPPORT'], | ||
build_autodiff: ['BUILD_WITH_AUTODIFF_SUPPORT'], | ||
build_extra: ['BUILD_WITH_EXTRA_SUPPORT'], | ||
build_codegen: [], | ||
build_openmp: [], | ||
build_mpfr: ['BUILD_PYTHON_BINDINGS_WITH_BOOST_MPFR_SUPPORT'], | ||
build_sdf: ['BUILD_WITH_SDF_SUPPORT'], | ||
build_accelerate: ['BUILD_WITH_ACCELERATE_SUPPORT'] | ||
}; | ||
} else { | ||
return { | ||
build_all: [ | ||
'BUILD_WITH_COLLISION_SUPPORT', | ||
'BUILD_WITH_CASADI_SUPPORT', | ||
'BUILD_WITH_AUTODIFF_SUPPORT', | ||
'BUILD_WITH_EXTRA_SUPPORT', | ||
'BUILD_WITH_CODEGEN_SUPPORT', | ||
'BUILD_WITH_OPENMP_SUPPORT', | ||
'BUILD_PYTHON_BINDINGS_WITH_BOOST_MPFR_SUPPORT', | ||
'BUILD_WITH_SDF_SUPPORT' | ||
], | ||
build_collision: ['BUILD_WITH_COLLISION_SUPPORT'], | ||
build_casadi: ['BUILD_WITH_CASADI_SUPPORT'], | ||
build_autodiff: ['BUILD_WITH_AUTODIFF_SUPPORT'], | ||
build_extra: ['BUILD_WITH_EXTRA_SUPPORT'], | ||
build_codegen: ['BUILD_WITH_CODEGEN_SUPPORT'], | ||
build_openmp: ['BUILD_WITH_OPENMP_SUPPORT'], | ||
build_mpfr: ['BUILD_PYTHON_BINDINGS_WITH_BOOST_MPFR_SUPPORT'], | ||
build_sdf: ['BUILD_WITH_SDF_SUPPORT'], | ||
build_accelerate: ['BUILD_WITH_ACCELERATE_SUPPORT'] | ||
}; | ||
} | ||
} | ||
|
||
function getPullRequestNumber(ref) { | ||
// This assumes that the ref is in the form of `refs/pull/:prNumber/merge` | ||
const prNumber = ref.replace(/refs\/pull\/(\d+)\/merge/, '$1'); | ||
return parseInt(prNumber, 10); | ||
} | ||
|
||
// Get activated labels | ||
async function getLabelNames(github, context) { | ||
const {LABELS} = process.env; | ||
|
||
if(LABELS) { | ||
return [LABELS]; | ||
} else { | ||
const prNumber = context.issue.number || getPullRequestNumber(context.ref); | ||
|
||
let cmakeFlags = ''; | ||
// get os process is run on | ||
const os = process.env.RUNNER_OS; | ||
var labelFlags; | ||
if(os == "Windows") | ||
{ | ||
labelFlags = { | ||
build_all: [ | ||
' -DBUILD_WITH_COLLISION_SUPPORT=ON', | ||
' -DBUILD_WITH_CASADI_SUPPORT=ON', | ||
' -DBUILD_WITH_AUTODIFF_SUPPORT=ON', | ||
' -DBUILD_WITH_EXTRA_SUPPORT=ON', | ||
' -DBUILD_PYTHON_BINDINGS_WITH_BOOST_MPFR_SUPPORT=ON', | ||
' -DINSTALL_DOCUMENTATION=ON', | ||
' -DGENERATE_PYTHON_STUBS=ON', | ||
' -DBUILD_WITH_ACCELERATE_SUPPORT=OFF', | ||
' -DBUILD_WITH_SDF_SUPPORT=ON' | ||
], | ||
build_collision: ' -DBUILD_WITH_COLLISION_SUPPORT=ON', | ||
build_casadi: ' -DBUILD_WITH_CASADI_SUPPORT=ON', | ||
build_autodiff: ' -DBUILD_WITH_AUTODIFF_SUPPORT=ON', | ||
build_extra: ' -DBUILD_WITH_EXTRA_SUPPORT=ON', | ||
build_mpfr: ' -DBUILD_PYTHON_BINDINGS_WITH_BOOST_MPFR_SUPPORT=ON', | ||
build_sdf: ' -DBUILD_WITH_SDF_SUPPORT=ON', | ||
build_accelerate: ' -DBUILD_WITH_ACCELERATE_SUPPORT=ON' | ||
}; | ||
} | ||
else | ||
{ | ||
labelFlags = { | ||
build_all: [ | ||
' -DBUILD_WITH_COLLISION_SUPPORT=ON', | ||
' -DBUILD_WITH_CASADI_SUPPORT=ON', | ||
' -DBUILD_WITH_AUTODIFF_SUPPORT=ON', | ||
' -DBUILD_WITH_EXTRA_SUPPORT=ON', | ||
' -DBUILD_WITH_OPENMP_SUPPORT=ON', | ||
' -DBUILD_PYTHON_BINDINGS_WITH_BOOST_MPFR_SUPPORT=ON', | ||
' -DINSTALL_DOCUMENTATION=ON', | ||
' -DBUILD_WITH_CODEGEN_SUPPORT=ON', | ||
' -DGENERATE_PYTHON_STUBS=ON', | ||
' -DBUILD_WITH_ACCELERATE_SUPPORT=OFF', | ||
' -DBUILD_WITH_SDF_SUPPORT=ON' | ||
], | ||
build_collision: ' -DBUILD_WITH_COLLISION_SUPPORT=ON', | ||
build_casadi: ' -DBUILD_WITH_CASADI_SUPPORT=ON', | ||
build_autodiff: ' -DBUILD_WITH_AUTODIFF_SUPPORT=ON', | ||
build_codegen: ' -DBUILD_WITH_CODEGEN_SUPPORT=ON', | ||
build_extra: ' -DBUILD_WITH_EXTRA_SUPPORT=ON', | ||
build_openmp: ' -DBUILD_WITH_OPENMP_SUPPORT=ON', | ||
build_mpfr: ' -DBUILD_PYTHON_BINDINGS_WITH_BOOST_MPFR_SUPPORT=ON', | ||
build_sdf: ' -DBUILD_WITH_SDF_SUPPORT=ON', | ||
build_accelerate: ' -DBUILD_WITH_ACCELERATE_SUPPORT=ON' | ||
}; | ||
if(isNaN(prNumber)) { | ||
return []; | ||
} | ||
|
||
// Get the GitHub event name that triggered the workflow | ||
const {LABELS} = process.env; | ||
var labelNames; | ||
if(LABELS) | ||
{ | ||
labelNames=[LABELS]; | ||
} | ||
else | ||
{ | ||
if(isNaN(prNumber)) | ||
{ | ||
core.setOutput("cmakeFlags", cmakeFlags); | ||
return; | ||
} | ||
const { data } = await github.rest.pulls.get({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
pull_number: prNumber, | ||
}); | ||
return data.labels.map(label => label.name); | ||
} | ||
} | ||
|
||
const { data } = await github.rest.pulls.get({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
pull_number: prNumber, | ||
}); | ||
labelNames = data.labels.map(label => label.name); | ||
// Inspired by https://github.com/emmenko/action-verify-pr-labels/tree/master | ||
module.exports = async ({github, context, core}) => { | ||
const labelToOptions = makeLabelToOptions(); | ||
const labelNames = await getLabelNames(github, context); | ||
let options = new CMakeOptions(); | ||
|
||
// Turn CMake options ON | ||
for (let label of labelNames) { | ||
if (labelToOptions[label]) { | ||
for (let x of labelToOptions[label]) { | ||
options[x] = "ON"; | ||
} | ||
} | ||
} | ||
|
||
labelNames.forEach(label => { | ||
if (labelFlags[label]) { | ||
if (Array.isArray(labelFlags[label])) { | ||
cmakeFlags += labelFlags[label].join(' '); | ||
} else { | ||
cmakeFlags += labelFlags[label]; | ||
} | ||
} | ||
}); | ||
console.log(cmakeFlags); | ||
core.setOutput("cmakeFlags", cmakeFlags); | ||
return; | ||
// Transform options object into command line output | ||
let cmakeFlags = ''; | ||
for (let [k, v] of Object.entries(options)) { | ||
cmakeFlags += `-D${k}=${v} `; | ||
} | ||
|
||
console.log(cmakeFlags); | ||
core.setOutput("cmakeFlags", cmakeFlags); | ||
return; | ||
} |
Oops, something went wrong.