Skip to content

Commit de18721

Browse files
authored
Merge pull request #298 from JohanMabille/ci
Migrated CI to GHA
2 parents 88734bd + 522fbdb commit de18721

File tree

5 files changed

+239
-8
lines changed

5 files changed

+239
-8
lines changed

.github/workflows/linux.yml

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
name: Linux
2+
on:
3+
workflow_dispatch:
4+
pull_request:
5+
push:
6+
branches: [master]
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.job }}-${{ github.ref }}
9+
cancel-in-progress: true
10+
defaults:
11+
run:
12+
shell: bash -e -l {0}
13+
jobs:
14+
build:
15+
runs-on: ubuntu-20.04
16+
name: ${{ matrix.sys.compiler }} ${{ matrix.sys.version }}
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
sys:
21+
- {compiler: gcc, version: '8'}
22+
- {compiler: gcc, version: '9'}
23+
- {compiler: gcc, version: '10'}
24+
- {compiler: gcc, version: '11'}
25+
- {compiler: clang, version: '15'}
26+
- {compiler: clang, version: '16'}
27+
28+
steps:
29+
30+
- name: Setup GCC
31+
if: ${{ matrix.sys.compiler == 'gcc' }}
32+
run: |
33+
GCC_VERSION=${{ matrix.sys.version }}
34+
sudo apt-get update
35+
sudo apt-get --no-install-suggests --no-install-recommends install g++-$GCC_VERSION
36+
CC=gcc-$GCC_VERSION
37+
echo "CC=$CC" >> $GITHUB_ENV
38+
CXX=g++-$GCC_VERSION
39+
echo "CXX=$CXX" >> $GITHUB_ENV
40+
41+
- name: Setup clang
42+
if: ${{ matrix.sys.compiler == 'clang' }}
43+
run: |
44+
LLVM_VERSION=${{ matrix.sys.version }}
45+
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - || exit 1
46+
if [[ $LLVM_VERSION -ge 13 ]]; then
47+
sudo add-apt-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-$LLVM_VERSION main" || exit 1
48+
else
49+
sudo add-apt-repository "deb http://apt.llvm.org/focal/ llvm-toolchain-focal main" || exit 1
50+
fi || exit 1
51+
sudo apt-get update || exit 1
52+
sudo apt-get --no-install-suggests --no-install-recommends install clang-$LLVM_VERSION || exit 1
53+
sudo apt-get --no-install-suggests --no-install-recommends install g++-9 g++-9-multilib || exit 1
54+
sudo ln -s /usr/include/asm-generic /usr/include/asm
55+
CC=clang-$LLVM_VERSION
56+
echo "CC=$CC" >> $GITHUB_ENV
57+
CXX=clang++-$LLVM_VERSION
58+
echo "CXX=$CXX" >> $GITHUB_ENV
59+
60+
- name: Checkout code
61+
uses: actions/checkout@v3
62+
63+
- name: Set conda environment
64+
uses: mamba-org/setup-micromamba@v1
65+
with:
66+
environment-file: environment-dev.yml
67+
cache-environment: true
68+
69+
- name: Configure using CMake
70+
run: cmake -G Ninja -Bbuild -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -DPYTHON_EXECUTABLE=`which python` -DDOWNLOAD_GTEST=ON $(Build.SourcesDirectory)
71+
72+
- name: Install
73+
working-directory: build
74+
run: cmake --install .
75+
76+
- name: Build
77+
working-directory: build
78+
run: cmake --build . --target test_xtensor_python --parallel 8
79+
80+
- name: Run tests (C++)
81+
working-directory: build/test
82+
run: ./test_xtensor_python
83+
84+
- name: Run tests (Python)
85+
run: pytest -s
86+
87+
- name: Example - readme 1
88+
working-directory: docs/source/examples/readme_example_1
89+
run: |
90+
cmake -Bbuild -DPython_EXECUTABLE=`which python`
91+
cd build
92+
cmake --build .
93+
cp ../example.py .
94+
python example.py
95+
96+
- name: Example - copy \'cast\'
97+
working-directory: docs/source/examples/copy_cast
98+
run: |
99+
cmake -Bbuild -DPython_EXECUTABLE=`which python`
100+
cd build
101+
cmake --build .
102+
cp ../example.py .
103+
python example.py
104+
105+
- name: Example - SFINAE
106+
working-directory: docs/source/examples/sfinae
107+
run: |
108+
cmake -Bbuild -DPython_EXECUTABLE=`which python`
109+
cd build
110+
cmake --build .
111+
cp ../example.py .
112+
python example.py

