treetrail-backend/.forgejo/workflows/build-with-app-image.yaml

80 lines
2.1 KiB
YAML
Raw Normal View History

on:
2024-10-28 11:44:06 +01:00
workflow_dispatch:
inputs:
2024-10-28 11:59:40 +01:00
verbose:
2024-10-28 11:51:20 +01:00
description: "Verbose"
required: false
default: false
type: boolean
build:
2024-10-28 11:59:40 +01:00
description: "Build container image"
required: false
default: false
type: boolean
push:
description: "Push container image to registry"
2024-10-28 11:51:20 +01:00
required: false
default: false
type: boolean
jobs:
build:
runs-on: container
container:
image: tiptop:5000/treetrail-backend-ci
volumes:
2024-10-29 03:27:52 +01:00
- "uv_cache:/root/.cache/uv"
2024-10-29 03:33:57 +01:00
- "ca-cert:/etc/containers/certs.d"
services:
treetrail-database:
image: treetrail-database
2024-10-28 10:47:50 +01:00
env:
PYTHONPATH: /app/lib/python3.12/site-packages
2024-10-28 11:38:51 +01:00
UV_PROJECT_ENVIRONMENT: /app
steps:
- uses: actions/checkout@v4
- name: Install dependencies (to uv's project environment)
run: uv sync --locked --no-dev --no-editable
2024-10-28 11:38:51 +01:00
- name: Install dependencies for testing
run: uv pip install httpx
2024-10-28 10:37:11 +01:00
- name: Echo env
2024-10-28 11:51:20 +01:00
if: ${{ inputs.verbose }}
2024-10-28 10:43:31 +01:00
run: |
echo '${{ toJSON(env) }}'
2024-10-27 14:59:45 +01:00
- name: Run basic test (bootstrap)
run: pytest -s tests/basic.py
2024-10-28 11:54:42 +01:00
- name: Install podman and buildah
if: ${{ inputs.build }}
run: |
2024-10-28 11:59:40 +01:00
apt-get install -y --no-install-recommends podman buildah
2024-10-28 11:54:42 +01:00
2024-10-29 03:38:14 +01:00
- name: Log in to container registry
uses: actions/podman-login@v1
with:
registry: ${{ vars.REGISTRY }}
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
2024-10-29 03:54:33 +01:00
auth_file_path: /tmp/auth.json
2024-10-29 03:38:14 +01:00
- name: Build container image
2024-10-28 11:51:20 +01:00
if: ${{ inputs.build }}
uses: actions/buildah-build@v1
with:
image: treetrail-backend
#tags: foo # v1 ${{ github.sha }}
containerfiles: |
./Containerfile.for_runner
2024-10-29 03:38:14 +01:00
- name: Push container image to registry
uses: actions/push-to-registry@v2
2024-10-28 11:59:40 +01:00
if: ${{ inputs.push }}
with:
2024-10-28 18:37:55 +01:00
registry: "docker://${{ vars.REGISTRY }}"
image: treetrail-backend
tags: latest