-
Notifications
You must be signed in to change notification settings - Fork 173
158 lines (130 loc) · 4.6 KB
/
ci-autotools.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
name: CI autotools
on:
push:
pull_request:
defaults:
run:
shell: bash
jobs:
build-and-test:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
# When set to true, GitHub cancels
# all in-progress jobs if any matrix job fails.
fail-fast: false
matrix:
include:
- name: linux-gcc-intree
os: ubuntu-latest
- name: linux-gcc-ootree
os: ubuntu-latest
# macOS
- name: macos-clang-intree
os: macos-latest
- name: macos-clang-ootree
os: macos-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup apt cache (Linux)
if: startsWith(runner.os, 'Linux')
uses: actions/cache@v4
with:
path: /var/cache/apt
key: ${{ runner.os }}-apt-cache-${{ matrix.os }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-apt-cache-${{ matrix.os }}-
${{ runner.os }}-apt-cache-
- name: Setup Common Prerequisites
run: |
case ${{ runner.os }} in
Linux*)
sudo apt update
sudo apt install autoconf automake libtool bison
;;
macOS*)
sudo xcode-select -switch /Applications/Xcode.app
echo "SDKROOT=$(xcodebuild -version -sdk macosx Path)" >> $GITHUB_ENV
echo "$(xcodebuild -version -sdk macosx Path)" >> $GITHUB_PATH
brew install autoconf automake libtool bison coreutils
# bison is not activated by default to avoid clobbering
# already present outdated system bison. Let's prepend
# brew's path.
echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH
;;
esac
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.x
architecture: x64
- name: Install Python Dependencies
run: |
python -m pip install --upgrade pip
python -m pip install docutils pygments
- name: Generate ./configure
run: ./autogen.sh
- name: Fast Configure
run: |
./configure \
--disable-golang \
--disable-rust \
--prefix=$PWD/install
- name: Fast Build
run: make -j$(nproc)
- name: Fast Install
run: make -j$(nproc) install
- name: Fast Clean
run: make -j$(nproc) distclean
- name: Minimal Install Test
working-directory: ./install/bin
run: ./re2c --version
- name: Get build dir
id: build-info
run: |
if echo "${{ matrix.name }}" | grep -q "ootree"; then
BUILD_DIR="$(pwd)/.build/${{ matrix.name }}-full"
mkdir -p "$BUILD_DIR"
else
BUILD_DIR="$(pwd)"
fi
echo "BUILD_DIR=$BUILD_DIR" >> $GITHUB_OUTPUT
- name: Full Configure
working-directory: ${{ steps.build-info.outputs.BUILD_DIR }}
run: |
$GITHUB_WORKSPACE/configure \
--prefix=$PWD/full-install \
--enable-libs \
--enable-parsers \
--enable-lexers \
--enable-docs \
--enable-debug \
RE2C_FOR_BUILD=$GITHUB_WORKSPACE/install/bin/re2c
- name: Full Build
working-directory: ${{ steps.build-info.outputs.BUILD_DIR }}
run: |
find $GITHUB_WORKSPACE/src -name '*.re' | xargs touch
make -j$(nproc)
- name: Run Main Test Suite
working-directory: ${{ steps.build-info.outputs.BUILD_DIR }}
run: bash -c "ulimit -s 256; make check -j$(nproc)"
- name: Run Skeleton Tests
working-directory: ${{ steps.build-info.outputs.BUILD_DIR }}
run: python run_tests.py --skeleton
- name: Full Install
working-directory: ${{ steps.build-info.outputs.BUILD_DIR }}
run: make -j$(nproc) install
- name: Archive test artifacts
# Run this step only if tests failed (otherwise there is nothing to upload).
if: failure()
uses: actions/upload-artifact@v4
with:
# To ensure that jobs don't overwrite existing artifacts,
# use a different name per job.
name: test-${{ matrix.name }}
# Tests run in a temporary directory that has a name test_<timestamp>.
path: ${{ steps.build-info.outputs.BUILD_DIR }}/test_[0-9]*
# Artifacts are retained for 90 days by default.
# In fact, we don't need such long period.
retention-days: 30