1
0
Fork 0
mirror of https://forgejo.ellis.link/continuwuation/continuwuity.git synced 2025-09-15 17:26:58 +00:00

fix: Resolve Forgejo runner v11 matrix job execution failure

Matrix jobs stopped starting after upgrading from runner v9 to v11 due to
changes in job dependency resolution. Remove redundant define-variables job
that computed static image paths and replace with IMAGE_PATH environment
variable.

Also fix timelord action binary caching for compatibility between different
runner images that install cargo binaries in different locations.
This commit is contained in:
Tom Foster 2025-09-13 16:17:28 +01:00
parent 0bbc3c4e05
commit 81b6b3547c
2 changed files with 26 additions and 50 deletions

View file

@ -27,25 +27,28 @@ runs:
echo "TIMELORD_KEY=${{ inputs.key || format('timelord-v1-{0}-{1}', github.repository, hashFiles('**/*.rs', '**/Cargo.toml', '**/Cargo.lock')) }}" >> $GITHUB_ENV echo "TIMELORD_KEY=${{ inputs.key || format('timelord-v1-{0}-{1}', github.repository, hashFiles('**/*.rs', '**/Cargo.toml', '**/Cargo.lock')) }}" >> $GITHUB_ENV
echo "TIMELORD_PATH=${{ inputs.path || '.' }}" >> $GITHUB_ENV echo "TIMELORD_PATH=${{ inputs.path || '.' }}" >> $GITHUB_ENV
echo "TIMELORD_CACHE_PATH=$HOME/.cache/timelord" >> $GITHUB_ENV echo "TIMELORD_CACHE_PATH=$HOME/.cache/timelord" >> $GITHUB_ENV
echo "PATH=/usr/share/rust/.cargo/bin:$HOME/.cargo/bin:$PATH" >> $GITHUB_ENV
- name: Restore binary cache - name: Restore binary cache
id: binary-cache id: binary-cache
uses: actions/cache/restore@v4 uses: actions/cache/restore@v4
with: with:
path: /usr/share/rust/.cargo/bin path: |
key: timelord-binaries-v1 /usr/share/rust/.cargo/bin
~/.cargo/bin
key: timelord-binaries-v2
- name: Check if binaries need installation - name: Check if binaries need installation
shell: bash shell: bash
id: check-binaries id: check-binaries
run: | run: |
NEED_INSTALL=false NEED_INSTALL=false
if [ ! -e /usr/share/rust/.cargo/bin/timelord ]; then if [ ! -e /usr/share/rust/.cargo/bin/timelord ] && [ ! -e ~/.cargo/bin/timelord ]; then
echo "timelord-cli not found at /usr/share/rust/.cargo/bin/timelord, needs installation" echo "timelord-cli not found in /usr/share/rust/.cargo/bin or ~/.cargo/bin, needs installation"
NEED_INSTALL=true NEED_INSTALL=true
fi fi
if [ ! -e /usr/share/rust/.cargo/bin/git-warp-time ]; then if [ ! -e /usr/share/rust/.cargo/bin/git-warp-time ] && [ ! -e ~/.cargo/bin/git-warp-time ]; then
echo "git-warp-time not found at /usr/share/rust/.cargo/bin/git-warp-time, needs installation" echo "git-warp-time not found in /usr/share/rust/.cargo/bin or ~/.cargo/bin, needs installation"
NEED_INSTALL=true NEED_INSTALL=true
fi fi
echo "need-install=$NEED_INSTALL" >> $GITHUB_OUTPUT echo "need-install=$NEED_INSTALL" >> $GITHUB_OUTPUT
@ -60,8 +63,10 @@ runs:
if: steps.check-binaries.outputs.need-install == 'true' if: steps.check-binaries.outputs.need-install == 'true'
uses: actions/cache/save@v4 uses: actions/cache/save@v4
with: with:
path: /usr/share/rust/.cargo/bin path: |
key: timelord-binaries-v1 /usr/share/rust/.cargo/bin
~/.cargo/bin
key: timelord-binaries-v2
- name: Restore timelord cache with fallbacks - name: Restore timelord cache with fallbacks
@ -80,9 +85,9 @@ runs:
echo "Complete timelord cache miss - running git-warp-time" echo "Complete timelord cache miss - running git-warp-time"
git fetch --unshallow git fetch --unshallow
if [ "${{ env.TIMELORD_PATH }}" = "." ]; then if [ "${{ env.TIMELORD_PATH }}" = "." ]; then
/usr/share/rust/.cargo/bin/git-warp-time --quiet git-warp-time --quiet
else else
/usr/share/rust/.cargo/bin/git-warp-time --quiet ${{ env.TIMELORD_PATH }} git-warp-time --quiet ${{ env.TIMELORD_PATH }}
fi fi
echo "Git timestamps restored" echo "Git timestamps restored"
@ -90,7 +95,7 @@ runs:
shell: bash shell: bash
run: | run: |
mkdir -p ${{ env.TIMELORD_CACHE_PATH }} mkdir -p ${{ env.TIMELORD_CACHE_PATH }}
/usr/share/rust/.cargo/bin/timelord sync --source-dir ${{ env.TIMELORD_PATH }} --cache-dir ${{ env.TIMELORD_CACHE_PATH }} timelord sync --source-dir ${{ env.TIMELORD_PATH }} --cache-dir ${{ env.TIMELORD_CACHE_PATH }}
- name: Save updated timelord cache immediately - name: Save updated timelord cache immediately
uses: actions/cache/save@v4 uses: actions/cache/save@v4

