CI: fix build
Some checks failed
/ build (push) Failing after 16s
/ test (push) Successful in 16s

This commit is contained in:
phil 2024-11-03 02:39:28 +01:00
parent c5ce114282
commit 48179db69b

View file

@ -7,40 +7,10 @@ on:
required: false required: false
default: false default: false
type: boolean type: boolean
build:
description: "Build container"
required: false
default: false
type: boolean
jobs: 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: build:
runs-on: container runs-on: container
if: ${{ inputs.build }}
container: container:
image: tiptop:5000/treetrail-backend-ci image: tiptop:5000/treetrail-backend-ci
volumes: volumes:
@ -53,22 +23,26 @@ jobs:
run: uv pip install --python=$UV_PROJECT_ENVIRONMENT --no-deps . run: uv pip install --python=$UV_PROJECT_ENVIRONMENT --no-deps .
- name: Git unshallow - get all history from Git to get the tag for the computation of the version - name: Git unshallow - get all history from Git to get the tag for the computation of the version
if: ${{ inputs.build }}
run: git pull --unshallow run: git pull --unshallow
- name: Get the version from git - name: Get the version from git
if: ${{ inputs.build }}
id: version id: version
run: echo "version=$(git describe --dirty --tags)" >> $GITHUB_OUTPUT run: echo "version=$(git describe --dirty --tags)" >> $GITHUB_OUTPUT
- name: Build the container image
uses: actions/buildah-build@v1
with:
image: treetrail-backend
tags: ${{ steps.version.outputs.version }}
containerfiles: |
./Containerfile
- name: Workaround for bug of podman-login - name: Workaround for bug of podman-login
if: ${{ inputs.build }}
run: | run: |
mkdir -p $HOME/.docker mkdir -p $HOME/.docker
echo "{ \"auths\": {} }" > $HOME/.docker/config.json echo "{ \"auths\": {} }" > $HOME/.docker/config.json
- name: Log in to the container registry (with another workaround) - name: Log in to the container registry (with another workaround)
if: ${{ inputs.build }}
uses: actions/podman-login@v1 uses: actions/podman-login@v1
with: with:
registry: ${{ vars.REGISTRY }} registry: ${{ vars.REGISTRY }}
@ -76,18 +50,8 @@ jobs:
password: ${{ secrets.REGISTRY_PASSWORD }} password: ${{ secrets.REGISTRY_PASSWORD }}
auth_file_path: /tmp/auth.json auth_file_path: /tmp/auth.json
- name: Build the container image
if: ${{ inputs.build }}
uses: actions/buildah-build@v1
with:
image: "treetrail-backend:${{ steps.version.outputs.version }}"
#tags: foo # v1 ${{ github.sha }}
containerfiles: |
./Containerfile
- name: Push the image to the registry - name: Push the image to the registry
uses: actions/push-to-registry@v2 uses: actions/push-to-registry@v2
if: ${{ inputs.build }}
with: with:
registry: "docker://${{ vars.REGISTRY }}" registry: "docker://${{ vars.REGISTRY }}"
image: treetrail-backend image: treetrail-backend