api: Add Get Blueprint API endpoint #10
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: Tests | |
on: | |
pull_request: | |
branches: | |
- "*" | |
push: | |
branches: | |
- main | |
merge_group: | |
jobs: | |
lint: | |
name: "π Checks" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Go 1.19 | |
uses: actions/[email protected] | |
with: | |
go-version: 1.19 | |
id: go | |
- name: Check out code into the Go module directory | |
uses: actions/[email protected] | |
- name: Check that source has been prepared | |
run: | | |
./tools/prepare-source.sh | |
if [ -n "$(git status --porcelain)" ]; then | |
echo | |
echo "Please include these changes in your branch: " | |
git status -vv | |
exit "1" | |
else | |
exit "0" | |
fi | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
version: v1.50.1 | |
- name: install tern | |
run: go install github.com/jackc/tern@latest | |
- name: Run unit tests | |
run: go test -v -race -covermode=atomic -coverprofile=coverage.txt -coverpkg=./... ./... | |
- name: Send coverage to codecov.io | |
run: bash <(curl -s https://codecov.io/bash) | |
speccheck: | |
name: "π openapi spec check" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
- name: Install openapi-spec-validator | |
run: pip install openapi-spec-validator | |
- name: Check v1 spec | |
run: make check-api-spec | |
shellcheck: | |
name: "π Shellcheck" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
- name: Run ShellCheck | |
uses: ludeeus/[email protected] | |
with: | |
ignore: vendor # We don't want to fix the code in vendored dependencies | |
env: | |
# don't check /etc/os-release sourcing and allow useless cats to live inside our codebase | |
# allow seemingly unreachable commands | |
SHELLCHECK_OPTS: -e SC1091 -e SC2002 -e SC2317 | |
db-test: | |
name: "π DB check" | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: foobar | |
POSTGRES_DB: imagebuilder | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
steps: | |
- uses: actions/[email protected] | |
- uses: actions/[email protected] | |
with: | |
go-version: 1.19 | |
- env: | |
MIGRATIONS_DIR: internal/db/migrations | |
TERN_MIGRATIONS_DIR: internal/db/migrations-tern | |
PGUSER: postgres | |
PGPASSWORD: foobar | |
PGDATABASE: imagebuilder | |
PGHOST: localhost | |
PGPORT: 5432 | |
run: | | |
go install github.com/jackc/tern@latest | |
tern migrate -m "$TERN_MIGRATIONS_DIR" | |
make build | |
./image-builder-db-test | |
kube-linter: | |
name: "π kube-linter" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
- uses: redhat-actions/oc-installer@v1 | |
- name: Process template | |
run: | | |
mkdir processed-templates | |
oc process -f templates/image-builder.yml \ | |
-p IMAGE_TAG=image_tag \ | |
--local \ | |
-o yaml > processed-templates/image-builder.yml | |
oc process -f templates/iqe-trigger-integration.yml \ | |
-p IMAGE_TAG=image_tag \ | |
--local \ | |
-o yaml > processed-templates/iqe-trigger-integration.yml | |
- uses: stackrox/[email protected] | |
with: | |
directory: processed-templates | |
config: templates/.kube-linter-config.yml |