-
Notifications
You must be signed in to change notification settings - Fork 0
121 lines (109 loc) · 3.87 KB
/
Ubuntu.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
# Guidance: https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions
# Compile project on Ubuntu
name: Ubuntu
on:
# Branch pushes that do not only modify other workflow files
push:
branches:
- '**'
paths:
- "**"
- "!.github/**"
- ".github/workflows/Ubuntu.yml"
# Pull requests to main, that do not only modify other workflow files
pull_request:
branches:
- 'master'
paths:
- "**"
- "!.github/**"
- ".github/workflows/Ubuntu.yml"
# Allow manual invocation.
workflow_dispatch:
defaults:
run:
shell: bash
jobs:
build:
runs-on: ${{ matrix.cxx.os }}
strategy:
fail-fast: false
# Multiplicative build matrix
# optional exclude: can be partial, include: must be specific
matrix:
cxx:
- compiler: gcc-12
os: ubuntu-22.04
- compiler: gcc-11
os: ubuntu-22.04
- compiler: gcc-10
os: ubuntu-22.04
config:
- name: "Release"
config: "Release"
- name: "Debug"
config: "Debug"
# exclude:
exclude:
# Exclude Debug for old GCC
- cxx:
compiler: gcc-11
config:
name: "Debug"
- cxx:
compiler: gcc-10
config:
name: "Debug"
# Name the job based on matrix/env options
name: "build (${{ matrix.cxx.compiler }}, ${{ matrix.config.name }}, ${{ matrix.cxx.os }})"
# Define job-wide env constants, and promote matrix elements to env constants for portable steps.
env:
# Workflow specific constants for building a specific example
# Compute the output name which should be unique within the matrix. This must be unique per build matrix/job combination
ARTIFACT_NAME_FFEA: ffea-${{ matrix.cxx.os }}-${{ matrix.cxx.compiler }}-${{ matrix.config.name }}
ARTIFACT_NAME_FFEAMB: ffea_mb-${{ matrix.cxx.os }}-${{ matrix.cxx.compiler }}-${{ matrix.config.name }}
# Define constants
BUILD_DIR: "build"
COMPILER: ${{ matrix.cxx.compiler }}
OS: ${{ matrix.cxx.os }}
CONFIG: ${{ matrix.config.config }}
# What the CI actually runs
steps:
- uses: actions/checkout@v4
- name: Install/Select gcc and g++
if: ${{ startsWith(env.COMPILER, 'gcc-') }}
run: |
gcc_version=${COMPILER//gcc-/}
sudo apt-get install -y gcc-${gcc_version} g++-${gcc_version}
echo "CC=/usr/bin/gcc-${gcc_version}" >> $GITHUB_ENV
echo "CXX=/usr/bin/g++-${gcc_version}" >> $GITHUB_ENV
# Problem matchers allow compilation warnings/errors to be highlighted on GitHub
- name: Add custom problem matchers for annotations
run: echo "::add-matcher::.github/problem-matchers.json"
- name: Configure cmake
run: >
cmake . -B "${{ env.BUILD_DIR }}"
-DCMAKE_BUILD_TYPE="${{ env.CONFIG }}"
- name: Build ffea
working-directory: ${{ env.BUILD_DIR }}
run: cmake --build . --verbose --parallel `nproc`
# Upload artifacts to the job on GHA, with a short retention
# Use a unique name per job matrix run, to avoid a risk of corruption according to the docs (although it should work with unique filenames)
- name: Upload FFEA Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME_FFEA }}
path: ${{ env.BUILD_DIR }}/src/ffea
if-no-files-found: error
retention-days: 5
- name: Upload FFEA_MB Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME_FFEAMB }}
path: ${{ env.BUILD_DIR }}/src/ffea_mb
if-no-files-found: error
retention-days: 5
- name: Run Tests (Slow Tests are Excluded)
if: ${{ env.CONFIG }} == "Release"
working-directory: ${{ env.BUILD_DIR }}
run: ctest -LE SLOW_TEST