Skip to content

Commit

Permalink
ci: start scaffolding a build workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
USA-RedDragon committed Nov 27, 2023
1 parent e200c06 commit e77bffd
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 2 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build

on:
push:
branches-ignore:
- rebase-pull-request**
- cherry-pick-rebase-pull-request**
pull_request:

concurrency:
group: '${{ github.workflow }} @ ${{ github.ref }}'
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.12
- name: Install dependencies
run: |
DEBIAN_FRONTEND=noninteractive sudo apt-get update -y
sudo apt-get install --no-install-recommends -y \
icoutils \
flatpak \
flatpak-builder
flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
- name: Cache Flatpak builder
id: cache-flatpak-builder
uses: actions/cache@v3
with:
path: .flatpak-builder
key: ${{ runner.os }}-flatpak-builder-${{ hashFiles('com.jagex.Launcher.yaml') }}
- name: Build Flatpak
run: |
./build.sh
23 changes: 21 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,27 @@ if [[ ${HAS_NVIDIA} -eq 1 ]]; then
org.freedesktop.Platform.GL32.nvidia-${NVIDIA_VERISON}/x86_64
fi

flatpak-builder --user --force-clean out com.jagex.Launcher.yaml
flatpak-builder --user --ccache --force-clean out com.jagex.Launcher.yaml
flatpak build-export export out
flatpak build-bundle -vv export com.jagex.Launcher.flatpak com.jagex.Launcher --repo-url=https://flatpak.mcswain.dev --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo

flatpak build-bundle -vv export com.jagex.Launcher.flatpak com.jagex.Launcher --repo-url=https://flatpak.mcswain.dev --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo &
PID=$!

COUNTER=0
# Timeout after 1 hour
MAX_COUNTER=3600
while kill -0 $PID 2> /dev/null; do
NUM_DOT=$((COUNTER%5))
DOTS=$(printf '.%.0s' $(seq 1 $NUM_DOT))
# Overwrite the line
echo -en "\r \r"
echo "Exporting flatpak${DOTS}"
COUNTER=$((COUNTER+1))
if [[ ${COUNTER} -gt ${MAX_COUNTER} ]]; then
echo "Timed out after 1 hour"
exit 1
fi
sleep 1
done

echo "Built flatpak to com.jagex.Launcher.flatpak"

0 comments on commit e77bffd

Please sign in to comment.