Files
packages/.github/workflows/json-build.yml
T
Gilver 2e6b17ec77 fix(ci): Builder branch
Signed-off-by: Gilver <roachy@fyralabs.com>
2026-04-28 22:35:35 -05:00

127 lines
4.8 KiB
YAML

name: JSON Build
permissions:
contents: read
on:
workflow_call:
inputs:
packages:
description: "Packages to Build"
required: true
type: string
publish:
description: "Whether the package should be published"
required: false
type: boolean
default: true
custom_builder:
description: "Custom Builder"
required: false
type: string
default: ""
workflow_dispatch:
inputs:
packages:
description: "Packages to Build"
required: true
type: string
publish:
description: "Whether the package should be published"
required: false
type: boolean
default: true
jobs:
build:
strategy:
matrix:
pkg: ${{ fromJson(inputs.packages) }}
version: ["10"]
fail-fast: false
runs-on: ${{ inputs.custom_builder && inputs.custom_builder || (matrix.pkg.arch == 'aarch64' && matrix.pkg.labels['large']) && format('cirun-arm64-lg--{0}', github.run_id) || matrix.pkg.arch == 'aarch64' && 'ubuntu-22.04-arm' || matrix.pkg.labels['large'] && format('cirun-x86-64-lg--{0}', github.run_id) || 'ubuntu-22.04' }}
container:
image: ghcr.io/terrapkg/builder:el${{ matrix.version }}
options: --cap-add=SYS_ADMIN --privileged
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- name: Set up git repository
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Configure sccache
id: sccache
if: ${{ !contains(matrix.pkg.labels.sccache, '0') }}
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
env:
SCCACHE_GHA_VERSION: ${{ matrix.version }}-${{ matrix.pkg.arch }}-${{ matrix.pkg.pkg }}
SCCACHE_GHA_CACHE_FROM: ${{ matrix.version }}-${{ matrix.pkg.arch }}-${{ matrix.pkg.pkg }}
with:
script: |
const script = require('./.github/scripts/configure-sccache.js')
await script({github, context, core, exec})
- name: CI Setup Script
if: ${{ !contains(matrix.pkg.labels, 'mock') }}
run: |
dir=$(dirname ${{ matrix.pkg.pkg }})
if [ -f $dir/ci_setup.rhai ]; then
anda run $dir/ci_setup.rhai --labels script_path=$dir/ci_setup.rhai
fi
- name: Install Build Dependencies
if: ${{ matrix.pkg.labels.mock != '1' }}
run: |
dir=$(dirname ${{ matrix.pkg.pkg }})
dnf builddep -y ${dir}/*.spec
- name: Build with Andaman
run: anda build -D "vendor Terra" ${{ matrix.pkg.pkg }} -c terra-el${{ matrix.version }}-${{ matrix.pkg.arch }} ${{ !matrix.pkg.labels.mock == '1' && '-rrpmbuild' || '' }}
- name: Report Cache Summary
if: steps.sccache.outcome == 'success'
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
const script = require('./.github/scripts/sccache-stats.js')
await script({github, context, core, exec})
- name: Generating artifact name
id: art
run: |
NAME=${{ matrix.pkg.pkg }}-${{ matrix.pkg.arch }}-${{ matrix.version }}
x=${NAME//\//@}
echo "name=$x" >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ${{ steps.art.outputs.name }}
compression-level: 0 # The RPMs are already compressed :p
path: |
anda-build/rpm/rpms/*
anda-build/rpm/srpm/*
- name: Upload packages to subatomic
if: inputs.publish
run: |
subatomic-cli upload --prune \
--server https://subatomic.fyralabs.com \
--token ${{ secrets.SUBATOMIC_TOKEN }} \
terrael${{ matrix.version }} anda-build/rpm/rpms/*
- name: Upload source packages to subatomic
if: inputs.publish && matrix.pkg.labels['no_upload_srpms'] != '1'
run: |
subatomic-cli upload --prune \
--server https://subatomic.fyralabs.com \
--token ${{ secrets.SUBATOMIC_TOKEN }} \
terrael${{ matrix.version }}-source anda-build/rpm/srpm/*
- name: Notify Madoguchi (Success)
if: success()
run: ./.github/workflows/mg.sh true ${{matrix.pkg.pkg}} el${{matrix.version}} ${{matrix.pkg.arch}} ${{github.run_id}} ${{secrets.MADOGUCHI_JWT}} $GITHUB_SHA
- name: Notify Madoguchi (Failure)
if: inputs.publish && (cancelled() || failure())
run: ./.github/workflows/mg.sh false ${{matrix.pkg.pkg}} el${{matrix.version}} ${{matrix.pkg.arch}} ${{github.run_id}} ${{secrets.MADOGUCHI_JWT}} $GITHUB_SHA