2024-10-27 04:36:35 +01:00
|
|
|
on:
|
|
|
|
push:
|
2024-10-28 11:44:06 +01:00
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
|
|
|
logLevel:
|
|
|
|
description: "Log level"
|
|
|
|
required: true
|
|
|
|
default: "warning"
|
|
|
|
type: choice
|
|
|
|
options:
|
|
|
|
- info
|
|
|
|
- warning
|
|
|
|
- debug
|
2024-10-27 04:36:35 +01:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: container
|
|
|
|
container:
|
|
|
|
image: tiptop:5000/treetrail-backend-ci
|
|
|
|
volumes:
|
2024-10-28 10:36:26 +01:00
|
|
|
- "/root/.cache/uv:uv_cache"
|
2024-10-27 04:36:35 +01:00
|
|
|
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
|
2024-10-27 04:36:35 +01:00
|
|
|
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:45:53 +01:00
|
|
|
if: ${{ inputs.logLevel }} == 'debug'
|
2024-10-28 10:43:31 +01:00
|
|
|
run: |
|
|
|
|
echo '${{ toJSON(env) }}'
|
2024-10-27 14:59:45 +01:00
|
|
|
|
2024-10-27 04:36:35 +01:00
|
|
|
- name: Run basic test (bootstrap)
|
|
|
|
run: pytest -s tests/basic.py
|
|
|
|
|
|
|
|
- name: Build container
|
|
|
|
uses: actions/buildah-build@v1
|
|
|
|
with:
|
|
|
|
image: treetrail-backend
|
|
|
|
#tags: foo # v1 ${{ github.sha }}
|
|
|
|
containerfiles: |
|
|
|
|
./Containerfile.for_runner
|
|
|
|
|
|
|
|
- uses: actions/push-to-registry@v2
|
|
|
|
with:
|
|
|
|
registry: "docker://${{ vars.REPOSITORY }}"
|
|
|
|
image: treetrail-backend
|
|
|
|
tags: latest
|