-
-
Notifications
You must be signed in to change notification settings - Fork 195
228 lines (222 loc) · 8.73 KB
/
continuous-integration.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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
#-----------------------------------------------------------------------------
#
# TSDuck - The MPEG Transport Stream Toolkit
# Copyright (c) 2005-2024, Thierry Lelegard
# BSD-2-Clause license, see LICENSE.txt file or https://tsduck.io/license
#
# GitHub Actions configuration file : Continuous Integration
#
# The workflow is triggered on push or pull request, for master branch only.
# Manual dispatch from the GitHub UI is also allowed.
#
# TSDuck is built on Ubuntu, macOS and Windows, using C++17 and C++20 levels
# of standards. The doxygen documentation is also generated to verify that
# no documentation is missing.
#
# Testing strategy: The low-level unitary tests and the high-level test suite
# are run on all builds. The high-level test suite is in a separate repo
# named tsduck-test. The tests must use the appropriate tsduck-test repo for
# the current workflow. It may not be appropriate to use tsduck/tsduck-test,
# for instance when the current commit or pull request added new features
# or legitimately modified the test reference output. Some effort is made
# to locate the "right" tsduck-test repo:
#
# - First, the "origin" repo is located. This can be:
# . tsduck/tsduck when directly pushing here.
# . USER/tsduck when a user pushes on its forked repo USER/tsduck.
# . USER/tsduck when a user submits a pull request to tsduck/tsduck.
# - Then we try to grab the test suite from repo "origin"-test, meaning
# either tsduck/tsduck-test or USER/tsduck-test.
# - If this repo does not exist, we grab the "reference" repo from
# tsduck/tsduck-test
#
#-----------------------------------------------------------------------------
name: Continuous integration
on:
push:
branches: [master, main]
pull_request:
branches: [master, main]
workflow_dispatch:
jobs:
build_unix:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
compiler: [gcc, clang]
std: [17, 20]
include:
- os: ubuntu-latest
compiler: clang
llvm: true
- os: macos-latest
# It has been noted on GitHub macOS runners that the host name can change
# between steps or even the middle of a step. This breaks the naming scheme
# of the build directory for binaries. As a consequence, we force BINDIR=bin.
bindir: bin
exclude:
- os: macos-latest
compiler: gcc
# Don't use gcc on macOS.
name: Build on ${{ matrix.os }} with ${{ matrix.compiler }}, C++${{ matrix.std }}
runs-on: ${{ matrix.os }}
env:
LLVM: ${{ matrix.llvm }}
BINDIR: ${{ matrix.bindir }}
CXXFLAGS_STANDARD: -std=c++${{ matrix.std }}
ORIGIN_REPO: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
REFERENCE_REPO: tsduck/tsduck
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@master
- name: Install dependencies
run: |
scripts/install-prerequisites.sh
${{ matrix.compiler }} --version
scripts/java-config.sh
- name: Build TSDuck
run: make -j5
- name: Check built version
run: make show-version
- name: Run unitary tests
run: make test
- name: Download test suite
run: |
# Try to download '<repo>-test' from the pull request owner, if there is one.
if curl -fsL "https://github.com/${ORIGIN_REPO}-test/tarball/${BRANCH_NAME}" -o test.tgz; then
echo "Downloaded test suite from ${BRANCH_NAME} branch of $ORIGIN_REPO"
elif curl -fsL "https://github.com/${ORIGIN_REPO}-test/tarball/master" -o test.tgz; then
echo "Downloaded test suite from $ORIGIN_REPO"
else
curl -fsL "https://github.com/${REFERENCE_REPO}-test/tarball/master" -o test.tgz
echo "Downloaded test suite from $REFERENCE_REPO"
fi
mkdir -p ../tsduck-test
tar -C ../tsduck-test -x -z -f test.tgz --strip 1
- name: Run test suite
run: |
make test-suite && status=$? || status=$?
cd ../tsduck-test
for f in $(find tmp -name '*.diff'); do
echo "==== $f";
cat "$f"
done
exit $status
- name: Build sample applications
run: |
# Fake installation in a temporary directory.
export PREFIX=$(pwd)/bin/systest
make install SYSPREFIX=$PREFIX
# Build the test applications using that installation.
export PATH=$PREFIX/bin:$PATH:
export LD_LIBRARY_PATH=$PREFIX/lib:$LD_LIBRARY_PATH:
export LD_LIBRARY_PATH2=$LD_LIBRARY_PATH
export PYTHONPATH=$PREFIX/share/tsduck/python:$PYTHONPATH:
export CLASSPATH=$PREFIX/share/tsduck/java/tsduck.jar:$CLASSPATH:
make -C sample
build_windows:
strategy:
fail-fast: false
matrix:
target: [Win64, Win32]
configuration: [Release]
std: [17, 20]
include:
- target: Win64
suffix: x64
testopt: --dev
- target: Win32
suffix: Win32
testopt: --dev32
exclude:
- target: Win32
std: 20
name: Build on ${{ matrix.target }} with VC++, C++${{ matrix.std }}
runs-on: windows-latest
env:
STDCPP: stdcpp${{ matrix.std }}
ORIGIN_REPO: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
REFERENCE_REPO: tsduck/tsduck
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Workaround for GitHub runner issue (runner version 2.317.0, image version 20240603.1.0)
DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR: true
steps:
- uses: actions/checkout@master
- name: Install dependencies
run: |
scripts/install-prerequisites.ps1 -GitHubActions -NoDoxygen -NoInstaller -NoPause
- name: Dependencies check
run: |
Write-Output "Path=${env:Path}"
python --version
- name: Build TSDuck
run: |
scripts/build.ps1 -${{ matrix.target }} -${{ matrix.configuration }} -Parallel 5 -NoLowPriority -NoPause
Get-ChildItem bin/${{ matrix.configuration }}-${{ matrix.suffix }}
- name: Check built version
run: |
bin/${{ matrix.configuration }}-${{ matrix.suffix }}/tsversion.exe --version=all
- name: Check plugins list
run: |
bin/${{ matrix.configuration }}-${{ matrix.suffix }}/tsp.exe --list
- name: Run unitary tests
run: |
bin/${{ matrix.configuration }}-${{ matrix.suffix }}/utests-tsduckdll.exe
- name: Run unitary tests (static)
run: |
bin/${{ matrix.configuration }}-${{ matrix.suffix }}/utests-tsducklib.exe
- name: Download test suite
run: |
# Try to download '<repo>-test' from the pull request owner, if there is one.
$Previous = $ErrorActionPreference
$ErrorActionPreference = 'SilentlyContinue'
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -UseBasicParsing -OutFile test.zip -Uri https://github.com/${env:ORIGIN_REPO}-test/archive/${env:BRANCH_NAME}.zip
if (Test-Path test.zip) {
$ErrorActionPreference = $Previous
Write-Output "Downloaded test suite from ${env:BRANCH_NAME} branch of ${env:ORIGIN_REPO}"
}
else {
Invoke-WebRequest -UseBasicParsing -OutFile test.zip -Uri https://github.com/${env:ORIGIN_REPO}-test/archive/master.zip
$ErrorActionPreference = $Previous
if (Test-Path test.zip) {
Write-Output "Downloaded test suite from ${env:ORIGIN_REPO}"
}
else {
Invoke-WebRequest -UseBasicParsing -OutFile test.zip -Uri https://github.com/${env:REFERENCE_REPO}-test/archive/master.zip
Write-Output "Downloaded test suite from ${env:REFERENCE_REPO}"
}
}
[void] (New-Item -Type Directory -Force tmp)
Expand-Archive test.zip -DestinationPath tmp -Force
Move-Item tmp\* ..\tsduck-test -Force
- name: Run test suite
shell: bash
run: |
cd ../tsduck-test
./run-all-tests.sh ${{ matrix.testopt }} && status=$? || status=$?
for f in $(find tmp -name '*.diff'); do
echo "==== $f";
cat "$f"
done
exit $status
build_docs:
name: Build documentation
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@master
- name: Install dependencies
run: |
scripts/install-prerequisites.sh
echo "Doxygen version: $(doxygen --version)"
- name: Build guides
run: |
make docs
- name: Build Doxygen reference
run: |
make doxygen DOXYFLAGS=--update-doxygen