Merge pull request #391 from flexkube/dependabot/go_modules/golang.or… #496
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.57.2 | |
steps: | |
- 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 | |
- run: make 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/libflexkube/libflexkube | |
make build build-test test-update-linters lint test-tidy test-changelog | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/setup-go@v2 | |
with: | |
go-version: '1.22' | |
- 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 | |
with: | |
# Required for Codecov report uploading. | |
fetch-depth: 0 | |
- name: Install required binaries | |
run: | | |
docker-compose -f e2e/docker-compose.yml up generate-secrets | |
sudo chown $(whoami): ./e2e/secrets/* | |
docker-compose -f e2e/docker-compose.yml up -d | |
make install-cc-test-reporter BIN_PATH=/usr/local/bin | |
- run: | | |
export TEST_INTEGRATION_SSH_PORT=2222 | |
export TEST_INTEGRATION_SSH_PASSWORD_FILE=$(pwd)/e2e/secrets/password | |
export TEST_INTEGRATION_SSH_PRIVATE_KEY_PATH=$(pwd)/e2e/secrets/id_rsa | |
make test-integration-cover-upload | |
build-docker: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- run: make build-docker | |
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 | |
e2e: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/setup-go@v2 | |
with: | |
go-version: '1.22' | |
- 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 | |
- 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: | | |
docker-compose -f e2e/docker-compose.yml up -d | |
cat <<EOF > e2e/test-config.yaml | |
sshPrivateKeyPath: $(pwd)/e2e/secrets/id_rsa | |
nodesCIDR: 172.17.0.0/24 | |
nodeSSHPort: 2222 | |
workersCount: 0 | |
cidrIPsOffset: 1 | |
kubeletExtraArgs: | |
- --fail-swap-on=false | |
- --container-runtime-endpoint=unix:///run/containerd/containerd.sock | |
cgroupDriver: cgroupfs | |
EOF | |
helm repo add flexkube https://flexkube.github.io/charts/ | |
sudo chown $(whoami): e2e/secrets/id_rsa | |
- run: make test-e2e | |
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,complies | |
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 | |
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 | |
semgrep: | |
runs-on: ubuntu-latest | |
container: | |
image: returntocorp/semgrep | |
steps: | |
- uses: actions/checkout@v2 | |
- run: semgrep ci --config .semgrep.yml |