add build workflow

This commit is contained in:
Brian Rosner 2024-05-19 09:29:05 -06:00
parent 5293ede693
commit 099b75fb74

View File

@ -1,53 +1,18 @@
name: ci name: Build
on: on:
pull_request: workflow_run:
push: workflows: [Tests]
branches: [main] types:
- completed
env: env:
REGISTRY: ghcr.io REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }} IMAGE_NAME: ${{ github.repository }}
jobs: jobs:
prepare: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- name: build ci image
uses: docker/build-push-action@v5
with:
context: .
tags: teufa:ci
target: ci
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
push: false
tests:
runs-on: ubuntu-latest
needs: prepare
container: teufa:ci
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- run: pytest
build-push:
runs-on: ubuntu-latest
needs: tests
permissions: permissions:
contents: read contents: read
packages: write packages: write