-
Notifications
You must be signed in to change notification settings - Fork 167
134 lines (114 loc) · 4.15 KB
/
ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: CI
on:
push:
branches:
- master
tags:
- '*'
pull_request:
branches:
- master
jobs:
cpp_edlib:
name: "Check that CPP edlib correctly builds and passes tests."
strategy:
matrix:
include:
# If you add another compiler, make sure to define its CC and CXX env vars in the step below.
- { os: ubuntu-20.04, compiler: gcc-10 }
- { os: ubuntu-20.04, compiler: clang-11 }
- { os: macos-12, compiler: gcc-10 }
- { os: macos-12, compiler: clang-11 }
- { os: ubuntu-22.04, compiler: gcc-11 }
- { os: ubuntu-22.04, compiler: clang-15 }
- { os: macos-14, compiler: gcc-11 }
- { os: macos-14, compiler: clang-15 }
runs-on: ${{ matrix.os }}
continue-on-error: true
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install system dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y ${{ matrix.compiler.package }} valgrind
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install Python packages
run: |
python3 -m pip install --upgrade pip setuptools meson ninja
- name: Set C/CPP compiler to use
run: |
if [[ "${{ matrix.compiler }}" == "gcc-10" ]]; then export CC=gcc-10 CXX=g++-10; fi
if [[ "${{ matrix.compiler }}" == "gcc-11" ]]; then export CC=gcc-11 CXX=g++-11; fi
if [[ "${{ matrix.compiler }}" == "clang-11" ]]; then export CC=clang-11 CXX=clang++-11; fi
if [[ "${{ matrix.compiler }}" == "clang-15" ]]; then export CC=clang-15 CXX=clang++-15; fi
- name: Build binaries and libraries and test them (with Meson)
run: |
make CXXFLAGS="-Werror" LIBRARY_TYPE=static BUILD_DIR=meson-build-static
make CXXFLAGS="-Werror" LIBRARY_TYPE=shared BUILD_DIR=meson-build-shared
# Check for memory leaks.
# I run this only on linux because osx returns errors from
# system libraries, which I would have to supress.
if [ ${{ runner.os }} == "Linux" ]; then
make check-memory-leaks BUILD_DIR=meson-build-static
fi
- name: Build binaries and libraries and test them (with CMake)
run: |
mkdir -p build && cd build
CXXFLAGS="-Werror" cmake -GNinja ..
ninja -v
bin/runTests
# TODO: I should have this step produce artifacts (wheels and sdist), but not deploy them.
# Then, I should have another step that deploys them, therefore not deploying unless all jobs pass,
# making sure we don't deploy only half of the wheels.
python_edlib:
name: "Build, test and possibly deploy python bindings for edlib"
strategy:
matrix:
include:
- os: ubuntu-20.04
deploy-sdist: true
- os: macos-12
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: bindings/python
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install Python deps
run: |
python3 -m pip install setuptools
- name: Build edlib python module
run: |
make build
- name: Test edlib python module
run: |
python3 test.py
- name: Build sdist
run: |
make sdist
- name: Build wheels
run: |
make wheels
- name: Deploy sdist and Linux and Mac wheels to PyPI
if: github.ref_type == 'tag'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
python3 -m pip install twine
python3 -m twine upload wheelhouse/*.whl
# While I do want to upload wheels for both Mac and Linux,
# it makes no sense to upload sdist twice.
if [ ${{ matrix.deploy-sdist }} == "true" ]; then
python3 -m twine upload dist/edlib-*.tar.gz
fi