-
Notifications
You must be signed in to change notification settings - Fork 48
76 lines (65 loc) · 2.61 KB
/
main.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
name: ci
on: [push, pull_request]
# Cancel any preceding run on the pull request.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
go-version: [1.20.x, 1.21.x, 1.22.x]
criu_branch: [master, criu-dev]
exclude: # Skip duplicate CRIT build tests on macos/windows
- os: windows-latest
criu_branch: criu-dev
- os: macos-latest
criu_branch: criu-dev
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build CRIU ${{ matrix.criu_branch }}
if: runner.os == 'Linux'
run: |
sudo apt-get install -y libprotobuf-dev libprotobuf-c-dev protobuf-c-compiler protobuf-compiler python3-protobuf libnl-3-dev libnet-dev libcap-dev curl unzip
git clone --depth=1 --single-branch -b ${{ matrix.criu_branch }} https://github.com/checkpoint-restore/criu.git
make -j"$(nproc)" -C criu
sudo make -C criu install-criu PREFIX=/usr
- name: Install Go ${{ matrix.go-version }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Install protoc-gen-go
if: runner.os == 'Linux'
run: |
sudo env "GOBIN=/usr/bin" go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
- name: Test go-criu
if: runner.os == 'Linux'
run: sudo -E make test
- name: Test magicgen script
if: runner.os == 'Linux'
run: sudo -E make -C scripts/magic-gen test
- name: Test CRIT
shell: bash # To support windows
run: |
if [ "${{ runner.os }}" != "Linux" ]; then
make -C crit clean bin/crit
exit 0
fi
if [ "${{ matrix.criu_branch }}" = "criu-dev" ]; then
# First update protobuf. It is too old in the Ubuntu image.
curl -Lo protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v23.4/protoc-23.4-linux-x86_64.zip
sudo unzip -o protoc.zip -d /usr
# We need to use the protobuf definitions from the criu-dev
# branch as it might have changed.
sudo -E make -C scripts/proto-gen proto-update GIT_BRANCH=${{ matrix.criu_branch }}
# Generate the bindings
sudo -E make -C scripts/proto-gen
# Build the CRIT binary
sudo -E make -C crit clean bin/crit
fi
sudo -E make -C crit unit-test
sudo -E make -C test crit-test