Compare commits
No commits in common. "main" and "v0.8.0" have entirely different histories.
3 changed files with 56 additions and 46 deletions
|
|
@ -7,46 +7,10 @@ on:
|
||||||
branches: [main, 'release/*']
|
branches: [main, 'release/*']
|
||||||
|
|
||||||
jobs:
|
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:
|
ci:
|
||||||
needs: ci-image
|
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
container:
|
container:
|
||||||
image: forge.lvl0.xyz/lvl0/dishplanner-ci:${{ needs.ci-image.outputs.tag }}
|
image: forge.lvl0.xyz/lvl0/dishplanner-ci:php8.3-4
|
||||||
steps:
|
steps:
|
||||||
- uses: https://data.forgejo.org/actions/checkout@v4
|
- uses: https://data.forgejo.org/actions/checkout@v4
|
||||||
|
|
||||||
|
|
@ -56,7 +20,7 @@ jobs:
|
||||||
- name: Restore dependencies
|
- name: Restore dependencies
|
||||||
run: |
|
run: |
|
||||||
cp -a /opt/deps/vendor ./vendor
|
cp -a /opt/deps/vendor ./vendor
|
||||||
composer install --no-interaction --no-progress
|
composer install --no-interaction --no-progress --prefer-source
|
||||||
|
|
||||||
- name: Lint
|
- name: Lint
|
||||||
run: vendor/bin/pint --test
|
run: vendor/bin/pint --test
|
||||||
|
|
|
||||||
46
.forgejo/workflows/images.yml
Normal file
46
.forgejo/workflows/images.yml
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
name: Build and Push Base Images
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
paths:
|
||||||
|
- 'docker/build/**'
|
||||||
|
- 'composer.json'
|
||||||
|
- 'composer.lock'
|
||||||
|
- '.forgejo/workflows/images.yml'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
images:
|
||||||
|
runs-on: docker
|
||||||
|
container:
|
||||||
|
image: catthehacker/ubuntu:act-latest
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- name: dishplanner-ci
|
||||||
|
file: docker/build/Dockerfile.ci
|
||||||
|
version: php8.3-4
|
||||||
|
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: Build and push
|
||||||
|
uses: https://data.forgejo.org/docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ${{ matrix.file }}
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
forge.lvl0.xyz/lvl0/${{ matrix.name }}:${{ matrix.version }}
|
||||||
|
forge.lvl0.xyz/lvl0/${{ matrix.name }}:latest
|
||||||
|
forge.lvl0.xyz/lvl0/${{ matrix.name }}:${{ github.sha }}
|
||||||
|
|
@ -2,9 +2,9 @@
|
||||||
# Tests run against SQLite in memory (see .env.testing), so no database client
|
# Tests run against SQLite in memory (see .env.testing), so no database client
|
||||||
# or cache extension is needed.
|
# or cache extension is needed.
|
||||||
#
|
#
|
||||||
# Published as dishplanner-ci:php8.3-<composer.lock hash>. The CI workflow
|
# Published as dishplanner-ci:php8.3-<revision>. Bump the revision in the tag
|
||||||
# builds and tags this image from the current lockfile, so a dependency change
|
# (.forgejo/workflows/images.yml) and in .forgejo/workflows/ci.yml whenever
|
||||||
# automatically yields a fresh, uniquely-tagged image (no manual revision bump).
|
# this file changes (runners cache mutable tags and will not re-pull them).
|
||||||
#
|
#
|
||||||
# Debian-based rather than Alpine to avoid the DNS resolution timeouts against
|
# Debian-based rather than Alpine to avoid the DNS resolution timeouts against
|
||||||
# codeload.github.com that the Alpine base hit during composer install.
|
# codeload.github.com that the Alpine base hit during composer install.
|
||||||
|
|
@ -32,13 +32,13 @@ COPY --from=composer:2 /usr/bin/composer /usr/bin/composer
|
||||||
|
|
||||||
# Bake the project's PHP dependencies (dev included) into the image so CI
|
# Bake the project's PHP dependencies (dev included) into the image so CI
|
||||||
# restores them with a local copy instead of paying a per-run composer install
|
# restores them with a local copy instead of paying a per-run composer install
|
||||||
# over the network. --prefer-source clones via git instead of fetching dist
|
# over the network. Build this image on a network that isn't
|
||||||
# archives, avoiding the codeload.github.com rate limits the runner hits under
|
# codeload-rate-limited (e.g. locally) — the Forgejo runner hits codeload 429
|
||||||
# --prefer-dist.
|
# under --prefer-dist.
|
||||||
#
|
#
|
||||||
# --no-scripts skips `php artisan package:discover` (the app isn't present
|
# --no-scripts skips `php artisan package:discover` (the app isn't present
|
||||||
# here). CI runs `composer install` after restoring vendor, which regenerates
|
# here). CI runs `composer install` after restoring vendor, which regenerates
|
||||||
# bootstrap/cache.
|
# bootstrap/cache and tops up any lockfile drift between main and release/*.
|
||||||
WORKDIR /opt/deps
|
WORKDIR /opt/deps
|
||||||
COPY composer.json composer.lock ./
|
COPY composer.json composer.lock ./
|
||||||
RUN composer install --no-interaction --no-progress --prefer-source --no-scripts
|
RUN composer install --no-interaction --no-progress --prefer-dist --no-scripts
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue