dishplanner/.forgejo/workflows/ci.yml
myrmidex d8c1830c71
Some checks failed
Build and Push Docker Image / build (push) Successful in 7m36s
CI / ci-image (push) Failing after 3h0m57s
CI / ci (push) Has been skipped
46 - Tag CI image by composer.lock hash and build it in CI
2026-08-17 23:13:43 +02:00

68 lines
1.9 KiB
YAML

name: CI
on:
push:
branches: ['release/*']
pull_request:
branches: [main, 'release/*']
jobs:
ci-image:
runs-on: docker
container:
image: catthehacker/ubuntu:act-latest
outputs:
tag: ${{ steps.meta.outputs.tag }}
steps:
- uses: https://data.forgejo.org/actions/checkout@v4
- name: Set up Docker Buildx
uses: https://data.forgejo.org/docker/setup-buildx-action@v3
- name: Login to Forgejo Registry
uses: https://data.forgejo.org/docker/login-action@v3
with:
registry: forge.lvl0.xyz
username: ${{ github.actor }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Compute image tag from lockfile
id: meta
run: |
HASH="$(sha256sum composer.lock | cut -c1-12)"
echo "tag=php8.3-${HASH}" >> "$GITHUB_OUTPUT"
- name: Build and push CI image
uses: https://data.forgejo.org/docker/build-push-action@v5
with:
context: .
file: docker/build/Dockerfile.ci
push: true
tags: forge.lvl0.xyz/lvl0/dishplanner-ci:${{ steps.meta.outputs.tag }}
cache-from: type=registry,ref=forge.lvl0.xyz/lvl0/dishplanner-ci:buildcache
cache-to: type=registry,ref=forge.lvl0.xyz/lvl0/dishplanner-ci:buildcache,mode=max
ci:
needs: ci-image
runs-on: docker
container:
image: forge.lvl0.xyz/lvl0/dishplanner-ci:${{ needs.ci-image.outputs.tag }}
steps:
- uses: https://data.forgejo.org/actions/checkout@v4
- name: Prepare environment
run: cp .env.testing .env
- name: Restore dependencies
run: |
cp -a /opt/deps/vendor ./vendor
composer install --no-interaction --no-progress
- name: Lint
run: vendor/bin/pint --test
- name: Static analysis
run: vendor/bin/phpstan analyse --memory-limit=1G
- name: Tests
run: php -d memory_limit=512M vendor/bin/phpunit