Skip to content

ci: Adds ci to gh actions #5

ci: Adds ci to gh actions

ci: Adds ci to gh actions #5

Workflow file for this run

---
name: CI
on:
push:
branches: [main, rhobs-obs-api-konflux]
pull_request:
branches: [main, rhobs-obs-api-konflux]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24'
- name: Build
run: |
make build
git diff --exit-code
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24'
- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y xz-utils unzip shellcheck
- name: Install bingo
run: go install github.com/bwplotka/bingo@latest
- name: Lint
run: make lint --always-make
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24'
- name: Install dependencies
run: |
sudo apt-get update && sudo apt-get -y install xz-utils unzip openssl
- name: Test
run: make test --always-make
test-e2e:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y make
- name: Build e2e test container
run: |
echo "Building e2e test container..."
OCI_BIN=docker make container-test
echo "Available Docker images:"
docker images | grep observatorium || echo "No observatorium images found"
echo "Saving container image to cache..."
docker save quay.io/observatorium/api:local_e2e_test > /tmp/e2e-image.tar
- name: Load e2e test container
run: |
echo "Loading e2e test container..."
docker load < /tmp/e2e-image.tar
echo "Verifying image is loaded:"
docker images | grep observatorium
- name: End-to-end tests
run: |
echo "Running e2e tests..."
rm -rf test/e2e/e2e_*
OCI_BIN=docker CGO_ENABLED=1 GO111MODULE=on go test -timeout=25m -race -short -tags integration ./test/e2e 2>&1 | tee test_output.log
exit_code=${PIPESTATUS[0]}
if [ $exit_code -ne 0 ]; then
echo "Tests failed with exit code: $exit_code"
echo "Last 50 lines of output:"
tail -50 test_output.log
fi
exit $exit_code
generate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24'
- name: Install system dependencies
run: sudo apt-get update && sudo apt-get -y install unzip
- name: Install bingo
run: go install github.com/bwplotka/bingo@latest
- name: Generate and validate
run: |
make generate validate --always-make
make proto
git diff --exit-code