-
Notifications
You must be signed in to change notification settings - Fork 243
111 lines (98 loc) · 3.62 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
name: CI
on:
pull_request:
push:
branches:
- master
jobs:
build:
name: ${{matrix.name}}
runs-on: ${{matrix.os}}
container: ${{matrix.container}}
env:
CC: ${{matrix.cc}}
CXX: ${{matrix.cxx}}
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
include:
- name: gcc-6
cc: gcc-6
cxx: g++-6
os: ubuntu-latest
container: ubuntu:18.04
- name: gcc-13
cc: gcc-13
cxx: g++-13
os: ubuntu-latest
container: ubuntu:24.04
# We need relaxed builds for debug mode with current GCC versions, see #218.
build_options: "relaxed_build=on"
- name: clang-18
cc: clang-18
cxx: clang++-18
os: ubuntu-latest
container: ubuntu:24.04
- name: clang-macOS
cc: clang
cxx: clang++
os: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
if: matrix.name != 'gcc-6'
- name: Checkout (Ubuntu 18.04)
if: matrix.name == 'gcc-6'
# Recent versions of Github's checkout action do not run on older Ubuntu versions because they use a too recent
# Node.js version. Thus, we have to checkout the code manually.
# Doing so is a bit tricky when it comes to PRs from forks (see #249 for details). The general idea here is that
# we access Github's context information for the event triggering the action's execution and use some details on
# the PR's HEAD if given. Otherwise (for executions due to master updates), we still use the provided
# environment variables.
run: |
apt-get update
apt-get install -y git
git config --global --add safe.directory '*'
git clone $(awk -v a=${{github.event.pull_request.head.repo.clone_url}} -v b="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}" 'BEGIN { if (a == "") { print b } else { print a } }') .
git checkout $GITHUB_HEAD_REF
- name: Setup (macOS)
if: matrix.name == 'clang-macOS'
run: |
brew install bison flex
echo "BISON=$(brew --prefix bison)/bin/bison" >> $GITHUB_ENV
echo "FLEX=$(brew --prefix flex)/bin/flex" >> $GITHUB_ENV
- name: Setup (Ubuntu)
if: matrix.name != 'clang-macOS'
run: |
apt-get update
apt-get install --no-install-recommends -y bison flex ${CC} ${CXX} make valgrind
echo "BISON=bison" >> $GITHUB_ENV
echo "FLEX=flex" >> $GITHUB_ENV
- name: System Information
run: |
awk -v a=$(uname) 'BEGIN { a == "Linux" ? system("cat /etc/issue") : system("sw_vers") }'
${CC} --version
${CXX} --version
${BISON} --version
${FLEX} --version
awk -v a=$(uname) 'BEGIN { if (a == "Linux") system("valgrind --version") }'
- name: Build Parser
run: |
make -j $(nproc)
BISON=${BISON} FLEX=${FLEX} make test
make test_example
- name: Build Parser and Lexer from Scratch
run: |
BISON=${BISON} FLEX=${FLEX} make cleanall
BISON=${BISON} FLEX=${FLEX} make -j $(nproc)
BISON=${BISON} FLEX=${FLEX} make test
make test_example
- name: Build Parser and Lexer from Scratch (Debug)
run: |
BISON=${BISON} FLEX=${FLEX} make cleanall
BISON=${BISON} FLEX=${FLEX} make -j $(nproc) mode=debug ${{matrix.build_options}}
BISON=${BISON} FLEX=${FLEX} make test
make test_example