Skip to content

Commit

Permalink
General CI cleanup November 2024 (#171)
Browse files Browse the repository at this point in the history
* Migrate from catch2 2.* to 3.*

* Drop homebrew macos job from CI

* Add conda-forge CI job using pixi

* Add valgrind tests in pixi
  • Loading branch information
traversaro authored Dec 16, 2024
1 parent e535f6f commit db34a00
Show file tree
Hide file tree
Showing 14 changed files with 4,445 additions and 32 deletions.
13 changes: 4 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
env:
osqp_TAG: v0.6.3
vcpkg_robotology_TAG: v0.0.3
Catch2_TAG: v2.13.9
Catch2_TAG: v3.0.1
# Overwrite the VCPKG_INSTALLATION_ROOT env variable defined by GitHub Actions to point to our vcpkg
VCPKG_INSTALLATION_ROOT: C:\robotology\vcpkg

Expand All @@ -23,7 +23,7 @@ jobs:
strategy:
matrix:
build_type: [Debug, Release]
os: [ubuntu-latest, macOS-latest, windows-latest]
os: [ubuntu-latest, windows-latest]
float: [ON, OFF]
fail-fast: false

Expand Down Expand Up @@ -64,11 +64,6 @@ jobs:
cd C:/robotology/vcpkg
./vcpkg.exe install --triplet x64-windows catch2
- name: Dependencies [macOS]
if: matrix.os == 'macOS-latest'
run: |
brew install eigen
- name: Dependencies [Ubuntu]
if: matrix.os == 'ubuntu-latest'
run: |
Expand Down Expand Up @@ -98,8 +93,8 @@ jobs:
cmake --build . --config ${{ matrix.build_type }} --target INSTALL
- name: Source-based Dependencies [Ubuntu/macOS]
if: steps.cache-source-deps.outputs.cache-hit != 'true' && (matrix.os == 'ubuntu-latest' || matrix.os == 'macOS-latest')
- name: Source-based Dependencies [Ubuntu]
if: steps.cache-source-deps.outputs.cache-hit != 'true' && (matrix.os == 'ubuntu-latest')
shell: bash
run: |
# osqp
Expand Down
54 changes: 54 additions & 0 deletions .github/workflows/test-pixi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Run tests with pixi

on:
# on demand
workflow_dispatch:
inputs:
delete_pixi_lock:
description: 'If true, delete pixi.lock, to test against the latest version of dependencies.'
required: true
default: 'false'
pull_request:
schedule:
# * is a special character in YAML so you have to quote this string
# Execute a "nightly" build twice a week 2 AM UTC
- cron: '0 2 * * 2,5'

jobs:
pixi-test:
name: '[pixi:${{ matrix.os }}]'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [
ubuntu-24.04,
macos-latest,
windows-2019
]
steps:
- uses: actions/checkout@v4

# On periodic jobs and when delete_pixi_lock option is true, delete the pixi.lock to check that the project compiles with latest version of dependencies
- name: Delete pixi.lock on scheduled jobs or if delete_pixi_lock is true
if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.delete_pixi_lock == 'true')
shell: bash
run: |
rm pixi.lock
# To use valgrind even with conda/pixi we still need to install libc6-dbg via apt on Debian-based distros
# See https://github.com/robotology/osqp-eigen/pull/171#issuecomment-2458149581
- name: Install libc6-dbg
if: contains(matrix.os, 'ubuntu')
run: |
sudo apt-get install libc6-dbg
- name: Set up pixi
uses: prefix-dev/[email protected]

- name: Print pixi info
run: pixi info

- name: Build and test the project
run: pixi run test
42 changes: 42 additions & 0 deletions .github/workflows/update-pixi-lockfile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Update lockfiles

permissions:
contents: write
pull-requests: write

on:
workflow_dispatch:
schedule:
- cron: 0 5 1 * *

jobs:
pixi-update:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4

- name: Set up pixi
uses: prefix-dev/[email protected]
with:
run-install: false

- name: Install pixi-diff-to-markdown
run: pixi global install pixi-diff-to-markdown

- name: Update lockfiles
run: |
set -o pipefail
pixi update --json | pixi exec pixi-diff-to-markdown >> diff.md
- name: Create pull request
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update pixi lockfile
title: Update pixi lockfile
body-path: diff.md
branch: update-pixi
base: main
labels: pixi
delete-branch: true
add-paths: pixi.lock
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ tramp
#build
/build/
*.user
.build
.pixi
9 changes: 1 addition & 8 deletions cmake/AddOsqpEigenUnitTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,6 @@ if (OSQPEIGEN_RUN_Valgrind_tests)
separate_arguments(MEMCHECK_COMMAND_COMPLETE)
endif()

if (OSQPEIGEN_COMPILE_tests)
configure_file(cmake/Catch2Main.cpp.in ${CMAKE_BINARY_DIR}/Testing/Catch2Main.cpp)
add_library(CatchTestMain ${CMAKE_BINARY_DIR}/Testing/Catch2Main.cpp)
target_link_libraries(CatchTestMain PUBLIC Catch2::Catch2)
endif()


function(add_osqpeigen_test)

if(OSQPEIGEN_COMPILE_tests)
Expand All @@ -57,7 +50,7 @@ function(add_osqpeigen_test)
add_executable(${targetname}
"${unit_test_files}")

target_link_libraries(${targetname} PRIVATE CatchTestMain ${${prefix}_LINKS})
target_link_libraries(${targetname} PRIVATE Catch2::Catch2WithMain ${${prefix}_LINKS})
target_compile_definitions(${targetname} PRIVATE CATCH_CONFIG_FAST_COMPILE CATCH_CONFIG_DISABLE_MATCHERS)
target_compile_features(${targetname} PUBLIC cxx_std_14)

Expand Down
9 changes: 0 additions & 9 deletions cmake/Catch2Main.cpp.in

This file was deleted.

2 changes: 1 addition & 1 deletion cmake/OsqpEigenDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ endif()

#---------------------------------------------
## Optional Dependencies
find_package(Catch2 QUIET)
find_package(Catch2 3.0.1 QUIET)
checkandset_optional_dependency(Catch2)

find_package(VALGRIND QUIET)
Expand Down
Loading

0 comments on commit db34a00

Please sign in to comment.