Skip to content

Commit c1206ea

Browse files
committed
Update CI
1 parent 7560a02 commit c1206ea

File tree

2 files changed

+60
-21
lines changed

2 files changed

+60
-21
lines changed

.github/workflows/main.yml

Lines changed: 50 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ on:
88
branches:
99
- master
1010

11+
defaults:
12+
run:
13+
shell: bash -l {0}
14+
1115
jobs:
1216
run:
1317
runs-on: ${{ matrix.os }}
@@ -21,36 +25,61 @@ jobs:
2125
steps:
2226
- uses: actions/checkout@v1
2327

24-
- name: Setup conda
25-
uses: s-weigand/setup-conda@v1
28+
- name: Install mamba
29+
uses: mamba-org/provision-with-micromamba@main
2630
with:
27-
update-conda: true
28-
conda-channels: conda-forge
31+
environment-file: dev-environment.yml
32+
environment-name: pybind11_json
33+
micromamba-version: "0.22.0"
34+
extra-specs: python=${{ matrix.python-version }}*=*_cpython
35+
36+
- name: Make build directory
37+
run: mkdir build
2938

30-
- name: Conda install dependencies
31-
run: conda install python=${{ matrix.python-version }}*=*_cpython cmake=3.17 nlohmann_json pybind11
39+
- name: Micromamba shell hook
40+
if: matrix.os == 'windows-latest'
41+
shell: powershell
42+
run: |
43+
micromamba shell hook -s cmd.exe -p C:\Users\runneradmin\micromamba-root
3244
3345
- name: Unix, install
3446
if: matrix.os != 'windows-latest'
3547
run: |
36-
mkdir build
37-
cd build
38-
$CONDA/bin/cmake -D CMAKE_INSTALL_PREFIX=$CONDA -D DOWNLOAD_GTEST=ON -D PYTHON_EXECUTABLE=$CONDA/bin/python -D CMAKE_INSTALL_LIBDIR=lib ..
39-
make install -j2
48+
micromamba activate pybind11_json
49+
cmake .. \
50+
-D CMAKE_INSTALL_PREFIX=$CONDA_PREFIX \
51+
-D DOWNLOAD_GTEST=ON \
52+
-D PYTHON_EXECUTABLE=`which python` \
53+
-D CMAKE_INSTALL_LIBDIR=lib
54+
make install -j2
55+
working-directory: build
4056

4157
- name: Windows, install
4258
if: matrix.os == 'windows-latest'
4359
shell: cmd
4460
run: |
45-
call "c:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
46-
mkdir build
47-
cd build
48-
%CONDA%/Library/bin/cmake -G "NMake Makefiles" -D CMAKE_INSTALL_PREFIX=%CONDA% -D DOWNLOAD_GTEST=ON -D PYTHON_EXECUTABLE=%CONDA%/python.exe -Dgtest_force_shared_crt=ON -DCMAKE_CXX_FLAGS=/D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING ..
49-
nmake install
50-
51-
- name: Run tests
52-
shell: bash
61+
call C:\Users\runneradmin\micromamba-root\condabin\micromamba.bat activate pybind11_json
62+
cmake .. ^
63+
-G "NMake Makefiles" ^
64+
-D CMAKE_INSTALL_PREFIX="%CONDA_PREFIX%\Library" ^
65+
-D DOWNLOAD_GTEST=ON ^
66+
-D gtest_force_shared_crt=ON ^
67+
-D CMAKE_CXX_FLAGS=/D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING
68+
nmake install
69+
working-directory: build
70+
71+
- name: Unix, Run tests
72+
if: matrix.os != 'windows-latest'
73+
run: |
74+
micromamba activate pybind11_json
75+
./test_pybind11_json
76+
working-directory: build/test
77+
78+
- name: Windows, Run tests
79+
if: matrix.os == 'windows-latest'
80+
shell: cmd
5381
run: |
54-
export PYTHONHOME=$CONDA
55-
cd build
56-
./test/test_pybind11_json
82+
call C:\Users\runneradmin\micromamba-root\condabin\micromamba.bat activate pybind11_json
83+
set PYTHONHOME=%CONDA_PREFIX%
84+
test_pybind11_json
85+
working-directory: build/test

dev-environment.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: pybind11_json
2+
channels:
3+
- conda-forge
4+
dependencies:
5+
# Build dependencies
6+
- cmake
7+
- cxx-compiler
8+
# Host dependencies
9+
- nlohmann_json
10+
- pybind11

0 commit comments

Comments
 (0)