forked from p4lang/p4c
-
Notifications
You must be signed in to change notification settings - Fork 1
121 lines (107 loc) · 3.61 KB
/
ci-test.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
name: "test-p4c"
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
# Build and test p4c on Ubuntu 20.04
build-linux:
strategy:
fail-fast: false
matrix:
unified: [ON, OFF]
enable_gmp: [ON, OFF]
exclude:
- unified: OFF
enable_gmp: OFF
runs-on: ubuntu-latest
env:
CTEST_PARALLEL_LEVEL: 4
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Build (Ubuntu Linux)
run: |
tools/start_ccache
# To flush out issues with unified vs. non-unified builds,
# do a non-unified build before continuing with the rest,
# which produces a unified build.
docker build --network ccache_network -t p4c --build-arg IMAGE_TYPE=test --build-arg ENABLE_UNIFIED_COMPILATION=${{matrix.unified}} --build-arg ENABLE_GMP=${{ matrix.enable_gmp }} .
# run with sudo (...) --privileged
# this is needed to create network namespaces for the ebpf tests
- name: Run tests (Ubuntu Linux)
run: |
sudo docker run --privileged -w /p4c/build -e $CTEST_PARALLEL_LEVEL p4c ctest --output-on-failure --schedule-random
if: matrix.unified == 'ON'
# Build and test p4c on Fedora
build-fedora-linux:
strategy:
fail-fast: false
matrix:
unified: [ON, OFF]
enable_gmp: [ON, OFF]
exclude:
- unified: OFF
enable_gmp: OFF
# This job runs in Fedora container that runs in Ubuntu VM
runs-on: ubuntu-latest
container:
image: registry.fedoraproject.org/fedora:latest
env:
CTEST_PARALLEL_LEVEL: 4
steps:
# We need to install git here because it is not provided out of the box in Fedora container
- name: Install git
run: dnf install -y -q git
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Install dependencies (Fedora Linux)
run: tools/install_fedora_deps.sh
- name: Build p4c (Fedora Linux)
run: |
./bootstrap.sh -DCMAKE_BUILD_TYPE=RELEASE -DENABLE_UNIFIED_COMPILATION=${{matrix.unified}} -DENABLE_GMP=${{ matrix.enable_gmp }}
make -j2 -C build
- name: Run p4c tests (Fedora Linux)
run: ctest --output-on-failure --schedule-random
working-directory: ./build
if: matrix.unified == 'ON'
# Build and test p4c on MacOS 10.15
build-mac-os:
strategy:
fail-fast: false
matrix:
unified: [ON, OFF]
enable_gmp: [ON, OFF]
exclude:
- unified: OFF
enable_gmp: OFF
runs-on: macos-10.15
env:
CTEST_PARALLEL_LEVEL: 4
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Install dependencies (MacOS)
run: |
tools/install_mac_deps.sh
echo "/usr/local/opt/bison/bin" >> $GITHUB_PATH
- name: Build (MacOS)
run: |
# To flush out issues with unified vs. non-unified builds,
# do a non-unified build before continuing with the rest,
# which produces a unified build.
# On MacOS we have noticed problems with the C++
# garbage-collector, so we disable it
./bootstrap.sh -DENABLE_GC=OFF -DCMAKE_BUILD_TYPE=RELEASE -DENABLE_UNIFIED_COMPILATION=${{matrix.unified}} -DENABLE_GMP=${{ matrix.enable_gmp }} && cd build && make -j2
- name: Run tests (MacOS)
run: |
ctest --output-on-failure -j 2 --schedule-random -LE "bpf$"
if: matrix.unified == 'ON'