Automated Arch binary builds of JASP for the AUR
Upstream JASP ships no Linux binary, so the existing AUR package builds everything from source including several hundred R packages. This builds that once in CI and publishes the result as jasp-desktop-bin. JASP links against the system R and Qt6 rather than bundling them, so a rebuild is triggered by an Arch r/qt6-base bump as well as by a new JASP release, and the generated PKGBUILD pins depends to the versions actually built against.
This commit is contained in:
@@ -0,0 +1,131 @@
|
||||
name: Build JASP binary and publish to AUR
|
||||
|
||||
# JASP publishes no Linux binary of its own, so this builds one on Arch and
|
||||
# ships it as jasp-desktop-bin. Because JASP links against the system R and Qt6,
|
||||
# a rebuild is needed both when JASP releases and when Arch bumps R or Qt6 —
|
||||
# check-upstream.py decides which.
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 3 * * *'
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
jasp_tag:
|
||||
description: 'Specific JASP tag to build (blank = latest release)'
|
||||
required: false
|
||||
default: ''
|
||||
force:
|
||||
description: 'Build even if nothing changed'
|
||||
type: boolean
|
||||
default: false
|
||||
push:
|
||||
paths:
|
||||
- '.gitea/workflows/build.yml'
|
||||
- 'build/**'
|
||||
- 'packaging/**'
|
||||
- 'scripts/**'
|
||||
|
||||
concurrency:
|
||||
group: jasp-build
|
||||
cancel-in-progress: false
|
||||
|
||||
env:
|
||||
GH_OWNER: ${{ vars.GH_OWNER }}
|
||||
GH_REPO: ${{ vars.GH_REPO }}
|
||||
AUR_MAINTAINER: ${{ vars.AUR_MAINTAINER }}
|
||||
WORK_DIR: /srv/jasp-build
|
||||
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
needs_build: ${{ steps.decide.outputs.needs_build }}
|
||||
jasp_tag: ${{ steps.decide.outputs.jasp_tag }}
|
||||
reasons: ${{ steps.decide.outputs.reasons }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Decide whether a rebuild is needed
|
||||
id: decide
|
||||
env:
|
||||
JASP_TAG: ${{ inputs.jasp_tag }}
|
||||
FORCE_BUILD: ${{ inputs.force }}
|
||||
run: python3 scripts/check-upstream.py
|
||||
|
||||
build:
|
||||
needs: check
|
||||
if: needs.check.outputs.needs_build == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
# The R module tree is several hundred packages compiled from source; the
|
||||
# full build runs for hours. The runner and Gitea job timeouts must allow
|
||||
# for this too (see README).
|
||||
timeout-minutes: 900
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Report plan
|
||||
run: |
|
||||
echo "Building JASP ${{ needs.check.outputs.jasp_tag }}"
|
||||
echo "Reasons: ${{ needs.check.outputs.reasons }}"
|
||||
|
||||
- name: Prepare work directory
|
||||
run: |
|
||||
sudo rm -rf "${WORK_DIR}"
|
||||
sudo mkdir -p "${WORK_DIR}/out"
|
||||
sudo cp -a build packaging scripts "${WORK_DIR}/"
|
||||
df -h /
|
||||
|
||||
- name: Build JASP in an Arch container
|
||||
run: |
|
||||
docker rm -f jasp-build 2>/dev/null || true
|
||||
docker run --rm --name jasp-build \
|
||||
-v "${WORK_DIR}:/work" \
|
||||
-e JASP_TAG="${{ needs.check.outputs.jasp_tag }}" \
|
||||
-e OUT_DIR=/work/out \
|
||||
-e JOBS=5 \
|
||||
archlinux:base-devel \
|
||||
bash /work/build/build-jasp.sh
|
||||
|
||||
- name: Show build result
|
||||
run: |
|
||||
cat "${WORK_DIR}/out/build-info.json"
|
||||
ls -lh "${WORK_DIR}/out/"
|
||||
|
||||
- name: Generate PKGBUILD
|
||||
run: |
|
||||
python3 scripts/gen-pkgbuild.py \
|
||||
--build-info "${WORK_DIR}/out/build-info.json" \
|
||||
--template packaging/PKGBUILD.in \
|
||||
--out "${WORK_DIR}/out/PKGBUILD" \
|
||||
--gh-owner "${GH_OWNER}" \
|
||||
--gh-repo "${GH_REPO}" \
|
||||
--maintainer "${AUR_MAINTAINER}"
|
||||
cat "${WORK_DIR}/out/PKGBUILD"
|
||||
|
||||
- name: Publish tarball to GitHub Releases
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||
run: |
|
||||
TAG="$(python3 -c 'import json;print(json.load(open("release-meta.json"))["tag"])')"
|
||||
ASSET="$(python3 -c 'import json;print(json.load(open("release-meta.json"))["tarball"])')"
|
||||
RELEASE_NOTES="Automated build of JASP ${{ needs.check.outputs.jasp_tag }} for Arch Linux.
|
||||
Consumed by the AUR package jasp-desktop-bin.
|
||||
Trigger: ${{ needs.check.outputs.reasons }}" \
|
||||
TAG="$TAG" ASSET="${WORK_DIR}/out/${ASSET}" \
|
||||
bash scripts/publish-github-release.sh
|
||||
|
||||
- name: Push to AUR
|
||||
env:
|
||||
AUR_SSH_KEY: ${{ secrets.AUR_SSH_KEY }}
|
||||
run: bash scripts/push-aur.sh "${WORK_DIR}/out/PKGBUILD"
|
||||
|
||||
- name: Record built state
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
run: bash scripts/record-state.sh
|
||||
|
||||
- name: Clean up build tree
|
||||
if: always()
|
||||
run: |
|
||||
sudo rm -rf "${WORK_DIR}/jasp-desktop" "${WORK_DIR}/build" "${WORK_DIR}/stage" || true
|
||||
df -h /
|
||||
Reference in New Issue
Block a user