mirror of
https://github.com/terrapkg/packages.git
synced 2026-06-12 06:30:38 +00:00
feat(ci): improve mass-rebuild workflow
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
# for each folder in anda/
|
||||
# generate a new workflow for each folder in anda/
|
||||
name: Mass Rebuild
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
packages:
|
||||
description: Packages to Build (JSON)
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
manifest:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
outputs:
|
||||
build_matrix: ${{ steps.generate_build_matrix.outputs.build_matrix }}
|
||||
|
||||
container:
|
||||
image: ghcr.io/terrapkg/builder:main
|
||||
options: --cap-add=SYS_ADMIN --privileged
|
||||
|
||||
steps:
|
||||
- name: Generate Build matrix
|
||||
id: generate_build_matrix
|
||||
run: |
|
||||
echo "build_matrix=${{ inputs.packages }}" > x.py
|
||||
cat <<EOF > x.py
|
||||
import json
|
||||
if len(build_matrix) > 255:
|
||||
print("recurse=1")
|
||||
print(f"build_matrix={json.dumps(build_matrix[:256])}")
|
||||
print(f"recurse_matrix={json.dumps(build_matrix[256:])}")
|
||||
else:
|
||||
print("recurse=0")
|
||||
print(f"build_matrix={json.dumps(build_matrix)}")
|
||||
print("recurse_matrix=[]")
|
||||
EOF
|
||||
python x.py >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Recurse builds
|
||||
if: steps.generate_build_matrix.outputs.recurse == 1
|
||||
uses: terrapkg/packages/.github/workflows/mass-rebuild-recurse.yml@f38
|
||||
with:
|
||||
packages: ${{ steps.generate_build_matrix.outputs.recurse_matrix }}
|
||||
build:
|
||||
needs: manifest
|
||||
strategy:
|
||||
matrix:
|
||||
pkg: ${{ fromJson(needs.manifest.outputs.build_matrix) }}
|
||||
version: ["38"]
|
||||
arch: ["x86_64", "aarch64"]
|
||||
fail-fast: false
|
||||
#if: ${{ matrix.changed_folders != '' }}
|
||||
runs-on: ${{ matrix.arch == 'aarch64' && 'ARM64' || 'ubuntu-latest' }}
|
||||
container:
|
||||
image: ghcr.io/terrapkg/builder:f38
|
||||
options: --cap-add=SYS_ADMIN --privileged
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 2
|
||||
- name: Check file existence
|
||||
id: check_files
|
||||
run: |
|
||||
if test -f "${{ matrix.pkg }}anda.hcl"; then
|
||||
echo "EXISTS=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "EXISTS=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- uses: terrapkg/anda-build@main
|
||||
if: steps.check_files.outputs.EXISTS == 'true'
|
||||
with:
|
||||
name: "${{ matrix.pkg }}pkg"
|
||||
mockConfig: anda-${{ matrix.version }}-${{ matrix.arch }}
|
||||
extraArgs: -D "sccache_bucket ${{secrets.SCCACHE_BUCKET}}" -D "sccache_endpoint ${{secrets.SCCACHE_ENDPOINT}}" -D "sccache_secret ${{secrets.SCCACHE_SECRET}}" -D "sccache_accesskey ${{secrets.SCCACHE_ACCESSKEY}}"
|
||||
andaRepo: https://github.com/terrapkg/subatomic-repos/raw/main/terra.repo
|
||||
|
||||
- name: Upload packages to subatomic
|
||||
if: steps.check_files.outputs.EXISTS == 'true'
|
||||
run: |
|
||||
subatomic-cli upload --prune \
|
||||
--server https://subatomic.fyralabs.com \
|
||||
--token ${{ secrets.SUBATOMIC_TOKEN }} \
|
||||
terra${{ matrix.version }} anda-build/rpm/rpms/*
|
||||
@@ -27,7 +27,25 @@ jobs:
|
||||
run: |
|
||||
git checkout -b mass-rebuild $(git rev-list HEAD | tail -n 1)
|
||||
git merge --squash $(git branch --show-current)
|
||||
anda ci >> $GITHUB_OUTPUT
|
||||
anda ci > x.py
|
||||
cat <<EOF > x.py
|
||||
import json
|
||||
if len(build_matrix) > 255:
|
||||
print("recurse=1")
|
||||
print(f"build_matrix={json.dumps(build_matrix[:256])}")
|
||||
print(f"recurse_matrix={json.dumps(build_matrix[256:])}")
|
||||
else:
|
||||
print("recurse=0")
|
||||
print(f"build_matrix={json.dumps(build_matrix)}")
|
||||
print("recurse_matrix=[]")
|
||||
EOF
|
||||
python x.py >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Recurse builds
|
||||
if: steps.generate_build_matrix.outputs.recurse == 1
|
||||
uses: terrapkg/packages/.github/workflows/mass-rebuild-recurse.yml@f38
|
||||
with:
|
||||
packages: ${{ steps.generate_build_matrix.outputs.recurse_matrix }}
|
||||
build:
|
||||
needs: manifest
|
||||
strategy:
|
||||
@@ -39,7 +57,7 @@ jobs:
|
||||
#if: ${{ matrix.changed_folders != '' }}
|
||||
runs-on: ${{ matrix.arch == 'aarch64' && 'ARM64' || 'ubuntu-latest' }}
|
||||
container:
|
||||
image: ghcr.io/terrapkg/builder:main
|
||||
image: ghcr.io/terrapkg/builder:f38
|
||||
options: --cap-add=SYS_ADMIN --privileged
|
||||
steps:
|
||||
- name: Checkout
|
||||
|
||||
Reference in New Issue
Block a user