Skip to content

Use common build scripts in chroot env, too #286

Use common build scripts in chroot env, too

Use common build scripts in chroot env, too #286

Workflow file for this run

name: build
on:
push:
# branches:
# - 'main'
# NOTE: pull_request tests a potential merge conflict. push builds the branch as it would build main. Both serve separate purposes.
# Especially when working with CI changes, we may want to see both, hence not limiting builds to the main branch.
pull_request:
workflow_dispatch:
# This ensures that jobs get canceled when force-pushing
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# The default Debian shell (dash) is faster than bash at running scripts,
# and using bash when it is not needed doesn't make sense.
defaults:
run:
shell: sh
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- appimage_arch: i686
- appimage_arch: x86_64
- appimage_arch: armhf
- appimage_arch: aarch64
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get git hash
run: |
echo -n "https://github.com/${GITHUB_REPOSITORY}/commit/" > src/runtime/version
git rev-parse --short HEAD | xargs >> src/runtime/version
- name: Set up QEMU integration for Docker
run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- name: Build
env:
ARCH: ${{ matrix.appimage_arch }}
run: |
# make sure to collect artifacts in a separate directory
# makes uploading easier
mkdir -p out
(cd out && ../scripts/docker/build-with-docker.sh)
- name: Sign
env:
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
# skip signing if secret is not available (e.g., if run from a PR made by somebody outside of this repository)
if: ${{ env.SIGNING_KEY != '' }}
run: |
find out
scripts/sign.sh out/runtime-*
# copy pubkey so that it's included with the files uploaded to the release page
cp signing-pubkey.asc out/
- uses: actions/upload-artifact@v3
with:
name: artifacts
path: out/*
build-in-chroot:
runs-on: ubuntu-latest
# if: false
strategy:
fail-fast: false
matrix:
include:
- alpine_arch: x86_64
- alpine_arch: x86
- alpine_arch: armhf
- alpine_arch: aarch64
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get git hash
run: |
echo -n "https://github.com/${GITHUB_REPOSITORY}/commit/" > src/runtime/version
git rev-parse --short HEAD | xargs >> src/runtime/version
- name: Build in chroot
env:
ALPINE_ARCH: ${{ matrix.alpine_arch }}
run: |
sudo apt-get -y install qemu-user-static
scripts/chroot/chroot_build.sh
upload:
name: Create release and upload artifacts
runs-on: ubuntu-latest
needs:
- build
steps:
- name: Download artifacts
uses: actions/download-artifact@v2
- name: Inspect directory after downloading artifacts
run: ls -alFR
- name: Create release and upload artifacts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
wget -q https://github.com/TheAssassin/pyuploadtool/releases/download/continuous/pyuploadtool-x86_64.AppImage
chmod +x pyuploadtool-x86_64.AppImage
./pyuploadtool-x86_64.AppImage --appimage-extract-and-run artifacts/*