forked from SpamapS/gearmand
-
Notifications
You must be signed in to change notification settings - Fork 138
151 lines (145 loc) · 6.29 KB
/
ci.yml
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: GitHub Actions CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
container: ${{ matrix.config.container }}
strategy:
fail-fast: false
matrix:
config:
- {name: 'ubuntu-14.04 gcc-4.8', os: ubuntu-latest, container: 'ubuntu:14.04', cc: 'gcc-4.8', cxx: 'g++-4.8', tag: '4.8', toolchain: 'ppa:ubuntu-toolchain-r/test'}
- {name: 'ubuntu-14.04 gcc-4.9', os: ubuntu-latest, container: 'ubuntu:14.04', cc: 'gcc-4.9', cxx: 'g++-4.9', tag: '4.9', toolchain: 'ppa:ubuntu-toolchain-r/test'}
- {name: 'ubuntu-18.04 gcc-5', os: ubuntu-latest, container: 'ubuntu:18.04', cc: 'gcc-5', cxx: 'g++-5', tag: '5'}
- {name: 'ubuntu-18.04 gcc-6', os: ubuntu-latest, container: 'ubuntu:18.04', cc: 'gcc-6', cxx: 'g++-6', tag: '6'}
- {name: 'ubuntu-18.04 gcc-7', os: ubuntu-latest, container: 'ubuntu:18.04', cc: 'gcc-7', cxx: 'g++-7', tag: '7'}
- {name: 'ubuntu-18.04 gcc-8', os: ubuntu-latest, container: 'ubuntu:18.04', cc: 'gcc-8', cxx: 'g++-8', tag: '8'}
- {name: 'ubuntu-20.04 gcc-9', os: ubuntu-20.04, cc: 'gcc-9', cxx: 'g++-9', tag: '9'}
- {name: 'ubuntu-20.04 gcc-10', os: ubuntu-20.04, cc: 'gcc-10', cxx: 'g++-10', tag: '10'}
- {name: 'ubuntu-20.04 gcc-11', os: ubuntu-20.04, cc: 'gcc-11', cxx: 'g++-11', tag: '11'}
- {name: 'ubuntu-22.04 gcc-12', os: ubuntu-22.04, cc: 'gcc-12', cxx: 'g++-12', tag: '12'}
env:
CC: ${{ matrix.config.cc }}
CXX: ${{ matrix.config.cxx }}
CCVERSION: ${{ matrix.config.tag }}
GHA_CONTAINER: ${{ matrix.config.container }}
GHA_CONFIG_NAME: ${{ matrix.config.name }}
steps:
- name: if running in a container, update and install sudo, git, and other basics
if: matrix.config.container != ''
run: |
case "${GHA_CONTAINER}" in
ubuntu*)
apt-get -o Acquire::Retries=3 update && DEBIAN_FRONTEND=noninteractive apt-get -o Acquire::Retries=3 -y install tzdata sudo apt-transport-https make apt-file software-properties-common libssl-dev build-essential autotools-dev autoconf automake pkgconf iproute2
sudo apt-add-repository ppa:git-core/ppa
sudo apt-get -o Acquire::Retries=3 update && apt-get -o Acquire::Retries=3 -y install git
;;
*)
;;
esac
- name: override DNS to fix IP address for hostname in some Docker containers
if: matrix.config.container != ''
run: |
case "${GHA_CONTAINER}" in
ubuntu*)
echo "==="
echo "Before: /etc/hosts"
cat /etc/hosts
echo "==="
echo "Removing localhost name from ::1 entry in /etc/hosts..."
sed 's/^::1\s\s*localhost\s\(.*\)/::1 \1/' /etc/hosts > /tmp/hosts.temp
cp /tmp/hosts.temp /etc/hosts
rm /tmp/hosts.temp
echo "After: /etc/hosts"
cat /etc/hosts
echo "==="
ip addr
echo "==="
echo "'hostname -i' shows '$(hostname -i)'"
echo "'hostname -I' shows '$(hostname -I)'"
echo "'hostname -s' shows '$(hostname -s)'"
echo "'hostname -f' shows '$(hostname -f)'"
;;
*)
;;
esac
- name: configure toolchain (optional)
if: matrix.config.toolchain != ''
run: |
sudo apt-add-repository ${{ matrix.config.toolchain }}
sudo apt-get update
sudo apt-get -y install libtool
- uses: actions/checkout@v3
- name: set ownership of git repository in Docker containers
if: matrix.config.container != ''
run: |
chown -R $(id -u):$(id -g) .
- name: tweak multi_client_test.cc for container usage
if: matrix.config.container != ''
run: |
case "${GHA_CONTAINER}" in
ubuntu*)
echo "==="
echo "Before multi_client_test.cc:"
grep push_port tests/libgearman-1.0/multi_client_test.cc
echo "Changing multi_client_test.cc..."
sed -i -e '0,/test->push_port.*libtest/ s/\(test.*push_port(\).*libtest.*\();\)/\1 19298 \2/' tests/libgearman-1.0/multi_client_test.cc
sed -i -e '0,/test->push_port.*libtest/ s/\(test.*push_port(\).*libtest.*\();\)/\1 19300 \2/' tests/libgearman-1.0/multi_client_test.cc
echo "After multi_client_test.cc:"
grep push_port tests/libgearman-1.0/multi_client_test.cc
echo "==="
;;
*)
;;
esac
- name: install dependencies
run: |
case "${GHA_CONFIG_NAME}" in
ubuntu*)
sudo apt-get update && sudo apt-get -o Acquire::Retries=3 install -y libboost-all-dev gperf libevent-dev uuid-dev sphinx-doc sphinx-common libhiredis-dev ${{ matrix.config.cc }} ${{ matrix.config.cxx }}
;;
*)
;;
esac
- name: bootstrap
run: |
if [ -n "$GHA_CONTAINER" ]; then
echo "container: $GHA_CONTAINER"
fi
if [ -f "/etc/lsb-release" ]; then
cat /etc/lsb-release
fi
./bootstrap.sh -a
- name: configure
run: |
if [[ "${CC}" == gcc* ]] && [ "${CCVERSION}" -ge 9 ]; then
CXXFLAGS="-Wp,-D_GLIBCXX_ASSERTIONS"
export CXXFLAGS
echo "CXXFLAGS: $CXXFLAGS"
fi
./configure --enable-ssl
shell: bash
- name: make
run: |
if [[ "${CC}" == gcc* ]] && [ "${CCVERSION}" -ge 9 ]; then
CXXFLAGS="-Wp,-D_GLIBCXX_ASSERTIONS"
export CXXFLAGS
echo "CXXFLAGS: $CXXFLAGS"
fi
${CC} --version && make
shell: bash
- name: make test
run: ${CC} --version && make test
- name: check test-suite.log
if: success() || failure()
run: |
if [ -f "./test-suite.log" ]; then
cat ./test-suite.log
else
echo "No test-suite.log file found."
fi