-
Notifications
You must be signed in to change notification settings - Fork 47
72 lines (60 loc) · 2.42 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
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: ubuntu-latest
strategy:
fail-fast: false
matrix:
go-version: [1.18.x, 1.19.x, 1.20.x]
criu_branch: [master, criu-dev]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
# needed for codecov
fetch-depth: 0
- name: Build CRIU ${{ matrix.criu_branch }}
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@v4
with:
go-version: ${{ matrix.go-version }}
- name: Install protoc-gen-go
run: |
sudo env "GOBIN=/usr/bin" go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
- name: Test go-criu
run: sudo -E make test
- name: Test magicgen script
run: sudo -E make -C scripts/magic-gen test
- name: Test CRIT
run: |
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
- name: Check code coverage
if: matrix.go-version == '1.20.x' && matrix.criu_branch == 'criu-dev'
run: |
# Run actual test as root as it uses CRIU.
sudo -E make coverage
# Upload coverage results to codecov
sudo -E make codecov