Skip to content

Test setup for konflux #3283

Test setup for konflux

Test setup for konflux #3283

Workflow file for this run

---
name: checks
on:
push:
branches:
- main
pull_request:
env:
# this must match the version in go.mod
GO_SVR: 1.21.9
jobs:
commit:
name: "💬 Commit checks"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 2
path: code
- uses: actions/checkout@v3
with:
repository: "RHEnVision/changelog"
path: changelog
- run: pip3 install ./changelog
- run: |
make check-commits
working-directory: code
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/action@v3.0.0
build:
name: "🛠 Go Build"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_SVR }}
cache: true
- name: Build all artifacts
run: |
make check-system-go build GO=go
lint:
name: "🏢 Code format & OpenAPI lint"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_SVR }}
# disabled until 'lookup-only' is implemented for setup-go or cache prefix is added
cache: false
- uses: actions/cache@v3
id: cache
with:
path: bin
key: bin-go${{ env.GO_SVR }}-tools-${{ hashFiles('mk/tools.mk') }}
- name: Install Go Tools
if: steps.cache.outputs.cache-hit != 'true'
run: make install-tools GO=go
- name: Generate and validate
run: |
touch config/_config.yaml
make check-system-go check-fmt validate GO=go
golint:
name: "🏫 Go linter"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_SVR }}
# disabled because golangci linter caches Go packages and modules
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.55.2
testing:
name: "🏅 Unit tests"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_SVR }}
# disabled until lookup-only or cache prefix is added
# (https://github.com/actions/setup-go/issues/316)
cache: false
- run: |
make check-system-go test GO=go
test-dao:
name: "🏆 Integration tests"
runs-on: ubuntu-latest
services:
postgres:
image: postgres:15
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: foobar
POSTGRES_DB: provisioning_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
redis:
image: redis
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_SVR }}
# disabled until lookup-only or cache prefix is added
# (https://github.com/actions/setup-go/issues/316)
cache: false
- name: "Run tests"
env:
DATABASE_USER: postgres
DATABASE_PASSWORD: foobar
DATABASE_NAME: provisioning_test
WORKER_QUEUE: redis
run: make check-system-go integration-test check-migrations GO=go