View file

@ -29,41 +29,12 @@ on:
env: env:
BUILTIN_REGISTRY: forgejo.ellis.link BUILTIN_REGISTRY: forgejo.ellis.link
BUILTIN_REGISTRY_ENABLED: "${{ ((vars.BUILTIN_REGISTRY_USER && secrets.BUILTIN_REGISTRY_PASSWORD) || (github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false)) && 'true' || 'false' }}" BUILTIN_REGISTRY_ENABLED: "${{ ((vars.BUILTIN_REGISTRY_USER && secrets.BUILTIN_REGISTRY_PASSWORD) || (github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false)) && 'true' || 'false' }}"
IMAGE_PATH: forgejo.ellis.link/continuwuation/continuwuity
jobs: jobs:
define-variables:
name: "Setup Variables"
runs-on: ubuntu-latest
outputs:
images: ${{ steps.var.outputs.images }}
images_list: ${{ steps.var.outputs.images_list }}
steps:
- name: Setting variables
uses: https://github.com/actions/github-script@v8
id: var
with:
script: |
const githubRepo = '${{ github.repository }}'.toLowerCase()
const repoId = githubRepo.split('/')[1]
core.setOutput('github_repository', githubRepo)
const builtinImage = '${{ env.BUILTIN_REGISTRY }}/' + githubRepo
let images = []
if (process.env.BUILTIN_REGISTRY_ENABLED === "true") {
images.push(builtinImage)
} else {
// Fallback to official registry for forks/PRs without credentials
images.push('forgejo.ellis.link/continuwuation/continuwuity')
}
core.setOutput('images', images.join("\n"))
core.setOutput('images_list', images.join(","))
build-release: build-release:
name: "Build ${{ matrix.slug }} (release)" name: "Build ${{ matrix.slug }} (release)"
runs-on: dind runs-on: dind
needs: define-variables
permissions: permissions:
contents: read contents: read
packages: write packages: write
@ -90,7 +61,7 @@ jobs:
slug: ${{ matrix.slug }} slug: ${{ matrix.slug }}
target_cpu: "" target_cpu: ""
profile: "release" profile: "release"
images: ${{ needs.define-variables.outputs.images }} images: ${{ env.IMAGE_PATH }}
registry_user: ${{ vars.BUILTIN_REGISTRY_USER || github.actor }} registry_user: ${{ vars.BUILTIN_REGISTRY_USER || github.actor }}
registry_password: ${{ secrets.BUILTIN_REGISTRY_PASSWORD || secrets.GITHUB_TOKEN }} registry_password: ${{ secrets.BUILTIN_REGISTRY_PASSWORD || secrets.GITHUB_TOKEN }}
- name: Build and push Docker image by digest - name: Build and push Docker image by digest
@ -114,7 +85,7 @@ jobs:
# cache-to: type=gha,mode=max # cache-to: type=gha,mode=max
sbom: true sbom: true
outputs: | outputs: |
${{ env.BUILTIN_REGISTRY_ENABLED == 'true' && format('type=image,"name={0}",push-by-digest=true,name-canonical=true,push=true', needs.define-variables.outputs.images_list) || format('type=image,"name={0}",push=false', needs.define-variables.outputs.images_list) }} ${{ env.BUILTIN_REGISTRY_ENABLED == 'true' && format('type=image,"name={0}",push-by-digest=true,name-canonical=true,push=true', env.IMAGE_PATH) || format('type=image,"name={0}",push=false', env.IMAGE_PATH) }}
type=local,dest=/tmp/binaries type=local,dest=/tmp/binaries
env: env:
SOURCE_DATE_EPOCH: ${{ env.TIMESTAMP }} SOURCE_DATE_EPOCH: ${{ env.TIMESTAMP }}
@ -130,7 +101,7 @@ jobs:
merge-release: merge-release:
name: "Create Multi-arch Release Manifest" name: "Create Multi-arch Release Manifest"
runs-on: dind runs-on: dind
needs: [define-variables, build-release] needs: build-release
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v5 uses: actions/checkout@v5
@ -141,14 +112,14 @@ jobs:
with: with:
digest_pattern: "digests-linux-{amd64,arm64}" digest_pattern: "digests-linux-{amd64,arm64}"
tag_suffix: "" tag_suffix: ""
images: ${{ needs.define-variables.outputs.images }} images: ${{ env.IMAGE_PATH }}
registry_user: ${{ vars.BUILTIN_REGISTRY_USER || github.actor }} registry_user: ${{ vars.BUILTIN_REGISTRY_USER || github.actor }}
registry_password: ${{ secrets.BUILTIN_REGISTRY_PASSWORD || secrets.GITHUB_TOKEN }} registry_password: ${{ secrets.BUILTIN_REGISTRY_PASSWORD || secrets.GITHUB_TOKEN }}
build-maxperf: build-maxperf:
name: "Build ${{ matrix.slug }} (max-perf)" name: "Build ${{ matrix.slug }} (max-perf)"
runs-on: dind runs-on: dind
needs: [define-variables, build-release] needs: build-release
permissions: permissions:
contents: read contents: read
packages: write packages: write
@ -177,7 +148,7 @@ jobs:
slug: ${{ matrix.slug }} slug: ${{ matrix.slug }}
target_cpu: ${{ matrix.target_cpu }} target_cpu: ${{ matrix.target_cpu }}
profile: "release-max-perf" profile: "release-max-perf"
images: ${{ needs.define-variables.outputs.images }} images: ${{ env.IMAGE_PATH }}
registry_user: ${{ vars.BUILTIN_REGISTRY_USER || github.actor }} registry_user: ${{ vars.BUILTIN_REGISTRY_USER || github.actor }}
registry_password: ${{ secrets.BUILTIN_REGISTRY_PASSWORD || secrets.GITHUB_TOKEN }} registry_password: ${{ secrets.BUILTIN_REGISTRY_PASSWORD || secrets.GITHUB_TOKEN }}
- name: Build and push max-perf Docker image by digest - name: Build and push max-perf Docker image by digest
@ -201,7 +172,7 @@ jobs:
# cache-to: type=gha,mode=max # cache-to: type=gha,mode=max
sbom: true sbom: true
outputs: | outputs: |
${{ env.BUILTIN_REGISTRY_ENABLED == 'true' && format('type=image,"name={0}",push-by-digest=true,name-canonical=true,push=true', needs.define-variables.outputs.images_list) || format('type=image,"name={0}",push=false', needs.define-variables.outputs.images_list) }} ${{ env.BUILTIN_REGISTRY_ENABLED == 'true' && format('type=image,"name={0}",push-by-digest=true,name-canonical=true,push=true', env.IMAGE_PATH) || format('type=image,"name={0}",push=false', env.IMAGE_PATH) }}
type=local,dest=/tmp/binaries type=local,dest=/tmp/binaries
env: env:
SOURCE_DATE_EPOCH: ${{ env.TIMESTAMP }} SOURCE_DATE_EPOCH: ${{ env.TIMESTAMP }}
@ -217,7 +188,7 @@ jobs:
merge-maxperf: merge-maxperf:
name: "Create Max-Perf Manifest" name: "Create Max-Perf Manifest"
runs-on: dind runs-on: dind
needs: [define-variables, build-maxperf] needs: build-maxperf
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v5 uses: actions/checkout@v5
@ -228,6 +199,6 @@ jobs:
with: with:
digest_pattern: "digests-maxperf-linux-{amd64-haswell,arm64}" digest_pattern: "digests-maxperf-linux-{amd64-haswell,arm64}"
tag_suffix: "-maxperf" tag_suffix: "-maxperf"
images: ${{ needs.define-variables.outputs.images }} images: ${{ env.IMAGE_PATH }}
registry_user: ${{ vars.BUILTIN_REGISTRY_USER || github.actor }} registry_user: ${{ vars.BUILTIN_REGISTRY_USER || github.actor }}
registry_password: ${{ secrets.BUILTIN_REGISTRY_PASSWORD || secrets.GITHUB_TOKEN }} registry_password: ${{ secrets.BUILTIN_REGISTRY_PASSWORD || secrets.GITHUB_TOKEN }}