From 19636bfe38935e1e5fbddcde552fca39b012c6a3 Mon Sep 17 00:00:00 2001 From: madonuko Date: Sun, 9 Mar 2025 14:47:22 +0800 Subject: [PATCH] feat(ci): update buildsys --- .github/workflows/autobuild.yml | 28 ++++++++++++++++------------ .github/workflows/build.yml | 22 +++++----------------- .github/workflows/json-build.yml | 26 +++++++++++++------------- 3 files changed, 34 insertions(+), 42 deletions(-) diff --git a/.github/workflows/autobuild.yml b/.github/workflows/autobuild.yml index aafa204ffc..90a2c6d972 100644 --- a/.github/workflows/autobuild.yml +++ b/.github/workflows/autobuild.yml @@ -18,8 +18,7 @@ on: jobs: manifest: - runs-on: ubuntu-latest - + runs-on: ubuntu-22.04 outputs: build_matrix: ${{ steps.generate_build_matrix.outputs.build_matrix }} container: @@ -52,25 +51,30 @@ jobs: with: fetch-depth: 0 - - name: Checkout latest Mock configs - uses: actions/checkout@v4 - with: - fetch-depth: 0 - repository: terrapkg/mock-configs - path: mock-configs - - name: Set up git repository run: git config --global --add safe.directory "$GITHUB_WORKSPACE" + - name: CI Setup Script + if: ${{ matrix.pkg.labels.mock != '1' }} + 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 }}) + dnf5 builddep -y ${dir}/*.spec + - name: Include custom build template instead of package default run: | cp -v mock-configs/terra-el.tpl /etc/mock/templates/ cp -v mock-configs/terra-el-dev.tpl /etc/mock/templates/ - name: Build with Andaman - run: | - dnf builddep -y `echo ${{ matrix.pkg.pkg }} | sed -E 's@/pkg$@/*.spec@'` - anda build ${{ matrix.pkg.pkg }} -rrpmbuild + run: anda build ${{ matrix.pkg.pkg }} -c terra-el${{ matrix.version }}-dev-${{ matrix.pkg.arch }} ${{ !matrix.pkg.labels.mock == '1' && '-rrpmbuild' || '' }} - name: Generating artifact name id: art diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7b15116eb6..8a4954e781 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,7 +21,7 @@ jobs: pkgs: ${{ steps.parsing.outputs.pkgs }} builder: ${{ inputs.custom_builder }} arch: ${{ steps.parsing.outputs.arch }} - runs-on: "ubuntu-latest" + runs-on: ubuntu-22.04 steps: - name: Parse Input id: parsing @@ -44,12 +44,12 @@ jobs: strategy: matrix: pkg: ${{ fromJson(needs.parse.outputs.pkgs) }} - version: ["10"] + version: ["rawhide"] arch: ${{ fromJson(needs.parse.outputs.arch) }} fail-fast: false runs-on: ${{ matrix.arch == 'aarch64' && 'ubuntu-22.04-arm' || needs.parse.outputs.builder && needs.parse.outputs.builder || 'ubuntu-22.04' }} container: - image: ghcr.io/terrapkg/builder:el${{ matrix.version }} + image: ghcr.io/terrapkg/builder:f${{ matrix.version }} options: --cap-add=SYS_ADMIN --privileged steps: - name: Checkout @@ -57,24 +57,11 @@ jobs: with: fetch-depth: 0 - - name: Checkout latest Mock configs - uses: actions/checkout@v4 - with: - repository: terrapkg/mock-configs - path: mock-configs - - name: Set up git repository run: git config --global --add safe.directory "$GITHUB_WORKSPACE" - - name: Include custom build template instead of package default - run: | - cp -v mock-configs/terra-el.tpl /etc/mock/templates/ - cp -v mock-configs/terra-el-dev.tpl /etc/mock/templates/ - - name: Build with Andaman - run: | - dnf builddep -y anda/${{ matrix.pkg }}*.spec - anda build anda/${{ matrix.pkg }}pkg -rrpmbuild + run: anda build -c terra-el${{ matrix.version }}-dev-${{ matrix.arch }} anda/${{ matrix.pkg }}pkg - name: Generating artifact name id: art @@ -82,6 +69,7 @@ jobs: NAME=${{ matrix.pkg }}-${{ matrix.arch }}-${{ matrix.version }} x=${NAME//\//@} echo "name=$x" >> $GITHUB_OUTPUT + echo "labels=$(anda run andax/get_proj_label.rhai -l project=anda/${{ matrix.pkg }}anda.hcl)" >> $GITHUB_OUTPUT - uses: actions/upload-artifact@v4 with: diff --git a/.github/workflows/json-build.yml b/.github/workflows/json-build.yml index 3ced641f63..f2c9d28a32 100644 --- a/.github/workflows/json-build.yml +++ b/.github/workflows/json-build.yml @@ -23,24 +23,25 @@ jobs: with: fetch-depth: 0 - - name: Checkout latest Mock configs - uses: actions/checkout@v4 - with: - repository: terrapkg/mock-configs - path: mock-configs - - name: Set up git repository run: git config --global --add safe.directory "$GITHUB_WORKSPACE" - - name: Include custom build template instead of package default + - name: CI Setup Script + if: ${{ !contains(matrix.pkg.labels, 'mock') }} run: | - cp -v mock-configs/terra-el.tpl /etc/mock/templates/ - cp -v mock-configs/terra-el-dev.tpl /etc/mock/templates/ + 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: ${{ !contains(matrix.pkg.labels, 'mock') }} + run: | + dir=$(dirname ${{ matrix.pkg.pkg }}) + dnf5 builddep -y ${dir}/*.spec - name: Build with Andaman - run: | - dnf builddep -y `echo ${{ matrix.pkg.pkg }} | sed -E 's@/pkg$@/*.spec@'` - anda build ${{ matrix.pkg.pkg }} -rrpmbuild + run: anda build ${{ matrix.pkg.pkg }} -c terra-el${{ matrix.version }}-dev-${{ matrix.pkg.arch }} ${{ contains(matrix.pkg.labels, 'mock') && '' || '-rrpmbuild' }} - name: Generating artifact name id: art @@ -65,7 +66,6 @@ jobs: terrael${{ matrix.version }} anda-build/rpm/rpms/* - name: Upload source packages to subatomic - if: github.event_name == 'push' run: | subatomic-cli upload --prune \ --server https://subatomic.fyralabs.com \