update kind version #342
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: | |
- '**' | |
release: | |
types: | |
- created | |
- edited | |
repository_dispatch: | |
types: [trigger-test] | |
workflow_dispatch: | |
inputs: | |
debug_enabled: | |
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)' | |
required: false | |
default: false | |
image_version: | |
description: 'Specify docker image version to test' | |
required: false | |
jobs: | |
build: | |
name: test (${{ matrix.os }}/${{ matrix.arch }}/${{ matrix.runs_on }}) | |
runs-on: ${{ matrix.runs_on }} | |
timeout-minutes: 60 | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: linux | |
arch: amd64 | |
os_alias: linux | |
arch_alias: amd64 | |
runs_on: ubuntu-20.04 | |
goos: linux | |
- os: macos | |
arch: amd64 | |
os_alias: osx | |
arch_alias: amd64 | |
goos: darwin | |
runs_on: macos-12 | |
- os: linux | |
arch: arm32 | |
os_alias: linux | |
arch_alias: armhf | |
goos: linux | |
goarch: arm | |
goarm: "7" | |
runs_on: ubuntu-20.04 | |
cc: arm-linux-gnueabihf-gcc | |
cgo_enabled: 1 | |
- os: linux | |
arch: arm64 | |
os_alias: linux | |
arch_alias: arm64 | |
goos: linux | |
goarch: arm64 | |
runs_on: ubuntu-20.04 | |
cc: aarch64-linux-gnu-gcc | |
cgo_enabled: 1 | |
env: | |
TRAVIS_OS_NAME: ${{ matrix.os_alias }} | |
TRAVIS_ARCH: ${{ matrix.arch }} | |
REGISTRY: ghcr.io/ | |
KIND_IMG_VERSION: v1.29.4 | |
KIND_VERSION: v0.23.0 | |
CC: ${{ matrix.cc }} | |
CGO_ENABLED: ${{ matrix.cgo_enabled }} | |
GOOS: ${{matrix.goos}} | |
GOARCH: ${{matrix.goarch}} | |
GOARM: ${{matrix.goarm}} | |
DOCKER_IMG_VERSION_DEFAULT: 0.8 | |
steps: | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: 1.17.1 | |
cache: false | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/cache@v4 | |
with: | |
# In order: | |
# * Module download cache | |
# * Build cache (Linux) | |
# * Build cache (Mac) | |
# * Build cache (Windows) | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
~/Library/Caches/go-build | |
%LocalAppData%\go-build | |
key: ${{ runner.os }}-${{ matrix.arch }}-ccache-build-${{ hashFiles('**/go.sum') }} | |
restore-keys: ${{ runner.os }}-${{ matrix.arch }}-ccache-build- | |
- name: Event Information | |
run: | | |
echo "Event '${{ github.event.action }}' from '${{ github.event.client_payload.repository }}'" | |
- name: Set env | |
run: | | |
echo "$HOME/.local/bin:${{ github.workspace }}/bin" >> $GITHUB_PATH | |
echo "export PATH=$HOME/.local/bin:${{ github.workspace }}/bin:$PATH" >> $HOME/.bashrc | |
RELEASE_VERSION=`git describe --tags --abbrev=0 | sed "s/^v//"` | |
if [ `git rev-list -n 1 v"$RELEASE_VERSION"` == `git rev-list -n 1 HEAD` ] ; then | |
BUILD_VERSION=${RELEASE_VERSION} | |
else | |
BUILD_VERSION=${RELEASE_VERSION}-next | |
fi | |
PACKAGE_FILENAME=docker-runu_${BUILD_VERSION}_${{ matrix.arch_alias }}.deb | |
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV | |
echo "BUILD_VERSION=$BUILD_VERSION" >> $GITHUB_ENV | |
echo "BUILD_DATE="`date "+%Y%m%d"` >> $GITHUB_ENV | |
echo "PACKAGE_FILENAME=$PACKAGE_FILENAME" >> $GITHUB_ENV | |
echo "DEB_ARCH=${{ matrix.arch_alias }}" >> $GITHUB_ENV | |
# image version | |
if [ -n "${{ github.event.inputs.image_version }}" ] ; then | |
echo "DOCKER_IMG_VERSION=${{ github.event.inputs.image_version }}" >> $GITHUB_ENV | |
elif [ -n "${{ github.event.client_payload.img_version }}" ] ; then | |
# TODO: not implemented yet | |
echo "DOCKER_IMG_VERSION=${{ github.event.client_payload.img_version }}" >> $GITHUB_ENV | |
else | |
echo "DOCKER_IMG_VERSION=${{ env.DOCKER_IMG_VERSION_DEFAULT }}" >> $GITHUB_ENV | |
fi | |
echo "GO_FLAGS=-ldflags \"-X main.version="${BUILD_VERSION}"\"" >> $GITHUB_ENV | |
- name: package installation (linux) | |
if: runner.os == 'linux' && matrix.arch == 'amd64' | |
run: | | |
sudo apt update -y | |
sudo apt install -y bridge-utils | |
- name: package installation (linux-cross) | |
if: runner.os == 'linux' && ( matrix.arch == 'arm32' || matrix.arch == 'arm64') | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install -y crossbuild-essential-${{ matrix.arch_alias }} | |
- name: package installation (mac) | |
if: runner.os == 'macos' | |
run: | | |
mkdir -p ~/.local/bin | |
# use pre-installed golang instead of brew | |
ln -s `which go` /usr/local/Homebrew/Library/Homebrew/shims/mac/super/go | |
brew install ukontainer/lkl/darwin-snapshotter ukontainer/lkl/containerd ukontainer/lkl/nerdctl --ignore-dependencies | |
brew install coreutils | |
ln -sf /usr/local/bin/gsha256sum ~/.local/bin/sha256sum | |
- name: Build | |
run: | | |
go install ${{ env.GO_FLAGS }} -v . | |
- name: Build shim | |
if: runner.os == 'macos' | |
run: | | |
go install ${{ env.GO_FLAGS }} -v ./cmd/containerd-shim-runu-v1 | |
- name: Go Test | |
if: matrix.arch == 'amd64' | |
run: | | |
sudo go test -v . | |
runu -v | |
- name: goreportcard | |
if: runner.os == 'linux' && matrix.arch == 'amd64' && matrix.runs_on == 'ubuntu-18.04' | |
run: | | |
cd /tmp | |
go get -u github.com/gojp/goreportcard/cmd/goreportcard-cli | |
GO111MODULE=off go get -u github.com/alecthomas/gometalinter | |
go get -u github.com/gordonklaus/ineffassign | |
go get -u github.com/fzipp/gocyclo/cmd/gocyclo | |
go get -u github.com/client9/misspell/cmd/misspell | |
go get -u golang.org/x/lint/golint | |
cd ${{ github.workspace }} | |
# Do checks | |
GO111MODULE=on goreportcard-cli -t 100.0 -v | |
# TODO: run qemu for arm32/arm64 tests | |
- name: Test (standalone) | |
if: matrix.arch != 'arm32' && matrix.arch != 'arm64' | |
run: bash -e ${{ github.workspace }}/test/standalone-test.sh | |
- name: Test (containerd/ctr) | |
run: bash -e ${{ github.workspace }}/test/containerd-ctr-test.sh | |
- name: Test (containerd/nerdctl) | |
run: bash -e ${{ github.workspace }}/test/containerd-nerdctl-test.sh | |
# TODO: run qemu for arm32/arm64 tests | |
- name: Test (dockerd) | |
if: runner.os == 'linux' && matrix.arch == 'amd64' | |
run: bash -e ${{ github.workspace }}/test/docker-oci-test.sh | |
- name: Test (docker more) | |
if: runner.os == 'linux' && matrix.arch == 'amd64' | |
run: bash -e ${{ github.workspace }}/test/docker-more-test.sh | |
- name: Test (docker volume) | |
if: runner.os == 'linux' && matrix.arch == 'amd64' | |
run: bash -e ${{ github.workspace }}/test/docker-volume-test.sh | |
- name: KinD image preparation | |
if: runner.os == 'linux' && matrix.arch == 'amd64' | |
run: | | |
. ${{ github.workspace }}/test/common.sh | |
# prepare RUNU_AUX_DIR | |
create_runu_aux_dir | |
cp $RUNU_AUX_DIR/libc.so k8s/ | |
cp $RUNU_AUX_DIR/lkick k8s/ | |
# Build kind node docker image | |
cp `which runu` k8s/ | |
cd k8s | |
docker build -t ukontainer/node-runu:$KIND_IMG_VERSION . | |
cd .. | |
- uses: engineerd/setup-kind@v0.5.0 | |
name: kind setup with default CNI | |
if: runner.os == 'linux' && matrix.arch == 'amd64' | |
with: | |
version: "${{ env.KIND_VERSION }}" | |
config: "k8s/kind-cluster.yaml" | |
image: "ukontainer/node-runu:${{ env.KIND_IMG_VERSION }}" | |
- name: Test (k8s) | |
if: runner.os == 'linux' && matrix.arch == 'amd64' | |
run: | | |
bash -e ${{ github.workspace }}/test/k8s-test.sh 127.0.0.1 | |
- run: kind delete cluster | |
if: runner.os == 'linux' && matrix.arch == 'amd64' | |
- uses: engineerd/setup-kind@v0.5.0 | |
name: kind setup with calico | |
if: runner.os == 'linux' && matrix.arch == 'amd64' | |
with: | |
version: "${{ env.KIND_VERSION }}" | |
config: "k8s/kind-cluster-calico.yaml" | |
image: "ukontainer/node-runu:${{ env.KIND_IMG_VERSION }}" | |
wait: "0s" | |
- name: Test (k8s/calico) | |
if: runner.os == 'linux' && matrix.arch == 'amd64' | |
run: | | |
set -x | |
NET=`kubectl cluster-info dump | grep -- --cluster-cidr | cut -d'=' -f2 | sed s/\"\,//` | |
# install calico | |
curl -s https://docs.projectcalico.org/v3.20/manifests/calico.yaml | sed "s,192.168.0.0/16,$NET," | kubectl apply -f - | |
sleep 30 | |
DST=`kubectl get node -o wide | grep control-plane | awk '{print $6}'` | |
bash -e ${{ github.workspace }}/test/k8s-test.sh $DST | |
- name: Build Debian package | |
if: runner.os == 'linux' | |
run: | | |
bash -ex pkg/pre-deploy-deb.sh | |
- name: Verify Debian package | |
if: runner.os == 'linux' | |
run: | | |
dpkg --info *.deb | |
dpkg --contents *.deb | |
- name: Test Debian package | |
if: runner.os == 'linux' && matrix.arch == 'amd64' | |
run: | | |
bash -ex pkg/pre-deploy-test-deb.sh | |
- name: upload artifact | |
if: runner.os == 'linux' | |
uses: actions/upload-artifact@v4 | |
with: | |
path: ${{ env.PACKAGE_FILENAME }} | |
name: ${{ env.PACKAGE_FILENAME }} | |
# TODO: prepare homebrew bottle | |
- name: Github Releases | |
if: runner.os == 'linux' && gitHub.event_name == 'release' | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: v${{ env.RELEASE_VERSION }} | |
prerelease: true | |
token: ${{ secrets.GITHUB_TOKEN }} | |
files: | | |
${{ env.PACKAGE_FILENAME }} | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 2.7 | |
- name: Release to packagecloud.io | |
if: runner.os == 'linux' && gitHub.event_name == 'release' | |
run: | | |
# Instsall packagecloud CLI | |
gem install package_cloud | |
# push all versions and delete it in advance | |
for distro_version in ${{ env.DISTRO_LIST }} ; do | |
package_cloud yank ukontainer/runu/$distro_version ${{ env.PACKAGE_FILENAME }} || true | |
package_cloud push ukontainer/runu/$distro_version ${{ env.PACKAGE_FILENAME }} | |
done | |
env: | |
PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }} | |
DISTRO_LIST: "ubuntu/focal ubuntu/jammy ubuntu/noble" | |
- name: Test Released Debian package | |
if: runner.os == 'linux' && matrix.arch == 'amd64' && gitHub.event_name == 'release' | |
run: | | |
sudo apt-get remove docker-runu | |
#set -x | |
# wait for complete indexing at pkgcloud | |
sleep 60 | |
curl -s https://packagecloud.io/install/repositories/ukontainer/runu/script.deb.sh | sudo bash | |
sudo apt-get install docker-runu | |
docker run --rm -i --runtime=runu-dev alpine uname -a | |
- name: Log in to docker.io | |
if: runner.os == 'linux' | |
uses: docker/login-action@v3.2.0 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Log in to the ghcr.io | |
if: runner.os == 'linux' | |
uses: docker/login-action@v3.2.0 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push Docker image | |
if: gitHub.event_name == 'release' && runner.os == 'linux' && matrix.arch == 'amd64' | |
uses: docker/build-push-action@v2 | |
with: | |
context: k8s | |
platforms: linux/amd64 | |
push: true | |
tags: | | |
docker.io/ukontainer/node-runu:${{ env.KIND_IMG_VERSION }} | |
ghcr.io/ukontainer/node-runu:${{ env.KIND_IMG_VERSION }} | |
- name: Log | |
if: always() | |
run: | | |
cat /tmp/dockerd.log || true | |
cat /tmp/containerd.log || true | |
cat /tmp/darwin-snapshotter.log || true | |
- run: kind export logs logs | |
if: runner.os == 'linux' && matrix.arch == 'amd64' && always() | |
- uses: actions/upload-artifact@v4 | |
if: runner.os == 'linux' && matrix.arch == 'amd64' && always() | |
with: | |
name: KinD-log | |
path: logs | |
- name: Setup tmate session | |
uses: mxschmitt/action-tmate@v3 | |
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled && always ()}} |