-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run apps created in
app-build-verify
- Loading branch information
Showing
4 changed files
with
161 additions
and
106 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,14 +32,6 @@ on: | |
description: "The target format for the app, e.g. appimage, xcode, app, etc. Leave blank all supported formats." | ||
default: "" | ||
type: string | ||
briefcase-template-source: | ||
description: "Path to use for --template for `briefcase new` to create app." | ||
default: "" | ||
type: string | ||
briefcase-template-branch: | ||
description: "Git branch to use for --template-branch for `briefcase new` to create app." | ||
default: "" | ||
type: string | ||
|
||
defaults: | ||
run: | ||
|
@@ -52,8 +44,27 @@ jobs: | |
verify-app: | ||
name: Verify App Build | ||
runs-on: ${{ inputs.runner-os }} | ||
timeout-minutes: 30 | ||
env: | ||
QT_QPA_PLATFORM: offscreen # set window for PySide6 | ||
SDL_AUDIODRIVER: dummy # disable audio for SDL | ||
SDL_VIDEODRIVER: dummy # disable display for SDL | ||
steps: | ||
|
||
- name: Workflow Constants | ||
id: constants | ||
run: | | ||
case "$(tr '[:upper:]' '[:lower:]' <<< '${{ inputs.runner-os }}')" in | ||
ubuntu* ) BRIEFCASE_DIR="$HOME/.cache/briefcase" ;; | ||
macos* ) BRIEFCASE_DIR="$HOME/Library/Caches/org.beeware.briefcase" ;; | ||
windows* ) BRIEFCASE_DIR="$HOME/AppData/Local/BeeWare/briefcase/Cache" ;; | ||
* ) echo "::error::Failed to determine the Briefcase data directory path" ;; | ||
esac | ||
echo "briefcase-data-dir=${BRIEFCASE_DIR}" | tee -a ${GITHUB_OUTPUT} | ||
SYSTEM_PYTHON_VER=$(python3 -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")') | ||
echo "system-python-version=${SYSTEM_PYTHON_VER}" | tee -a ${GITHUB_OUTPUT} | ||
- name: Checkout ${{ inputs.repository }} | ||
uses: actions/[email protected] | ||
with: | ||
|
@@ -63,37 +74,25 @@ jobs: | |
- name: Checkout beeware/.github | ||
uses: actions/[email protected] | ||
with: | ||
repository: beeware/.github | ||
# repository: beeware/.github | ||
# # If this workflow is running from a branch other than main, then any other | ||
# # workflows/actions subsequently invoked should also be from that .github branch. | ||
# ref: ${{ github.workflow_sha }} | ||
path: beeware-.github | ||
|
||
- name: Package Name | ||
id: package | ||
run: echo "name=$(basename '${{ inputs.repository }}')" | tee -a ${GITHUB_OUTPUT} | ||
|
||
- name: Determine Cache Directory | ||
id: dirs | ||
run: | | ||
case "$(tr '[:upper:]' '[:lower:]' <<< '${{ inputs.runner-os }}')" in | ||
ubuntu* ) BRIEFCASE_DIR="~/.cache/briefcase" ;; | ||
macos* ) BRIEFCASE_DIR="~/Library/Caches/org.beeware.briefcase" ;; | ||
windows* ) BRIEFCASE_DIR="~/AppData/Local/BeeWare/briefcase/Cache" ;; | ||
* ) echo "::error::Failed to determine the Briefcase data directory path" ;; | ||
esac | ||
echo "briefcase-data-dir=${BRIEFCASE_DIR}" | tee -a ${GITHUB_OUTPUT} | ||
- name: Update Package Manager | ||
if: startsWith(inputs.runner-os, 'ubuntu') | ||
run: sudo apt --assume-yes update | ||
|
||
- name: Cache Briefcase Tools | ||
uses: actions/[email protected] | ||
with: | ||
key: briefcase-data|${{ inputs.runner-os }}|${{ inputs.repository }}|${{ inputs.framework }}|${{ inputs.target-platform }}|${{ inputs.target-format }} | ||
path: ${{ steps.dirs.outputs.briefcase-data-dir }} | ||
|
||
- name: Determine System python3 Version | ||
id: system-python | ||
run: | | ||
SYSTEM_PYTHON_VER=$(python3 -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")') | ||
echo "version=${SYSTEM_PYTHON_VER}" | tee -a ${GITHUB_OUTPUT} | ||
path: ${{ steps.constants.outputs.briefcase-data-dir }} | ||
|
||
- name: Set Up Python | ||
# Linux System requires python is System Python to run the app | ||
if: ${{ !startsWith(inputs.runner-os, 'ubuntu') }} | ||
uses: actions/[email protected] | ||
with: | ||
python-version: ${{ inputs.python-version }} | ||
|
@@ -103,24 +102,24 @@ jobs: | |
**/pyproject.toml | ||
.pre-commit-config.yaml | ||
- name: Get Packages | ||
- name: Get Briefcase Package | ||
# Briefcase will build and package itself in a previous step in its CI | ||
if: endsWith(inputs.repository, 'briefcase') | ||
uses: actions/[email protected] | ||
with: | ||
name: packages-${{ steps.package.outputs.name }} | ||
name: packages-briefcase | ||
path: dist | ||
|
||
- name: Install Briefcase Artefact | ||
if: endsWith(inputs.repository, 'briefcase') | ||
run: python -m pip install dist/briefcase-*.whl | ||
run: python3 -m pip install dist/briefcase-*.whl | ||
|
||
- name: Install Briefcase | ||
if: ${{ !endsWith(inputs.repository, 'briefcase') }} | ||
uses: ./beeware-.github/.github/actions/install-briefcase | ||
|
||
- name: Determine Briefcase Template Path | ||
# If the briefcase-template repo is being tested, use the current checkout | ||
# If the briefcase-template repo is being tested, use its current checkout | ||
id: template | ||
if: endsWith(inputs.repository, 'briefcase-template') | ||
run: echo "path=${{ github.workspace }}" | tee -a ${GITHUB_OUTPUT} | ||
|
@@ -130,8 +129,7 @@ jobs: | |
uses: ./beeware-.github/.github/actions/app-create | ||
with: | ||
framework: ${{ inputs.framework }} | ||
briefcase-template-source: ${{ inputs.briefcase-template-source || steps.template.outputs.path }} | ||
briefcase-template-branch: ${{ inputs.briefcase-template-branch }} | ||
briefcase-template-source: ${{ steps.template.outputs.path }} | ||
|
||
- name: Determine Output Format Configuration | ||
# only used for the template repos so apps are built with the PR version of the template; | ||
|
@@ -155,6 +153,7 @@ jobs: | |
briefcase create macOS app \ | ||
${{ steps.output-format.outputs.template-override }} | ||
briefcase build macOS app | ||
briefcase run macOS app | ||
briefcase package macOS app --adhoc-sign | ||
- name: Build macOS Xcode Project | ||
|
@@ -167,50 +166,56 @@ jobs: | |
briefcase create macOS Xcode \ | ||
${{ steps.output-format.outputs.template-override }} | ||
briefcase build macOS Xcode | ||
briefcase run macOS Xcode | ||
briefcase package macOS Xcode --adhoc-sign | ||
- name: Build Windows App | ||
if: > | ||
startsWith(inputs.runner-os, 'Windows') | ||
&& contains(fromJSON('["", "Windows"]'), inputs.target-platform) | ||
&& contains(fromJSON('["", "app"]'), inputs.target-format) | ||
env: | ||
WIX: "" # force Briefcase to install and use its own version of WiX | ||
working-directory: ${{ steps.create.outputs.project-path }} | ||
run: | | ||
briefcase create windows app \ | ||
${{ steps.output-format.outputs.template-override }} | ||
briefcase build windows app | ||
briefcase run windows app | ||
briefcase package windows app --adhoc-sign | ||
- name: Build Windows Visual Studio Project | ||
if: > | ||
startsWith(inputs.runner-os, 'Windows') | ||
&& contains(fromJSON('["", "Windows"]'), inputs.target-platform) | ||
&& contains(fromJSON('["", "VisualStudio"]'), inputs.target-format) | ||
env: | ||
WIX: "" # force Briefcase to install and use its own version of WiX | ||
working-directory: ${{ steps.create.outputs.project-path }} | ||
run: | | ||
briefcase create windows VisualStudio \ | ||
${{ steps.output-format.outputs.template-override }} | ||
briefcase build windows VisualStudio | ||
briefcase run windows VisualStudio | ||
briefcase package windows VisualStudio --adhoc-sign | ||
- name: Build Linux System Project (Ubuntu, local) | ||
if: > | ||
startsWith(inputs.runner-os, 'ubuntu') | ||
&& startsWith(inputs.python-version, steps.system-python.outputs.version) | ||
&& startsWith(inputs.python-version, steps.constants.outputs.system-python-version) | ||
&& contains(fromJSON('["", "Linux"]'), inputs.target-platform) | ||
&& contains(fromJSON('["", "system"]'), inputs.target-format) | ||
working-directory: ${{ steps.create.outputs.project-path }} | ||
run: | | ||
sudo apt update -y | ||
sudo apt install -y --no-install-recommends python3-dev python3-pip libcairo2-dev libgirepository1.0-dev | ||
PACKAGES="python3-dev python3-pip" | ||
case "$(tr '[:upper:]' '[:lower:]' <<< '${{ inputs.framework }}')" in | ||
toga* ) PACKAGES="${PACKAGES} libcairo2-dev libgirepository1.0-dev gir1.2-gtk-3.0" ;; | ||
pyside6* ) PACKAGES="${PACKAGES} libegl1" ;; | ||
ppb* ) PACKAGES="${PACKAGES} libsdl2-2.0-0 libsdl2-mixer-2.0-0 libsdl2-image-2.0-0 libsdl2-gfx-1.0-0 libsdl2-ttf-2.0-0" ;; | ||
esac | ||
sudo apt --assume-yes install --no-install-recommends ${PACKAGES} | ||
briefcase create linux system \ | ||
${{ steps.output-format.outputs.template-override }} | ||
briefcase build linux system | ||
xvfb-run briefcase run linux system | ||
briefcase package linux system --adhoc-sign | ||
- name: Build Linux System Project (Debian, Dockerized) | ||
|
@@ -232,10 +237,10 @@ jobs: | |
&& contains(fromJSON('["", "system"]'), inputs.target-format) | ||
working-directory: ${{ steps.create.outputs.project-path }} | ||
run: | | ||
briefcase create linux system --target fedora:37 \ | ||
briefcase create linux system --target fedora:39 \ | ||
${{ steps.output-format.outputs.template-override }} | ||
briefcase build linux system --target fedora:37 | ||
briefcase package linux system --target fedora:37 --adhoc-sign | ||
briefcase build linux system --target fedora:39 | ||
briefcase package linux system --target fedora:39 --adhoc-sign | ||
- name: Build Linux System Project (Arch, Dockerized) | ||
if: > | ||
|
@@ -269,6 +274,15 @@ jobs: | |
&& contains(fromJSON('["AppImage"]'), inputs.target-format) | ||
working-directory: ${{ steps.create.outputs.project-path }} | ||
run: | | ||
PACKAGES="libfuse2" | ||
case "$(tr '[:upper:]' '[:lower:]' <<< '${{ inputs.framework }}')" in | ||
toga* ) PACKAGES="${PACKAGES} libthai-dev libegl1" ;; | ||
pyside6* ) PACKAGES="${PACKAGES} libegl1" ;; | ||
ppb* ) PACKAGES="${PACKAGES} libsdl2-2.0-0 libsdl2-mixer-2.0-0 libsdl2-image-2.0-0 libsdl2-gfx-1.0-0 libsdl2-ttf-2.0-0" ;; | ||
esac | ||
sudo apt --assume-yes install --no-install-recommends ${PACKAGES} | ||
# PyGObject>=3.46.0 requires a version of glibc that isn't available in manylinux images; | ||
# so, the version will need to be constrained to successfully build an AppImage with Toga. | ||
# Furthermore, Toga>0.3.1 requires PyGObject>=3.46.0 so its version is constrained as well. | ||
|
@@ -280,22 +294,25 @@ jobs: | |
${{ steps.output-format.outputs.template-override }} \ | ||
${CONFIG_OVERRIDE_REQUIRES} | ||
briefcase build linux AppImage | ||
xvfb-run briefcase run linux AppImage | ||
briefcase package linux AppImage --adhoc-sign | ||
- name: Build Flatpak Project | ||
if: > | ||
startsWith(inputs.runner-os, 'ubuntu') | ||
&& contains(fromJSON('["", "Linux"]'), inputs.target-platform) | ||
&& contains(fromJSON('["", "Flatpak"]'), inputs.target-format) | ||
&& contains(fromJSON('["Toga", "PyGame"]'), inputs.framework) | ||
working-directory: ${{ steps.create.outputs.project-path }} | ||
run: | | ||
sudo apt update -y | ||
sudo apt install -y --no-install-recommends flatpak flatpak-builder elfutils | ||
sudo apt --assume-yes install --no-install-recommends flatpak flatpak-builder elfutils | ||
briefcase create linux flatpak \ | ||
${{ steps.output-format.outputs.template-override }} | ||
# enable OpenGL rendering | ||
sed -i 's/ - --socket=session-bus/ - --socket=session-bus\n - --device=dri/g' \ | ||
build/verifyapp/linux/flatpak/manifest.yml | ||
briefcase build linux flatpak | ||
xvfb-run briefcase run linux flatpak | ||
briefcase package linux flatpak --adhoc-sign | ||
- name: Build Android App | ||
|
@@ -305,9 +322,34 @@ jobs: | |
&& startsWith(inputs.framework, 'toga') | ||
working-directory: ${{ steps.create.outputs.project-path }} | ||
run: | | ||
export JAVA_HOME=${JAVA_HOME_17_X64} | ||
briefcase create android gradle \ | ||
${{ steps.output-format.outputs.template-override }} | ||
briefcase build android gradle | ||
# On Linux, enable hardware acceleration for virtualization | ||
if [ "${{ startsWith(inputs.runner-os, 'ubuntu') }}" = "true" ]; then | ||
# check if virtualization is supported... | ||
sudo apt --assume-yes install --no-install-recommends cpu-checker coreutils && echo "CPUs=$(nproc --all)" && kvm-ok | ||
# allow access to KVM to run the emulator | ||
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \ | ||
| sudo tee /etc/udev/rules.d/99-kvm4all.rules | ||
sudo udevadm control --reload-rules | ||
sudo udevadm trigger --name-match=kvm | ||
fi | ||
# Skipping on Windows since emulator doesn't start | ||
if [ "${{ startsWith(inputs.runner-os, 'windows') }}" = "false" ]; then | ||
briefcase run android gradle \ | ||
-d '{"avd":"beePhone"}' \ | ||
--Xemulator=-no-window \ | ||
--Xemulator=-no-snapshot \ | ||
--Xemulator=-no-audio \ | ||
--Xemulator=-no-boot-anim \ | ||
--shutdown-on-exit | ||
fi | ||
briefcase package android gradle --adhoc-sign | ||
- name: Build iOS App | ||
|
@@ -321,6 +363,7 @@ jobs: | |
briefcase create iOS xcode \ | ||
${{ steps.output-format.outputs.template-override }} | ||
briefcase build iOS xcode | ||
briefcase run iOS xcode -d "iPhone SE (3rd generation)" | ||
briefcase package iOS xcode --adhoc-sign | ||
- name: Build Web App | ||
|
This file contains 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
Oops, something went wrong.