Implement pause/resume #114
Workflow file for this run
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: | |
branches: [ unstable ] | |
pull_request: | |
branches: [ unstable ] | |
workflow_dispatch: | |
jobs: | |
# | |
# Linter checker | |
# | |
linters: | |
name: Linters | |
runs-on: ubuntu-20.04 | |
timeout-minutes: 10 | |
strategy: | |
matrix: | |
go-version: [1.21.x] | |
steps: | |
- uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- uses: actions/checkout@v2 | |
with: | |
path: src/github.com/fuweid/embedshim | |
submodules: 'true' | |
- name: set env | |
shell: bash | |
run: | | |
echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV | |
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH | |
- name: install system dependencies | |
working-directory: src/github.com/fuweid/embedshim | |
shell: bash | |
run: | | |
echo "::group:: install system dependencies" | |
echo "deb http://apt.llvm.org/focal/ llvm-toolchain-focal main" | sudo tee -a /etc/apt/sources.list | |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - | |
sudo apt-get update -y | |
sudo apt-get install -y build-essential rsync binutils-dev elfutils libcap-dev libelf-dev libdw-dev python3-docutils | |
sudo apt-get install -y g++ libelf-dev clang lld llvm gperf | |
echo "::endgroup::" | |
- name: generate bpf binary | |
working-directory: src/github.com/fuweid/embedshim | |
shell: bash | |
run: | | |
echo "::group:: generate bpf binary" | |
make -C bpf | |
# TODO(fuweid): handle it in Makefile | |
go generate ./... | |
echo "::endgroup::" | |
- name: golangci-lint check | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
version: v1.55.2 | |
args: --timeout=5m | |
working-directory: src/github.com/fuweid/embedshim | |
# | |
# Project checker | |
# | |
# based on https://github.com/containerd/project-checks/blob/main/action.yml | |
project: | |
name: Project Checks | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
path: src/github.com/fuweid/embedshim | |
fetch-depth: 100 | |
- name: set env | |
shell: bash | |
run: | | |
echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV | |
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH | |
- name: install dependencies | |
shell: bash | |
env: | |
# TODO(fuweid): remove the env GO111MODULE=off in new version of go | |
GO111MODULE: off | |
run: | | |
echo "::group:: install dependencies" | |
go get -u -v github.com/vbatts/git-validation | |
go get -u -v github.com/kunalkushwaha/ltag | |
echo "::endgroup::" | |
- name: DCO checker | |
shell: bash | |
working-directory: src/github.com/fuweid/embedshim | |
env: | |
GITHUB_COMMIT_URL: ${{ github.event.pull_request.commits_url }} | |
DCO_VERBOSITY: "-v" | |
DCO_RANGE: "" | |
run: | | |
echo "::group:: DCO checks" | |
set -eu -o pipefail | |
if [ -z "${GITHUB_COMMIT_URL}" ]; then | |
DCO_RANGE=$(jq -r '.after + "..HEAD"' ${GITHUB_EVENT_PATH}) | |
else | |
DCO_RANGE=$(curl ${GITHUB_COMMIT_URL} | jq -r '.[0].parents[0].sha + "..HEAD"') | |
fi | |
range= | |
[ ! -z "${DCO_RANGE}" ] && range="-range ${DCO_RANGE}" | |
git-validation ${DCO_VERBOSITY} ${range} -run DCO,short-subject,dangling-whitespace | |
echo "::endgroup::" | |
# | |
# CRI Integration | |
# | |
cri-integration: | |
name: CRI Integration | |
timeout-minutes: 20 | |
needs: [project, linters] | |
strategy: | |
# ubuntu-22.04 is used to test cgroupv2 | |
# ubuntu-20.04 is for cgroupv1 (common) | |
matrix: | |
go-version: [1.21.x] | |
os: [ubuntu-20.04, ubuntu-22.04] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- uses: actions/checkout@v2 | |
with: | |
path: src/github.com/fuweid/embedshim | |
submodules: 'true' | |
- name: set env | |
shell: bash | |
run: | | |
echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV | |
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH | |
- name: install system dependencies | |
working-directory: src/github.com/fuweid/embedshim | |
shell: bash | |
run: | | |
echo "::group:: install system dependencies" | |
echo "deb http://apt.llvm.org/focal/ llvm-toolchain-focal main" | sudo tee -a /etc/apt/sources.list | |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - | |
sudo apt-get update -y | |
sudo apt-get install -y build-essential rsync binutils-dev elfutils libcap-dev libelf-dev libdw-dev python3-docutils | |
sudo apt-get install -y g++ libelf-dev clang lld llvm gperf | |
echo "::endgroup::" | |
- name: install containerd dependencies | |
working-directory: src/github.com/fuweid/embedshim | |
shell: bash | |
run: | | |
echo "::group:: install containerd dependencies" | |
go install github.com/onsi/ginkgo/ginkgo@latest | |
bash -x script/setup_containerd_dependencies.sh | |
echo "::endgroup::" | |
- name: build embedshim | |
working-directory: src/github.com/fuweid/embedshim | |
shell: bash | |
run: | | |
make | |
sudo make install | |
- name: CRI Test | |
shell: bash | |
run: | | |
BDIR="$(mktemp -d -p $PWD)" | |
mkdir -p ${BDIR}/{root,state} | |
cat > ${BDIR}/config.toml <<EOF | |
version = 2 | |
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc] | |
runtime_type = "io.containerd.runtime.v1.embed" | |
EOF | |
sudo -E PATH=$PATH /usr/local/bin/embedshim-containerd \ | |
-a ${BDIR}/c.sock \ | |
--config ${BDIR}/config.toml \ | |
--root ${BDIR}/root \ | |
--state ${BDIR}/state \ | |
--log-level debug &> ${BDIR}/containerd-cri.log & | |
set +e | |
sudo -E PATH=$PATH /usr/local/bin/ctr -a ${BDIR}/c.sock version | |
sudo -E PATH=$PATH critest \ | |
--report-dir "${{github.workspace}}/critestreport" \ | |
--runtime-endpoint=unix:///${BDIR}/c.sock --parallel=8 | |
TEST_RC=$? | |
set -e | |
test $TEST_RC -ne 0 && cat ${BDIR}/containerd-cri.log | |
sudo kill -9 $(pidof embedshim-containerd) | |
sudo -E umount ${BDIR}/root/io.containerd.runtime.v1.embed/.exitsnoop.bpf | |
sudo -E rm -rf ${BDIR} | |
test $TEST_RC -eq 0 || /bin/false |