blob: 705c753fb8e1729d38908a2347fa6e0ac653a48b (
plain)
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
|
name: CI
on:
push:
branches: master
paths-ignore:
- 'CHANGES*'
- 'Doc/**'
pull_request:
branches: master
paths-ignore:
- 'CHANGES*'
- 'Doc/**'
jobs:
build:
runs-on: ${{ matrix.os || 'ubuntu-20.04' }}
# By default, the name of the build is just the language used, but matrix
# entries can define the additional "desc" field with any additional
# information to include in the name.
name: ${{ matrix.SWIGLANG || 'none' }}${{ matrix.PY3 }} ${{ matrix.desc }}
strategy:
matrix:
# other variables to optionally set
# CC, GCC (used as suffix)
# CPP11, CPP14, CPP17
# CONFIGOPTS
# SWIGLANG
# PY3,VER
# SWIG_FEATURES
include:
- CPP11: 1
SWIGLANG: ""
- CPP11: 1
SWIGLANG: python
- CPP11: 1
SWIGLANG: python
PY3: 3
- CPP11: 1
SWIGLANG: tcl
# let's run all of them, as opposed to aborting when one fails
fail-fast: false
env:
SWIGLANG: ${{ matrix.SWIGLANG }}
SWIG_FEATURES: ${{ matrix.SWIG_FEATURES }}
CONFIGOPTS: ${{ matrix.CONFIGOPTS }}
CC: ${{ matrix.CC }}
CSTD: ${{ matrix.CSTD }}
CPP11: ${{ matrix.CPP11 }}
CPP14: ${{ matrix.CPP14 }}
CPP17: ${{ matrix.CPP17 }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Install CCache
uses: hendrikmuhs/ccache-action@v1
with:
key: ${{ matrix.os || 'ubuntu-20.04' }}-${{ matrix.SWIGLANG }}
- name: Configure
run: |
set -x
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
echo PATH="$PATH" >> $GITHUB_ENV
source Tools/GHA-linux-install.sh
if test -n "$CPP11"; then CONFIGOPTS+=(--enable-cpp11-testing "CXXFLAGS=-std=c++11 $CXXFLAGS" "CFLAGS=-std=c11 $CFLAGS") && export CSTD=c11 && export CPPSTD=c++11; fi
if test -n "$CPP14"; then CONFIGOPTS+=(--enable-cpp11-testing "CXXFLAGS=-std=c++14 $CXXFLAGS" "CFLAGS=-std=c11 $CFLAGS") && export CSTD=c11 && export CPPSTD=c++14; fi
if test -n "$CPP17"; then CONFIGOPTS+=(--enable-cpp11-testing "CXXFLAGS=-std=c++17 $CXXFLAGS" "CFLAGS=-std=c17 $CFLAGS") && export CSTD=c17 && export CPPSTD=c++17; fi
if test -n "$SWIGLANG"; then CONFIGOPTS+=(--without-alllang --with-$WITHLANG); fi
echo "${CONFIGOPTS[@]}"
./autogen.sh && mkdir -p build/build && cd build/build && ../../configure "${CONFIGOPTS[@]}"
case $(uname) in
Linux)
cpu_count=$(nproc)
;;
Darwin)
cpu_count=$(sysctl -n hw.ncpu)
;;
*)
cpu_count=0
;;
esac
((cpu_count++))
echo SWIGJOBS=-j$cpu_count >> $GITHUB_ENV
- name: Build
working-directory: build/build
run: |
set -x
make $SWIGJOBS
./swig -version && ./swig -pcreversion
if test -z "$SWIGLANG"; then make $SWIGJOBS check-ccache; fi
if test -z "$SWIGLANG"; then make $SWIGJOBS check-errors-test-suite; fi
echo 'Installing...'
if test -z "$SWIGLANG"; then sudo make install && swig -version && ccache-swig -V; fi
- name: Test
working-directory: build/build
run: |
set -x
if test -n "$CPP11"; then export CPPSTD=c++11; fi
if test -n "$CPP14"; then export CPPSTD=c++14; fi
if test -n "$CPP17"; then export CPPSTD=c++17; fi
# Stricter compile flags for examples. Various headers and SWIG generated code prevents full use of -pedantic.
if test -n "$SWIGLANG"; then cflags=$($GITHUB_WORKSPACE/Tools/testflags.py --language $SWIGLANG --cflags --std=$CSTD --compiler=$CC) && echo $cflags; fi
if test -n "$SWIGLANG"; then cxxflags=$($GITHUB_WORKSPACE/Tools/testflags.py --language $SWIGLANG --cxxflags --std=$CPPSTD --compiler=$CC) && echo $cxxflags; fi
if test -n "$SWIGLANG"; then make check-$SWIGLANG-version; fi
if test -n "$SWIGLANG"; then make check-$SWIGLANG-enabled; fi
if test -n "$SWIGLANG"; then make $SWIGJOBS check-$SWIGLANG-examples CFLAGS="$cflags" CXXFLAGS="$cxxflags"; fi
if test -n "$SWIGLANG"; then make $SWIGJOBS check-$SWIGLANG-test-suite CFLAGS="$cflags" CXXFLAGS="$cxxflags"; fi
- name: Clean
working-directory: build/build
run: |
set -x
make check-maintainer-clean && ../../configure $CONFIGOPTS
|