Skip to content

Commit

Permalink
feat(ci)!: switch to rpmbuild (#2792)
Browse files Browse the repository at this point in the history
* feat(ci)!: switch to rpmbuild

* fix: support extra_repos

* let's try this instead

* fix the funny condition

* fix: disable gpgcheck

This should be fine because checksum is checked for the repomd and the
packages too
  • Loading branch information
madonuko authored Dec 31, 2024
1 parent 27b491a commit 3566e7e
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 35 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/autobuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,26 +52,26 @@ 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: Include custom build template instead of package default
- name: CI Setup Script
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
run: |
cp -v mock-configs/terra.tpl /etc/mock/templates/terra.tpl
dir=$(dirname ${{ matrix.pkg.pkg }})
dnf5 builddep -y ${dir}/*.spec
- name: Build with Andaman
run: anda build ${{ matrix.pkg.pkg }} --package rpm -c mock-configs/terra-${{ matrix.version }}-${{ matrix.pkg.arch }}.cfg
run: anda build ${{ matrix.pkg.pkg }} -rrpmbuild

- name: Build with Andaman (alternate arch)
if: |
matrix.pkg.arch == 'x86_64' && matrix.pkg.labels['multilib']
if: matrix.pkg.arch == 'x86_64' && matrix.pkg.labels['multilib']
run: anda build ${{ matrix.pkg.pkg }} --package rpm -c mock-configs/terra-${{ matrix.version }}-i386.cfg

- name: Generating artifact name
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/bootstrap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ jobs:
options: --cap-add=SYS_ADMIN --privileged
steps:
- name: Install repositories
run: dnf5 install -y --setopt=install_weak_deps=False mock curl wget git-core openssl-devel cargo podman fuse-overlayfs
run: |
dnf5 install -y --setopt=install_weak_deps=False curl wget git-core openssl-devel cargo podman fuse-overlayfs
dnf5 builddep -y anda/terra/{mock-configs,srpm-macros}/*.spec anda/tools/buildsys/{anda,subatomic}/*.spec
- name: Install Anda
run: cargo install anda
Expand All @@ -30,20 +32,20 @@ jobs:
echo "PATH=$PATH:/github/home/.cargo/bin" >> $GITHUB_ENV
export PATH=$PATH:/github/home/.cargo/bin
git config --global --add safe.directory "$GITHUB_WORKSPACE"
anda build -c fedora-${{ matrix.version }}-${{ matrix.arch }} anda/terra/mock-configs/pkg -p rpm
anda build -rrpmbuild anda/terra/mock-configs/pkg
- name: Install terra-mock-configs
run: dnf5 install -y anda-build/rpm/rpms/terra-mock-configs*.rpm

- name: Build anda-srpm-macros
run: anda build -c terra-${{ matrix.version }}-${{ matrix.arch }} anda/terra/srpm-macros/pkg
run: anda build -rrpmbuild anda/terra/srpm-macros/pkg

- name: Build Subatomic
run: anda build -c terra-${{ matrix.version }}-${{ matrix.arch }} anda/tools/buildsys/subatomic/pkg
run: anda build -rrpmbuild anda/tools/buildsys/subatomic/pkg
- name: Install Subatomic
run: dnf5 install -y ./anda-build/rpm/rpms/subatomic-*.rpm

- name: Build Andaman
run: anda build -c terra-${{ matrix.version }}-${{ matrix.arch }} anda/tools/buildsys/anda/pkg
run: anda build -rrpmbuild anda/tools/buildsys/anda/pkg

- name: Upload packages to subatomic
run: |
Expand Down
15 changes: 6 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,18 @@ 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
run: |
cp -v mock-configs/terra.tpl /etc/mock/templates/terra.tpl
dir=${{ matrix.pkg }}
if [ -f $dir/ci_setup.rhai ]; then
anda run $dir/ci_setup.rhai --labels script_path=$dir/ci_setup.rhai
fi
- name: Build with Andaman
run: anda build anda/${{ matrix.pkg }}pkg --package rpm -c mock-configs/terra-${{ matrix.version }}-${{ matrix.arch }}.cfg
run: anda build -rrpmbuild anda/${{ matrix.pkg }}pkg

- name: Generating artifact name
id: art
Expand Down
20 changes: 11 additions & 9 deletions .github/workflows/json-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,23 @@ 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
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
run: |
cp -v mock-configs/terra.tpl /etc/mock/templates/terra.tpl
dir=$(dirname ${{ matrix.pkg.pkg }})
dnf5 builddep -y ${dir}/*.spec
- name: Build with Andaman
run: anda build ${{ matrix.pkg.pkg }} --package rpm -c mock-configs/terra-${{ matrix.version }}-${{ matrix.pkg.arch }}.cfg
run: anda build ${{ matrix.pkg.pkg }} -rrpmbuild

- name: Generating artifact name
id: art
Expand Down
2 changes: 2 additions & 0 deletions anda/games/prismlauncher-nightly/ci_setup.rhai
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import "andax/ci/extra_repos.rhai" as extra_repos;
extra_repos::install(labels);
2 changes: 2 additions & 0 deletions anda/games/prismlauncher/ci_setup.rhai
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import "andax/ci/extra_repos.rhai" as extra_repos;
extra_repos::install(labels);
26 changes: 26 additions & 0 deletions andax/ci/extra_repos.rhai
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import "anda::cfg" as cfg;

fn install(labels) {
if labels.script_path == () {
print("fatal: labels.script_path is empty");
terminate();
}
let releasever = sh("rpm -E '%fedora'", #{"stdout": "piped"}).ctx.stdout;
releasever.trim();
let basearch = sh("rpm -E '%_arch'", #{"stdout": "piped"}).ctx.stdout;
basearch.trim();
let hcl = cfg::load_file(sub(`(.+/)[^.]+\.rhai`, "${1}anda.hcl", labels.script_path));
for repo in hcl.project.pkg.rpm.extra_repos {
repo = sub(`\$releasever`, releasever, repo);
repo = sub(`\$basearch`, basearch, repo);
let filename = sub(`\W`, "_", repo);
let file = open_file(`/etc/yum.repos.d/${filename}.repo`);
file.write(`
[filename]
name=${filename}
baseurl=${repo}
enabled=1
gpgcheck=0
`);
}
}

0 comments on commit 3566e7e

Please sign in to comment.