Merge pull request #142 from behouba/pages-id-getter #444
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |