CI: fix file name
This commit is contained in:
parent
93d414673c
commit
5ef71e1f17
1 changed files with 0 additions and 0 deletions
101
.forgejo/workflows/test_and_build.yaml
Normal file
101
.forgejo/workflows/test_and_build.yaml
Normal file
|
@ -0,0 +1,101 @@
|
|||
on:
|
||||
push:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
verbose:
|
||||
description: "Verbose"
|
||||
required: false
|
||||
default: false
|
||||
type: boolean
|
||||
build:
|
||||
description: "Build container"
|
||||
required: true
|
||||
default: true
|
||||
type: boolean
|
||||
|
||||
jobs:
|
||||
test:
|
||||
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 tests (API call)
|
||||
run: pytest -s tests/basic.py
|
||||
|
||||
build:
|
||||
runs-on: container
|
||||
needs: test
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Get the version from git
|
||||
id: version
|
||||
run: echo "version=$(git describe --dirty --tags)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Check if the container should be built
|
||||
id: builder
|
||||
env:
|
||||
RUN: ${{ toJSON(inputs.build || !contains(steps.version.outputs.version, '-')) }}
|
||||
run: |
|
||||
echo "run=$RUN" >> $GITHUB_OUTPUT
|
||||
echo "Run build: $RUN"
|
||||
|
||||
- name: Info - version and if the image container should be built
|
||||
env:
|
||||
VERSION: ${{ steps.version.outputs.version }}
|
||||
RUN: ${{ steps.builder.outputs.run }}
|
||||
FORCE: ${{ toJSON(inputs.build) }}
|
||||
run: |
|
||||
echo "Version $VERSION, force (manual input): $FORCE, run the build: $RUN"
|
||||
|
||||
- name: Workaround for bug of podman-login
|
||||
if: fromJSON(steps.builder.outputs.run)
|
||||
run: |
|
||||
mkdir -p $HOME/.docker
|
||||
echo "{ \"auths\": {} }" > $HOME/.docker/config.json
|
||||
|
||||
- name: Log in to the container registry (with another workaround)
|
||||
if: fromJSON(steps.builder.outputs.run)
|
||||
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: fromJSON(steps.builder.outputs.run)
|
||||
uses: actions/buildah-build@v1
|
||||
with:
|
||||
image: treetrail-backend
|
||||
oci: true
|
||||
labels: treetrail-backend
|
||||
tags: ${{ steps.version.outputs.version }}
|
||||
containerfiles: |
|
||||
./Containerfile
|
||||
|
||||
- name: Push the image to the registry
|
||||
if: fromJSON(steps.builder.outputs.run)
|
||||
uses: actions/push-to-registry@v2
|
||||
with:
|
||||
registry: "docker://${{ vars.REGISTRY }}"
|
||||
image: treetrail-backend
|
||||
tags: ${{ steps.version.outputs.version }}
|
Loading…
Add table
Add a link
Reference in a new issue