build & release packages #114
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: build & release packages | |
| concurrency: | |
| group: build-${{ github.ref }} | |
| cancel-in-progress: true | |
| on: | |
| schedule: | |
| - cron: "0 7 1/12 * *" | |
| workflow_dispatch: | |
| inputs: | |
| FORCE_BUILD: | |
| description: 'Set to 1 to force a build' | |
| required: false | |
| default: '0' | |
| ONE_PACKAGE: | |
| description: 'Set to the name of only one package to be built' | |
| required: false | |
| default: '' | |
| jobs: | |
| build: | |
| name: "Build: ${{ matrix.script }} (${{ matrix.arch }})" | |
| permissions: | |
| actions: read | |
| security-events: write | |
| contents: write | |
| runs-on: ${{ matrix.runs-on }} | |
| continue-on-error: false | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - arch: x86_64 | |
| platform: linux/amd64 | |
| runs-on: ubuntu-24.04 | |
| script: llvm-mini | |
| - arch: x86_64 | |
| platform: linux/amd64 | |
| runs-on: ubuntu-24.04 | |
| script: llvm-nano | |
| - arch: aarch64 | |
| platform: linux/arm64 | |
| runs-on: ubuntu-24.04-arm | |
| script: llvm-mini | |
| - arch: aarch64 | |
| platform: linux/arm64 | |
| runs-on: ubuntu-24.04-arm | |
| script: llvm-nano | |
| - arch: x86_64 | |
| platform: linux/amd64 | |
| runs-on: ubuntu-24.04 | |
| script: libxml2-mini | |
| - arch: aarch64 | |
| platform: linux/arm64 | |
| runs-on: ubuntu-24.04-arm | |
| script: libxml2-mini | |
| - arch: x86_64 | |
| platform: linux/amd64 | |
| runs-on: ubuntu-24.04 | |
| script: qt6-base-mini | |
| - arch: aarch64 | |
| platform: linux/arm64 | |
| runs-on: ubuntu-24.04-arm | |
| script: qt6-base-mini | |
| - arch: x86_64 | |
| platform: linux/amd64 | |
| runs-on: ubuntu-24.04 | |
| script: gtk3-mini | |
| - arch: aarch64 | |
| platform: linux/arm64 | |
| runs-on: ubuntu-24.04-arm | |
| script: gtk3-mini | |
| - arch: x86_64 | |
| platform: linux/amd64 | |
| runs-on: ubuntu-24.04 | |
| script: gtk4-mini | |
| - arch: aarch64 | |
| platform: linux/arm64 | |
| runs-on: ubuntu-24.04-arm | |
| script: gtk4-mini | |
| - arch: x86_64 | |
| platform: linux/amd64 | |
| runs-on: ubuntu-24.04 | |
| script: gdk-pixbuf2-mini | |
| - arch: aarch64 | |
| platform: linux/arm64 | |
| runs-on: ubuntu-24.04-arm | |
| script: gdk-pixbuf2-mini | |
| - arch: x86_64 | |
| platform: linux/amd64 | |
| runs-on: ubuntu-24.04 | |
| script: librsvg-mini | |
| - arch: aarch64 | |
| platform: linux/arm64 | |
| runs-on: ubuntu-24.04-arm | |
| script: librsvg-mini | |
| - arch: x86_64 | |
| platform: linux/amd64 | |
| runs-on: ubuntu-24.04 | |
| script: ffmpeg-mini | |
| - arch: aarch64 | |
| platform: linux/arm64 | |
| runs-on: ubuntu-24.04-arm | |
| script: ffmpeg-mini | |
| - arch: x86_64 | |
| platform: linux/amd64 | |
| runs-on: ubuntu-24.04 | |
| script: opus-mini | |
| - arch: aarch64 | |
| platform: linux/arm64 | |
| runs-on: ubuntu-24.04-arm | |
| script: opus-mini | |
| - arch: x86_64 | |
| platform: linux/amd64 | |
| runs-on: ubuntu-24.04 | |
| script: mesa-mini | |
| - arch: aarch64 | |
| platform: linux/arm64 | |
| runs-on: ubuntu-24.04-arm | |
| script: mesa-mini | |
| - arch: x86_64 | |
| platform: linux/amd64 | |
| runs-on: ubuntu-24.04 | |
| script: mesa-nano | |
| - arch: aarch64 | |
| platform: linux/arm64 | |
| runs-on: ubuntu-24.04-arm | |
| script: mesa-nano | |
| - arch: x86_64 | |
| platform: linux/amd64 | |
| runs-on: ubuntu-24.04 | |
| script: mangohud-mini | |
| - arch: aarch64 | |
| platform: linux/arm64 | |
| runs-on: ubuntu-24.04-arm | |
| script: mangohud-mini | |
| - arch: x86_64 | |
| platform: linux/amd64 | |
| runs-on: ubuntu-24.04 | |
| script: intel-media-driver-mini | |
| container: | |
| image: ghcr.io/pkgforge-dev/archlinux:latest | |
| env: | |
| CCACHE_DIR: ${{ github.workspace }}/.ccache | |
| CCACHE_COMPILERCHECK: content | |
| CCACHE_SLOPPINESS: time_macros | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - name: set up ccache | |
| if: ${{ matrix.script != 'qt6-base-mini' }} | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ env.CCACHE_DIR }} | |
| key: ${{ runner.os }}-ccache-${{ matrix.script }}-${{ matrix.arch }}-${{ github.sha }} | |
| restore-keys: | | |
| ${{ runner.os }}-ccache-${{ matrix.script }}-${{ matrix.arch }}- | |
| - name: set up sccache | |
| if: ${{ matrix.script == 'qt6-base-mini' }} | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/sccache/ | |
| key: ${{ runner.os }}-sccache-${{ matrix.script }}-${{ matrix.arch }}-${{ github.sha }} | |
| restore-keys: | | |
| ${{ runner.os }}-sccache-${{ matrix.script }}-${{ matrix.arch }}- | |
| - name: prepare container | |
| run: | | |
| sed -i 's/DownloadUser/#DownloadUser/g' /etc/pacman.conf | |
| pacman -Syu --noconfirm \ | |
| base-devel \ | |
| ccache \ | |
| clang \ | |
| cmake \ | |
| curl \ | |
| git \ | |
| ninja \ | |
| sccache \ | |
| wget | |
| export PATH="$PATH:/usr/bin/core_perl" | |
| sudo sed -i \ | |
| -e 's|DEBUG_CFLAGS="-g"|DEBUG_CFLAGS="-g0"|' \ | |
| -e 's|-fno-omit-frame-pointer|-fomit-frame-pointer|' \ | |
| -e 's|-mno-omit-leaf-frame-pointer||' \ | |
| -e 's|-Wp,-D_FORTIFY_SOURCE=3||' \ | |
| -e 's|-fstack-clash-protection||' \ | |
| -e 's|MAKEFLAGS=.*|MAKEFLAGS="-j$(nproc)"|' \ | |
| -e 's|!ccache|ccache|' \ | |
| -e 's|#MAKEFLAGS|MAKEFLAGS|' /etc/makepkg.conf | |
| cat /etc/makepkg.conf | |
| echo "Hacking makepkg to allow building as root in the container..." | |
| sudo sed -i 's|EUID == 0|EUID == 69|g' /usr/bin/makepkg | |
| mkdir -p /usr/local/bin | |
| cp /usr/bin/makepkg /usr/local/bin | |
| export CC=gcc | |
| export CXX=g++ | |
| if [ "${{ matrix.script }}" != 'qt6-base-mini' ]; then | |
| export CMAKE_C_COMPILER_LAUNCHER=ccache | |
| export CMAKE_CXX_COMPILER_LAUNCHER=ccache | |
| else | |
| export CMAKE_C_COMPILER_LAUNCHER=sccache | |
| export CMAKE_CXX_COMPILER_LAUNCHER=sccache | |
| fi | |
| - name: build package | |
| env: | |
| FORCE_BUILD: ${{ github.event.inputs.FORCE_BUILD }} | |
| ONE_PACKAGE: ${{ github.event.inputs.ONE_PACKAGE }} | |
| run: | | |
| if [ "$FORCE_BUILD" = "1" ]; then | |
| echo "Forcing build!" | |
| echo "Packages will be built and released regardless of version mismatch" | |
| fi | |
| COUNT=0 | |
| chmod +x ./*.sh | |
| while :; do | |
| if ./${{ matrix.script }}.sh; then | |
| if [ -f ~/OPERATION_ABORTED ]; then | |
| exit 0 | |
| fi | |
| >&2 echo "----------------------------------------" | |
| >&2 echo "Package built successfully!" | |
| >&2 echo "----------------------------------------" | |
| break | |
| else | |
| >&2 echo "----------------------------------------" | |
| >&2 echo "Failed to build package, trying again..." | |
| >&2 echo "----------------------------------------" | |
| COUNT=$(( COUNT + 1)) | |
| fi | |
| if [ "$COUNT" -ge 3 ]; then | |
| >&2 echo "----------------------------------------" | |
| >&2 echo "Failed to build package 3 times" | |
| >&2 echo "----------------------------------------" | |
| exit 1 | |
| fi | |
| done | |
| if [ "${{ matrix.script }}" != 'qt6-base-mini' ]; then | |
| ccache -s -v | |
| else | |
| sccache --show-stats | |
| fi | |
| mkdir ./dist | |
| sha256sum ./*.pkg.tar.* | |
| mv ./*.pkg.tar.* ./dist | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ format('{0}-{1}', matrix.script, matrix.arch) }} | |
| path: "dist" | |
| release: | |
| name: "release" | |
| if: ${{ github.ref_name == 'main' }} | |
| needs: [build] | |
| permissions: | |
| actions: read | |
| security-events: write | |
| contents: write | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| pattern: "*" | |
| merge-multiple: true | |
| - name: release | |
| uses: softprops/action-gh-release@v2.3.3 | |
| with: | |
| name: "Continuous build" | |
| tag_name: continuous | |
| prerelease: false | |
| make_latest: true | |
| target_commitish: ${{ github.sha }} | |
| files: | | |
| *.pkg.tar.zst | |
| *.pkg.tar.xz |