.github/workflows/osx.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: OSX
2+
on:
3+
workflow_dispatch:
4+
pull_request:
5+
push:
6+
branches: [master]
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.job }}-${{ github.ref }}
9+
cancel-in-progress: true
10+
defaults:
11+
run:
12+
shell: bash -e -l {0}
13+
jobs:
14+
build:
15+
runs-on: macos-${{ matrix.os }}
16+
name: macos-${{ matrix.os }}
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
os:
21+
- 11
22+
- 12
23+
24+
steps:
25+
26+
- name: Checkout code
27+
uses: actions/checkout@v3
28+
29+
- name: Set conda environment
30+
uses: mamba-org/setup-micromamba@v1
31+
with:
32+
environment-file: environment-dev.yml
33+
cache-environment: true
34+
35+
- name: Configure using CMake
36+
run: cmake -G Ninja -Bbuild -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -DPYTHON_EXECUTABLE=`which python` -DDOWNLOAD_GTEST=ON $(Build.SourcesDirectory)
37+
38+
- name: Install
39+
working-directory: build
40+
run: cmake --install .
41+
42+
- name: Build
43+
working-directory: build
44+
run: cmake --build . --target test_xtensor_python --parallel 8
45+
46+
- name: Run tests (C++)
47+
working-directory: build/test
48+
run: ./test_xtensor_python
49+
50+
- name: Run tests (Python)
51+
run: pytest -s
52+
53+
- name: Example - readme 1
54+
working-directory: docs/source/examples/readme_example_1
55+
run: |
56+
cmake -Bbuild -DPython_EXECUTABLE=`which python`
57+
cd build
58+
cmake --build .
59+
cp ../example.py .
60+
python example.py
61+
62+
- name: Example - copy \'cast\'
63+
working-directory: docs/source/examples/copy_cast
64+
run: |
65+
cmake -Bbuild -DPython_EXECUTABLE=`which python`
66+
cd build
67+
cmake --build .
68+
cp ../example.py .
69+
python example.py
70+
71+
- name: Example - SFINAE
72+
working-directory: docs/source/examples/sfinae
73+
run: |
74+
cmake -Bbuild -DPython_EXECUTABLE=`which python`
75+
cd build
76+
cmake --build .
77+
cp ../example.py .
78+
python example.py

.github/workflows/windows.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Windows
2+
on:
3+
#workflow_dispatch:
4+
#pull_request:
5+
#push:
6+
# branches: [master]
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.job }}-${{ github.ref }}
9+
cancel-in-progress: true
10+
defaults:
11+
run:
12+
shell: bash -e -l {0}
13+
jobs:
14+
build:
15+
runs-on: [windows-latest]
16+
name: Windows
17+
18+
steps:
19+
20+
- name: Setup MSVC
21+
uses: ilammy/msvc-dev-cmd@v1
22+
23+
- name: Checkout code
24+
uses: actions/checkout@v3
25+
26+
- name: Set conda environment
27+
uses: mamba-org/setup-micromamba@v1
28+
with:
29+
environment-file: environment-dev.yml
30+
cache-environment: true
31+
32+
- name: Configure using CMake
33+
run: cmake -G Ninja -Bbuild -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX -DPYTHON_EXECUTABLE=`which python` -DDOWNLOAD_GTEST=ON $(Build.SourcesDirectory)
34+
35+
- name: Install
36+
working-directory: build
37+
run: cmake --install .
38+
39+
- name: Build
40+
working-directory: build
41+
run: cmake --build . --target test_xtensor_python --parallel 8
42+
43+
- name: Run tests (C++)
44+
working-directory: build/test
45+
run: ./test_xtensor_python
46+
47+
- name: Run tests (Python)
48+
run: pytest -s

azure-pipelines.yml

Lines changed: 0 additions & 8 deletions
This file was deleted.

environment-dev.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ channels:
44
dependencies:
55
# Build dependencies
66
- cmake
7+
- ninja
78
# Host dependencies
89
- xtensor=0.24.0
910
- numpy

0 commit comments

Comments
 (0)