Fixes 3420: add service notify for templates (#566) #2449
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: build-test | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- '**.md' | |
pull_request: | |
paths-ignore: | |
- '**.md' | |
jobs: | |
openapidiff: | |
name: Openapi diff | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-go@v2 | |
with: | |
go-version: "1.20" | |
- run: | | |
go get -u github.com/swaggo/swag/cmd/swag | |
- run: | | |
make openapi | |
- run: | | |
git diff --exit-code api/openapi.json | |
openapivalidate: | |
name: openapi validate | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: openapi-generators/openapitools-generator-action@v1 | |
with: | |
generator: python | |
openapi-file: api/openapi.json | |
golangci: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-go@v2 | |
with: | |
go-version: "1.20" | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v2 | |
with: | |
version: v1.54.2 | |
skip-go-installation: true | |
args: --timeout=5m | |
checkmigrations: | |
name: Check db migrations | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: tj-actions/changed-files@v41 | |
id: files | |
- run: | | |
#!/bin/bash | |
migrations_latest=$(cat db/migrations.latest) | |
num_files_added=${{ steps.files.outputs.added_files_count }} | |
if [ "$num_files_added" -gt 0 ]; then | |
new_migrations_added=$(echo "${{ steps.files.outputs.added_files }}" | grep 'db/migrations' || true) | |
if [ -n "$new_migrations_added" ]; then | |
if echo "$new_migrations_added" | grep -q "$migrations_latest"; then | |
echo "OK: Latest migration content (db/migrations.latest) reflects the timestamp of the latest migrations added." | |
else | |
echo "Error: Latest migration content (db/migrations.latest) does NOT reflect the timestamp of the latest migrations added." | |
echo "New migration files added: $new_migrations_added" | |
echo "In db/migration.latest: $migrations_latest" | |
exit 1 | |
fi | |
else | |
echo "OK: No new migration files added." | |
fi | |
else | |
echo "OK: No new files added." | |
fi | |
gotest: | |
name: Test | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:15 | |
env: | |
POSTGRES_PASSWORD: postgres | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5433:5432 | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-go@v2 | |
with: | |
go-version: "1.20" | |
- name: unit tests | |
run: | | |
make get-deps ${PWD}/release/dbmigrate db-migrate-up test-unit | |
env: | |
DATABASE_HOST: localhost | |
DATABASE_PORT: 5433 | |
DATABASE_USER: postgres | |
DATABASE_NAME: postgres | |
DATABASE_PASSWORD: postgres | |
CLIENTS_PULP_SERVER: http://localhost:8080 | |
CLIENTS_PULP_USERNAME: admin | |
CLIENTS_PULP_PASSWORD: password | |
- name: start pulp | |
uses: isbang/[email protected] | |
with: | |
compose-file: ./compose_files/pulp/docker-compose.yml | |
down-flags: --volumes | |
- name: Wait for pulp | |
run: | | |
docker run --network=host --rm -v ${PWD}:/local curlimages/curl \ | |
curl --retry-all-errors --fail --retry-delay 10 --retry 32 --retry-max-time 240 http://localhost:8080/api/pulp/default/api/v3/repositories/rpm/rpm/ -u admin:password | |
sleep 30 | |
- name: integration tests | |
run: | | |
make test-integration | |
env: | |
DATABASE_HOST: localhost | |
DATABASE_PORT: 5433 | |
DATABASE_USER: postgres | |
DATABASE_NAME: postgres | |
DATABASE_PASSWORD: postgres | |
CLIENTS_PULP_SERVER: http://localhost:8080 | |
CLIENTS_PULP_USERNAME: admin | |
CLIENTS_PULP_PASSWORD: password | |
- name: db migration tests | |
run: | | |
make test-db-migrations | |
env: | |
DATABASE_HOST: localhost | |
DATABASE_PORT: 5433 | |
DATABASE_USER: postgres | |
DATABASE_NAME: postgres | |
DATABASE_PASSWORD: postgres | |
CLIENTS_PULP_SERVER: http://localhost:8080 | |
CLIENTS_PULP_USERNAME: admin | |
CLIENTS_PULP_PASSWORD: password | |