Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: use pixi in CI #66

Merged
merged 4 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
henryiii marked this conversation as resolved.
Show resolved Hide resolved
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,249 changes: 3,249 additions & 0 deletions pixi.lock

Large diffs are not rendered by default.

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

[dependencies]
python = ">=3.7"

# Build dependencies
cmake = "*"
cxx-compiler = "*"
ninja = "*"
# Host dependencies
nlohmann_json = "*"
pybind11 = "*"

[tasks.test]
cmd = "./build/test/test_pybind11_json"
depends_on = ["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/"]

[target.win-64.tasks.configure]
cmd = [
"cmake",
"-GNinja",
"-S.",
"-Bbuild",
"-Dgtest_force_shared_crt=ON",
"-DDOWNLOAD_GTEST=ON",
"-DCMAKE_INSTALL_LIBDIR=Library",
"-DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX",
]


[tasks.build]
cmd = ["cmake", "--build", "build"]
depends_on = ["configure"]
inputs = [
"CMakeLists.txt",
"src/*"
]
outputs = [
"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