New release pipeline in operator #70
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: run-tests | |
on: | |
- pull_request | |
- workflow_dispatch | |
jobs: | |
lint: | |
concurrency: | |
group: lint-golangci-${{ github.head_ref || github.ref_name }} | |
cancel-in-progress: true | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v6 | |
with: | |
version: v1.61.0 | |
run-unit-tests: | |
concurrency: | |
group: run-unit-tests-${{ github.head_ref || github.ref_name }} | |
cancel-in-progress: true | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: setup-go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: '1.20' | |
- name: setup-medium-test-class-binaries | |
run: | | |
# This installs kube-apiserver and etcd binaries for `medium` | |
# class tests. Refer to the writing tests docs for more info. | |
make envtest | |
KUBEBUILDER_ASSETS=$(./bin/setup-envtest use 1.26 -p path) | |
echo "KUBEBUILDER_ASSETS=$KUBEBUILDER_ASSETS" >> $GITHUB_ENV | |
- name: setup-gotestsum | |
run: | | |
go install gotest.tools/[email protected] | |
- name: run-unit-tests | |
id: run-unit-tests | |
run: | | |
gotestsum --format pkgname --jsonfile log.json -- -v -timeout 900s -p 1 ./internal/... -ginkgo.vv -coverprofile cover.out | |
- name: convert-to-human-readable | |
run: jq -r '.Output| gsub("[\\n]"; "")' log.json 2>/dev/null 1>log.txt || true | |
- name: artifact-upload-step | |
uses: actions/upload-artifact@v4 | |
id: artifact-upload-step | |
if: always() | |
with: | |
name: unit-tests-log | |
path: log.txt | |
if-no-files-found: error | |
- name: echo-tests-log-url | |
run: echo 'Unit tests log URL is ${{ steps.artifact-upload-step.outputs.artifact-url }}' | |
run-e2e-tests: | |
concurrency: | |
group: run-e2e-tests-${{ github.head_ref || github.ref_name }} | |
cancel-in-progress: true | |
needs: | |
- run-unit-tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: maximize-build-space | |
uses: AdityaGarg8/[email protected] | |
with: | |
remove-android: 'true' | |
remove-haskell: 'true' | |
remove-codeql: 'true' | |
remove-dotnet: 'true' | |
remove-swapfile: 'true' | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: setup-go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: '1.20' | |
- name: install-dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y build-essential | |
go install sigs.k8s.io/[email protected] | |
curl -LO https://dl.k8s.io/release/v1.25.3/bin/linux/amd64/kubectl | |
chmod +x ./kubectl | |
HELM_PKG="helm-v3.13.3-linux-amd64.tar.gz" | |
curl -LO https://get.helm.sh/"${HELM_PKG}" | |
tar -zxvf "${HELM_PKG}" | |
mv ./linux-amd64/helm . | |
curl -sSL https://storage.yandexcloud.net/yandexcloud-ydb/install.sh | bash | |
echo "$(pwd)" >> $GITHUB_PATH | |
echo "$HOME/ydb/bin" >> $GITHUB_PATH | |
echo "$HOME/go/bin" >> $GITHUB_PATH | |
- name: check-dependencies | |
run: | | |
gcc --version | |
go version | |
kind version | |
kubectl version --client=true | |
helm version | |
- name: setup-k8s-cluster | |
run: | | |
kind delete cluster | |
kind create cluster \ | |
--image=kindest/node:v1.25.3@sha256:cd248d1438192f7814fbca8fede13cfe5b9918746dfa12583976158a834fd5c5 \ | |
--config=./e2e/kind-cluster-config.yaml | |
kubectl wait --timeout=5m --for=condition=ready node -l worker=true | |
kubectl label --overwrite node kind-worker topology.kubernetes.io/zone=fakeZone1 | |
kubectl label --overwrite node kind-worker2 topology.kubernetes.io/zone=fakeZone2 | |
kubectl label --overwrite node kind-worker3 topology.kubernetes.io/zone=fakeZone3 | |
- name: build-operator-image | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
push: false | |
# Get commit short sha within Github action workflow | |
# Just a random string name, we aren't uploading anyway | |
tags: kind/ydb-operator:current | |
- name: load-and-deploy-operator | |
run: | | |
kind load docker-image kind/ydb-operator:current --nodes kind-worker,kind-worker2,kind-worker3 | |
- name: pull-and-load-kube-webhook-certgen-image | |
uses: nick-fields/retry@v3 | |
with: | |
timeout_minutes: 5 | |
retry_wait_seconds: 20 | |
max_attempts: 3 | |
command: | | |
docker pull k8s.gcr.io/ingress-nginx/kube-webhook-certgen:v1.0 | |
kind load docker-image k8s.gcr.io/ingress-nginx/kube-webhook-certgen:v1.0 --nodes kind-worker,kind-worker2,kind-worker3 | |
- name: pull-and-load-ydb-image | |
run: | | |
YDB_IMAGE=$(grep "anchor_for_fetching_image_from_workflow" ./e2e/tests/**/*.go | grep -o -E '"cr\.yandex.*"') | |
YDB_IMAGE=${YDB_IMAGE:1:-1} # strip "" | |
docker pull $YDB_IMAGE | |
kind load docker-image $YDB_IMAGE --nodes kind-worker,kind-worker2,kind-worker3 | |
- name: setup-gotestsum | |
run: | | |
go install gotest.tools/[email protected] | |
- name: run-e2e-tests | |
id: run-e2e-tests | |
run: | | |
gotestsum --format pkgname --jsonfile log.json -- -v -timeout 3600s -p 1 ./e2e/... -ginkgo.vv | |
- name: convert-json-log-to-human-readable | |
run: jq -r '.Output| gsub("[\\n]"; "")' log.json 2>/dev/null 1>log.txt || true | |
- name: artifact-upload-step | |
uses: actions/upload-artifact@v4 | |
id: artifact-upload-step | |
if: always() | |
with: | |
name: e2e-tests-log | |
path: log.txt | |
if-no-files-found: error | |
- name: echo-tests-log-url | |
run: echo 'Unit tests log URL is ${{ steps.artifact-upload-step.outputs.artifact-url }}' | |
- name: teardown-k8s-cluster | |
run: | | |
kind delete cluster | |