Skip to content
This repository has been archived by the owner on Mar 4, 2024. It is now read-only.

EVEREST-838 Workaround waiting for DBs to be deleted #1214

EVEREST-838 Workaround waiting for DBs to be deleted

EVEREST-838 Workaround waiting for DBs to be deleted #1214

Workflow file for this run

---
name: CI
on:
push:
branches:
- main
tags:
- v[0-9]+.[0-9]+.[0-9]+*
pull_request:
permissions:
contents: read
packages: write
checks: write
pull-requests: write
jobs:
check:
name: Check
timeout-minutes: 10
if: github.event_name == 'pull_request'
strategy:
fail-fast: false
matrix:
go-version: [1.21.x]
may-fail: [false]
continue-on-error: ${{ matrix.may-fail }}
runs-on: ubuntu-latest
env:
GOPRIVATE: github.com/percona,github.com/percona/percona-everest-backend,github.com/percona/everest-operator
steps:
- name: Configure git for private modules
env:
ROBOT_TOKEN: ${{ secrets.ROBOT_TOKEN }}
run: git config --global url."https://percona-platform-robot:${ROBOT_TOKEN}@github.com".insteadOf "https://github.com"
- name: Set up Go release
if: matrix.go-version != 'tip'
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Set up Go tip
if: matrix.go-version == 'tip'
run: |
git clone --depth=1 https://go.googlesource.com/go $HOME/gotip
cd $HOME/gotip/src
./make.bash
echo "GOROOT=$HOME/gotip" >> $GITHUB_ENV
echo "$HOME/gotip/bin" >> $GITHUB_PATH
- name: Set GO_VERSION environment variable
run: |
go version
echo "GO_VERSION=$(go version)" >> $GITHUB_ENV
- name: Check out code into the Go module directory
uses: actions/checkout@v4
with:
lfs: true
ref: ${{ github.event.pull_request.head.sha }}
- name: Enable Go modules cache
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ matrix.os }}-go-${{ matrix.go-version }}-modules-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ matrix.os }}-go-${{ matrix.go-version }}-modules-
- name: Enable Go build cache
uses: actions/cache@v4
with:
path: ~/.cache/go-build
key: ${{ matrix.os }}-go-${{ matrix.go-version }}-build-${{ github.ref }}-${{ hashFiles('**') }}
restore-keys: |
${{ matrix.os }}-go-${{ matrix.go-version }}-build-${{ github.ref }}-
${{ matrix.os }}-go-${{ matrix.go-version }}-build-
- name: Download Go modules
run: go mod download
- name: Install tools
run: make init
- name: Check the latest operator version is used
run: |
go get github.com/percona/everest-operator@main
echo "Checking there is no source code changes"
go mod tidy
git diff --exit-code
- name: Check the latest BE version is used
run: |
go get github.com/percona/percona-everest-backend@main
echo "Checking there is no source code changes"
go mod tidy
git diff --exit-code
- name: Check the Makefile references dev version
run: |
if ! grep -q "RELEASE_VERSION ?= v0.0.0" Makefile; then
echo "default RELEASE_VERSION in Makefile should be 0.0.0"
exit 1
fi
- name: Check the pkg/version/version.go references the dev manifest and catalog
run: |
if ! grep -q 'devCatalogImage = "docker.io/perconalab/everest-catalog:latest"' pkg/version/version.go; then
echo "default CLI release in install.sh should be latest"
exit 1
fi
if ! grep -q 'devManifestURL = "https://raw.githubusercontent.com/percona/percona-everest-backend/main' pkg/version/version.go; then
echo "default BE manifest in install.sh should be taken from main"
exit 1
fi
- name: Check the install.sh references the latest cli release
run: |
if ! grep -q "curl -sL https://github.com/percona/percona-everest-cli/releases/download/latest" install.sh; then
echo "default CLI release in install.sh should be latest"
exit 1
fi
- name: Run linters
uses: reviewdog/action-golangci-lint@v2
with:
github_token: ${{ secrets.ROBOT_TOKEN || secrets.GITHUB_TOKEN }}
go_version: ${{ matrix.go-version }}
reporter: github-pr-review
fail_on_error: true
cache: false
golangci_lint_flags: "-c=.golangci.yml --timeout=5m"
- name: Check that there are no source code changes
run: |
make format
pushd tools && go mod tidy -v
popd && go mod tidy -v
git status
git diff --exit-code
- name: Run debug commands on failure
if: ${{ failure() }}
run: |
env
go version
go env
pwd
git status
test:
name: Tests
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
go-version: [1.21.x]
env:
GO_VERSION: ${{ matrix.go-version }}
GOPRIVATE: github.com/percona,github.com/percona/percona-everest-backend,github.com/percona/everest-operator
steps:
- name: Configure git for private modules
env:
ROBOT_TOKEN: ${{ secrets.ROBOT_TOKEN }}
run: git config --global url."https://percona-platform-robot:${ROBOT_TOKEN}@github.com".insteadOf "https://github.com"
- name: Check out code
uses: actions/checkout@v4
- name: Set up Go release
if: env.GO_VERSION != 'tip'
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Set up Go tip
if: matrix.go-version == 'tip'
run: |
git clone --depth=1 https://go.googlesource.com/go $HOME/gotip
cd $HOME/gotip/src
./make.bash
echo "GOROOT=$HOME/gotip" >> $GITHUB_ENV
echo "$HOME/gotip/bin" >> $GITHUB_PATH
echo "$GOBIN" >> $GITHUB_PATH
- name: Enable Go modules cache
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ env.GO_VERSION }}-modules-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ env.GO_VERSION }}-modules-
- name: Download Go modules
run: go mod download
- name: Build
run: make build
- name: Run tests
run: make test-cover
- name: Upload coverage results
uses: codecov/codecov-action@v4
with:
file: cover.out
fail_ci_if_error: false
- name: Run debug commands on failure
if: ${{ failure() }}
run: |
env
go version
go env
pwd
git status
integration_tests:
name: CLI Integration Tests
runs-on: ubuntu-20.04
env:
# no `-mod=readonly` to test PRs made by @dependabot;
# `git diff --exit-code` step below still checks what we need
GOPRIVATE: github.com/percona,github.com/percona/percona-everest-backend,github.com/percona/everest-operator
PERCONA_VERSION_SERVICE_URL: https://check-dev.percona.com/versions/v1
steps:
- name: Configure git for private modules
env:
ROBOT_TOKEN: ${{ secrets.ROBOT_TOKEN }}
run: git config --global url."https://percona-platform-robot:${ROBOT_TOKEN}@github.com".insteadOf "https://github.com"
- name: Set up Go release
uses: percona-platform/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Set GO_VERSION environment variable
run: |
go version
echo "GO_VERSION=$(go version)" >> $GITHUB_ENV
- name: Check out code into the Go module directory
uses: actions/checkout@v4
with:
lfs: true
ref: ${{ github.event.pull_request.head.sha }}
- name: Enable Go modules cache
uses: percona-platform/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ matrix.os }}-go-${{ matrix.go-version }}-modules-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ matrix.os }}-go-${{ matrix.go-version }}-modules-
- name: Enable Go build cache
uses: percona-platform/cache@v3
with:
path: ~/.cache/go-build
key: ${{ matrix.os }}-go-${{ matrix.go-version }}-build-${{ github.ref }}-${{ hashFiles('**') }}
restore-keys: |
${{ matrix.os }}-go-${{ matrix.go-version }}-build-${{ github.ref }}-
${{ matrix.os }}-go-${{ matrix.go-version }}-build-
- name: Set up Go release for CLI
uses: percona-platform/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Build CLI binary
run: |
make init
make build
- name: Create KIND cluster
uses: helm/kind-action@v1.8.0
- name: Configure git for private modules
env:
ROBOT_TOKEN: ${{ secrets.ROBOT_TOKEN }}
run: git config --global url."https://percona-platform-robot:${ROBOT_TOKEN}@github.com".insteadOf "https://github.com"
- name: Run integration tests
working-directory: cli-tests
id: cli-tests
run: |
make init
make install-operators
make test-cli
- name: Attach the report
if: ${{ always() && steps.cli-tests.outcome != 'skipped' }}
uses: actions/upload-artifact@v3
with:
name: cli-tests-report
path: cli-tests/test-report
integration_tests_flows:
strategy:
fail-fast: false
matrix:
make_target: [
'test-all-operators',
'test-mongo-operator',
'test-pg-operator',
'test-pxc-operator'
]
name: CLI tests
uses: ./.github/workflows/cli-tests.yml
secrets: inherit
with:
make_target: ${{ matrix.make_target }}