-
Notifications
You must be signed in to change notification settings - Fork 50
159 lines (150 loc) · 5.84 KB
/
build.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
name: Unit tests
on:
push:
branches:
- master
pull_request: {}
jobs:
linux:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
cpp-standard:
- '98'
- '11'
- '20'
steps:
- uses: actions/checkout@v4
- name: install GoogleTest
run: .build/install-gtest
- name: install include-what-you-use (iwyu)
# NB: https://packages.ubuntu.com/jammy/iwyu apparently doesn't declare the `libclang-common-XXX-dev` package it
# needs as a dependency (without it, `include-what-you-use` fails with "fatal error: 'stddef.h' file not found"
# or similar), although this problem has been reported in 7 out of 7 bug reports at
# https://bugs.launchpad.net/ubuntu/+source/iwyu, the oldest being from 2014.
#
# Therefore, we deliberately require a fixed version of `iwyu` along with the compatible
# `libclang-common-XXX-dev` package. When a new version becomes available and we want to update to it, we'll
# have to change this hardcoded version manually and bump the `libclang-common-XXX-dev` version accordingly (see
# https://github.com/include-what-you-use/include-what-you-use/blob/master/README.md#clang-compatibility).
run: |
sudo apt-get update
sudo apt-get install -y iwyu=8.17-1 libclang-common-13-dev
- name: build
env:
CPP_STANDARD: ${{ matrix.cpp-standard }}
run: |
.build/build \
-DCMAKE_CXX_STANDARD="$CPP_STANDARD" -DCMAKE_CXX_STANDARD_REQUIRED=ON -DCMAKE_CXX_EXTENSIONS=OFF \
-DCMAKE_CXX_INCLUDE_WHAT_YOU_USE='include-what-you-use;-Xiwyu;--verbose=3'
- name: unittest
run: .build/run-unittest
# Builds and runs tests on Ubuntu 7.10.
# It ships with:
#
# gcc (GCC) 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)
# Copyright (C) 2006 Free Software Foundation, Inc.
#
# cmake version 2.4-patch 7
#
# This one is challenging:
#
# * It's impossible to run git clone inside this container (as old git will use ancient protocols not supported anymore
# by GitHub, and also standard `actions/checkout@v4` will depend on NodeJS/npm, which are not available in this container).
# To work around this, we start/stop container manually and use targeted execution of specific build/run commands only
# inside the container, keeping git and networking stuff out.
#
# * For gcc, vast majority of C++11 features are missing from this release (many were added around GCC 4.3 and 4.4).
# Some C99 features are also missing. C++98 support seems to be full-featued.
#
# * Modern GTest doesn't work in this environment, as GTest v1.12.x requires C++11 and modern GTest v1.13+ requires C++14.
# To work around this, we supply nano substitute of GTest (tests/gtest-nano.h), partially compatible with API.
#
# * CMake is way too old to be usable without major rewrite of all the CMakeLists.txt to use ancient/deprecated syntax.
# To work around this, we use plain GNU make(1) and supply custom Makefile.gcc4.
linux_ubuntu_7_10:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: docker pull
run: |
docker pull icomputer7/ancient-ubuntu-docker:gutsy
- name: docker create start
run: |
docker create --name u710 --label u710 --workdir /w -v "$GITHUB_WORKSPACE":"/w" --entrypoint "tail" icomputer7/ancient-ubuntu-docker:gutsy "-f" "/dev/null"
docker start u710
- name: restore
run: |
docker exec u710 sh -c 'pwd && ls -al && apt-get update && apt-get -y --no-install-recommends install make g++'
- name: build
run: |
docker exec u710 sh -c 'make -f Makefile.gcc4'
- name: unittest
run: |
docker exec u710 sh -c 'build/unittest'
- name: docker shutdown
run: |
docker stop u710
docker rm u710
windows:
runs-on: windows-latest
# NB: see https://github.com/actions/runner-images/blob/main/images/win/Windows2022-Readme.md for what's available in this image
steps:
- uses: actions/checkout@v4
- name: restore
run: |
C:\vcpkg\bootstrap-vcpkg.bat
C:\vcpkg\vcpkg install gtest:x64-windows
- name: build
run: .build\build.ps1 -GTestPath C:\vcpkg\installed\x64-windows
- name: unittest
run: .build\run-unittest.ps1
freebsd_14_0:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run in FreeBSD
uses: vmactions/freebsd-vm@v1
with:
release: "14.0"
usesh: true
prepare: |
pkg install -y cmake googletest
run: |
echo '#### System information'
whoami
env
freebsd-version
c++ --version
gcc --version
clang++ --version
pkg info
echo '#### Building'
.build/build -DCMAKE_CXX_STANDARD=11 -DCMAKE_CXX_STANDARD_REQUIRED=ON -DCMAKE_CXX_EXTENSIONS=OFF
echo '#### Testing'
.build/run-unittest
netbsd_10_0:
runs-on: ubuntu-latest
# Doesn't use clang, has gcc:
# c++ (nb3 20231008) 10.5.0
# Copyright (C) 2020 Free Software Foundation, Inc.
steps:
- uses: actions/checkout@v4
- name: Run in NetBSD
uses: vmactions/netbsd-vm@v1
with:
release: "10.0"
usesh: true
prepare: |
/usr/sbin/pkg_add cmake googletest
run: |
echo '#### System information'
whoami
env
c++ --version
gcc --version
echo '#### Building'
.build/build -DCMAKE_CXX_STANDARD=11 -DCMAKE_CXX_STANDARD_REQUIRED=ON -DCMAKE_CXX_EXTENSIONS=OFF
echo '#### Testing'
.build/run-unittest