8000 Added linux CI with GHA · xtensor-stack/xtensor-python@d212bc3 · GitHub
[go: up one dir, main page]

Skip to content

Commit d212bc3

Browse files
committed
Added linux CI with GHA
1 parent 88734bd commit d212bc3

File tree

3 files changed

+111
-8
lines changed

3 files changed

+111
-8
lines changed

.github/workflows/linux.yml

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

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)
0