Skip to content

Commit

Permalink
ci: use pixi in CI
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <[email protected]>
  • Loading branch information
henryiii committed Mar 27, 2024
1 parent 0036b4a commit 10b2d09
Show file tree
Hide file tree
Showing 8 changed files with 3,381 additions and 72 deletions.
66 changes: 9 additions & 57 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,66 +20,18 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.7", "3.8", "3.9", "3.10"]
python-version: ["3.7", "3.9", "3.11", "3.12"]

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4

- name: Install mamba
uses: mamba-org/provision-with-micromamba@main
- uses: prefix-dev/[email protected]
with:
environment-file: dev-environment.yml
environment-name: pybind11_json
micromamba-version: "0.22.0"
extra-specs: python=${{ matrix.python-version }}*=*_cpython
pixi-version: v0.17.1
cache: false

- name: Make build directory
run: mkdir build
- name: Run build
run: pixi run build

- name: Micromamba shell hook
if: matrix.os == 'windows-latest'
shell: powershell
run: |
micromamba shell hook -s cmd.exe -p C:\Users\runneradmin\micromamba-root
- name: Unix, install
if: matrix.os != 'windows-latest'
run: |
micromamba activate pybind11_json
cmake .. \
-D CMAKE_INSTALL_PREFIX=$CONDA_PREFIX \
-D DOWNLOAD_GTEST=ON \
-D PYTHON_EXECUTABLE=`which python` \
-D CMAKE_INSTALL_LIBDIR=lib
make install -j2
working-directory: build

- name: Windows, install
if: matrix.os == 'windows-latest'
shell: cmd
run: |
call C:\Users\runneradmin\micromamba-root\condabin\micromamba.bat activate pybind11_json
cmake .. ^
-G Ninja ^
-D CMAKE_INSTALL_PREFIX="%CONDA_PREFIX%\Library" ^
-D DOWNLOAD_GTEST=ON ^
-D gtest_force_shared_crt=ON ^
-D CMAKE_CXX_FLAGS=/D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING
ninja install
working-directory: build

- name: Unix, Run tests
if: matrix.os != 'windows-latest'
run: |
micromamba activate pybind11_json
./test_pybind11_json
working-directory: build/test

- name: Windows, Run tests
if: matrix.os == 'windows-latest'
shell: cmd
run: |
call C:\Users\runneradmin\micromamba-root\condabin\micromamba.bat activate pybind11_json
set PYTHONHOME=%CONDA_PREFIX%
test_pybind11_json
working-directory: build/test
- name: Run tests
run: pixi run test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
build/*
.pixi
11 changes: 0 additions & 11 deletions dev-environment.yml

This file was deleted.

3,319 changes: 3,319 additions & 0 deletions pixi.lock

Large diffs are not rendered by default.

48 changes: 48 additions & 0 deletions pixi.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
[project]
name = "pybind11_json"
channels = ["conda-forge"]
platforms = ["win-64", "linux-64", "osx-64", "osx-arm64"]

[dependencies]
python = ">=3.7"

[tasks.test]
cmd = "./build/test/test_pybind11_json"
depends_on = ["build"]


[feature.build.dependencies]
# Build dependencies
cmake = "*"
cxx-compiler = "*"
ninja = "*"
# Host dependencies
nlohmann_json = "*"
pybind11 = "*"

[feature.build.tasks.configure]
cmd = [
"cmake",
"-GNinja",
"-S.",
"-Bbuild",
"-DDOWNLOAD_GTEST=ON",
"-DCMAKE_INSTALL_LIBDIR=lib",
"-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX",
]
inputs = ["CMakeLists.txt"]
outputs = ["build/CMakeFiles/"]

[feature.build.tasks.build]
cmd = ["cmake", "--build", "build"]
depends_on = ["configure"]
inputs = [
"CMakeLists.txt",
"src/*"
]
outputs = [
"build/"
]

[environments]
build = ["build"]
2 changes: 1 addition & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# The full license is in the file LICENSE, distributed with this software. #
############################################################################

cmake_minimum_required(VERSION 3.4.3)
cmake_minimum_required(VERSION 3.5)

if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
project(pybind11_json-test)
Expand Down
2 changes: 1 addition & 1 deletion test/copyGTest.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# The full license is in the file LICENSE, distributed with this software. #
############################################################################

cmake_minimum_required(VERSION 2.8.2)
cmake_minimum_required(VERSION 3.5)

project(googletest-download NONE)

Expand Down
4 changes: 2 additions & 2 deletions test/downloadGTest.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
# The full license is in the file LICENSE, distributed with this software. #
############################################################################

cmake_minimum_required(VERSION 2.8.2)
cmake_minimum_required(VERSION 3.5)

project(googletest-download NONE)

include(ExternalProject)
ExternalProject_Add(googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.8.0
GIT_TAG release-1.12.1
SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-src"
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-build"
CONFIGURE_COMMAND ""
Expand Down

0 comments on commit 10b2d09

Please sign in to comment.