treetrail-backend/.forgejo/workflows/build.yaml
phil d552656e95
All checks were successful
/ build (push) Successful in 20s
CI: don't build the container image by default
2024-11-02 05:30:27 +01:00

71 lines
1.9 KiB
YAML

on:
push:
workflow_dispatch:
inputs:
verbose:
description: "Verbose"
required: false
default: false
type: boolean
build:
description: "Build container"
required: false
default: false
type: boolean
jobs:
build:
runs-on: container
container:
image: tiptop:5000/treetrail-backend-ci
volumes:
- "uv_cache:/root/.cache/uv"
- "ca-cert:/etc/containers/certs.d"
services:
treetrail-database:
image: treetrail-database
steps:
- name: Echo env
if: ${{ inputs.verbose }}
run: |
echo '${{ toJSON(env) }}'
- uses: actions/checkout@v4
- name: Install app with 'uv pip install'
run: uv pip install --python=$UV_PROJECT_ENVIRONMENT --no-deps .
- name: Run basic test (API call)
run: pytest -s tests/basic.py
- name: Workaround for bug of podman-login
if: ${{ inputs.build }}
run: |
mkdir -p $HOME/.docker
echo "{ \"auths\": {} }" > $HOME/.docker/config.json
- name: Log in to the container registry (with another workaround)
if: ${{ inputs.build }}
uses: actions/podman-login@v1
with:
registry: ${{ vars.REGISTRY }}
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
auth_file_path: /tmp/auth.json
- name: Build the container image
if: ${{ inputs.build }}
uses: actions/buildah-build@v1
with:
image: treetrail-backend
#tags: foo # v1 ${{ github.sha }}
containerfiles: |
./Containerfile.for_runner
- name: Push the image to the registry
uses: actions/push-to-registry@v2
if: ${{ inputs.build }}
with:
registry: "docker://${{ vars.REGISTRY }}"
image: treetrail-backend
tags: latest