Merge pull request #34 from invidian/release-v0.9.0 #65
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: | |
pull_request: | |
push: | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
container: golangci/golangci-lint:v1.54.2 | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
# Required for Codecov report uploading. | |
fetch-depth: 0 | |
- run: make install-cc-test-reporter install-changelog BIN_PATH=/usr/local/bin | |
- run: | | |
# Required to avoid error 'fatal: detected dubious ownership in repository at' while calling | |
# 'git status --porcelain'. | |
git config --global --add safe.directory /__w/terraform-provider-flexkube/terraform-provider-flexkube | |
make build build-test test-update-linters lint test-tidy test-changelog | |
- run: make test-cover-upload | |
e2e: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/setup-go@v2 | |
with: | |
go-version: '1.21' | |
- uses: actions/cache@v2 | |
with: | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- uses: actions/checkout@v2 | |
- uses: hashicorp/setup-terraform@v1 | |
- name: Setup containerd | |
run: | | |
# From https://docs.docker.com/engine/install/ubuntu/. | |
sudo apt-get remove docker docker-engine docker.io containerd runc | |
sudo apt-get update | |
sudo apt-get install \ | |
ca-certificates \ | |
curl \ | |
gnupg \ | |
lsb-release | |
sudo mkdir -p /etc/apt/keyrings | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg | |
echo \ | |
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ | |
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null | |
sudo apt-get update | |
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin | |
# From Flatcar default configuration and image-builder containerd role. | |
sudo sed -i 's/^disabled_plugins.*/disabled_plugins = []/g' /etc/containerd/config.toml | |
cat <<EOF | sudo tee -a /etc/containerd/config.toml | |
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc] | |
# setting runc.options unsets parent settings | |
runtime_type = "io.containerd.runc.v2" | |
[plugins."io.containerd.grpc.v1.cri".containerd.runtimes.runc.options] | |
SystemdCgroup = true | |
EOF | |
sudo systemctl restart containerd | |
- name: Fetch dependencies and configure tests | |
run: | | |
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash | |
helm repo add flexkube https://flexkube.github.io/charts/ | |
docker-compose -f e2e/docker-compose.yml up -d | |
until test -f e2e/keys/id_rsa; do sleep 0.5; done | |
sudo chown $(whoami): e2e/keys/id_rsa | |
cat <<EOF > e2e/variables.auto.tfvars | |
ssh_private_key_path = "$(pwd)/e2e/keys/id_rsa" | |
nodes_cidr = "172.17.0.0/24" | |
node_ssh_port = 2222 | |
workers_count = 0 | |
cidr_ips_offset = 1 | |
kubelet_extra_args = [ | |
"--fail-swap-on=false", | |
"--container-runtime-endpoint=unix:///run/containerd/containerd.sock", | |
] | |
cgroup_driver = "cgroupfs" | |
EOF | |
- run: make build test-e2e-run TERRAFORM_BIN=terraform | |
codespell: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: codespell-project/actions-codespell@master | |
with: | |
skip: .git,go.sum | |
ignore_words_list: uptodate,decorder | |
check_filenames: true | |
check_hidden: true | |
vagrant: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install vagrant | |
run: | | |
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add - | |
sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | |
sudo apt-get update && sudo apt-get install vagrant | |
- run: make test-vagrant | |
semgrep: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
# Use dedicated action for nice integration with GitHub. | |
- uses: returntocorp/semgrep-action@v1 | |
terraform: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Get dependencies | |
run: | | |
sudo apt-get update && sudo apt-get install -y gnupg software-properties-common curl | |
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add - | |
sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | |
sudo apt-get update && sudo apt-get install terraform | |
- run: | | |
terraform -chdir=libvirt init | |
make test-terraform | |
build-integration-image: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- run: make build-integration | |
build-e2e-image: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- run: make build-e2e |