Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Update dependencies and update webhooks #721

Update dependencies and update webhooks

Update dependencies and update webhooks #721

Workflow file for this run

name: Build and Test
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
product_name: db-operator
go_os: linux
go_arch: amd64
main_go_path: .
jobs:
lint: ## https://github.com/golangci/golangci-lint-action#how-to-use
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get go version
run: echo "GO_VERSION=$(make desired_go_version)" >> "${GITHUB_ENV}"
- name: Setup GO
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Check Code Style
run: make lint
unit-test:
runs-on: ubuntu-latest
needs: lint
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get go version
run: echo "GO_VERSION=$(make desired_go_version)" >> "${GITHUB_ENV}"
- name: Setup GO
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Run the unit tests
run: go test -tags tests -run "TestUnit" ./... -v -cover
kubernetes-tests:
runs-on: ubuntu-latest
needs: lint
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get go version
run: echo "GO_VERSION=$(make desired_go_version)" >> "${GITHUB_ENV}"
- name: Setup GO
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Prepare the test environment
run: make envtest
- name: Run the kubernetes integration tests
run: go test -tags tests -run "TestKubernetes" ./... -v -cover
gsql-test:
runs-on: ubuntu-latest
needs: lint
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get go version
run: echo "GO_VERSION=$(make desired_go_version)" >> "${GITHUB_ENV}"
- name: Setup GO
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
- name: Start dependencies using docker-compose
run: docker compose -f ./resources/test/docker-compose-gsql.yml up -d
- name: Run gsql tests
run: go test -tags tests -run "TestGsql" ./... -v -cover
mysql-test:
runs-on: ubuntu-latest
needs: lint
strategy:
matrix:
image:
- mysql:5.7
- mysql:8.0
- mysql:9.1
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get go version
run: echo "GO_VERSION=$(make desired_go_version)" >> "${GITHUB_ENV}"
- name: Setup GO
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
# The existing apparmor profile for mysql needs to be removed.
# https://github.com/actions/virtual-environments/issues/181
# https://github.com/moby/moby/issues/7512#issuecomment-51845976
- name: Remove MySQL App Armour Configuration
run: |
set -x
sudo apt-get update
sudo apt-get remove mysql-server --purge
sudo apt-get install apparmor-profiles
sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld
- name: Run the unit tests
run: ./scripts/test_database -d mysql -i ${{ matrix.image }} -f ./resources/test/docker-compose-mysql-tmpl.yml
mariadb-test:
runs-on: ubuntu-latest
needs: lint
strategy:
matrix:
image:
- mariadb:10.5
- mariadb:10.6
- mariadb:10.11
- mariadb:11.2
- mariadb:11.3
- mariadb:11.4
- mariadb:11.5
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get go version
run: echo "GO_VERSION=$(make desired_go_version)" >> "${GITHUB_ENV}"
- name: Setup GO
uses: actions/setup-go@v3
with:
go-version: ${{ env.GO_VERSION }}
# The existing apparmor profile for mysql needs to be removed.
# https://github.com/actions/virtual-environments/issues/181
# https://github.com/moby/moby/issues/7512#issuecomment-51845976
- name: Remove MySQL App Armour Configuration
run: |
set -x
sudo apt-get update
sudo apt-get remove mysql-server --purge
sudo apt-get install apparmor-profiles
sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld
- name: Run the unit tests
run: ./scripts/test_database -d mysql -i ${{ matrix.image }} -f ./resources/test/docker-compose-mariadb-tmpl.yml
postgres-test:
runs-on: ubuntu-latest
needs: lint
strategy:
matrix:
image:
- postgres:17
- postgres:16
- postgres:15
- postgres:14
- postgres:13
- postgres:12
- postgres:11
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.go_version }}
- name: Run the unit tests
run: ./scripts/test_database -d postgres -i ${{ matrix.image }} -f ./resources/test/docker-compose-postgres-tmpl.yml
# -------------------------------------------------------------------
# -- Azure Flexible Postgres test
# -- Azure doesn't give you a super-admin user, so there is an init
# -- script that imitates the Azure Flexible Server behaviour
# -------------------------------------------------------------------
postgres-az-test:
runs-on: ubuntu-latest
needs: lint
strategy:
matrix:
image:
# -- Trusted extensions were added only in 13, we need them for tests
- postgres:14
- postgres:13
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.go_version }}
- name: Run the unit tests
run: ./scripts/test_database -d postgres -i ${{ matrix.image }} -f ./resources/test/docker-compose-az-flexible-postgres-tmpl.yml