| 1 |
name: CI |
| 2 |
on: |
| 3 |
pull_request: |
| 4 |
push: |
| 5 |
branches: |
| 6 |
- main # update to match the default branch for your repo |
| 7 |
|
| 8 |
# Cancel active CI runs for a PR before starting another run |
| 9 |
concurrency: |
| 10 |
group: ${{ github.workflow}}-${{ github.ref }} |
| 11 |
cancel-in-progress: ${{ github.event_name == 'pull_request' }} |
| 12 |
|
| 13 |
env: |
| 14 |
FORCE_COLOR: "1" |
| 15 |
|
| 16 |
defaults: |
| 17 |
run: |
| 18 |
shell: bash |
| 19 |
|
| 20 |
jobs: |
| 21 |
ci: |
| 22 |
name: Test and Package |
| 23 |
runs-on: ${{ matrix.runs-on }} |
| 24 |
strategy: |
| 25 |
fail-fast: false |
| 26 |
matrix: |
| 27 |
target: [ "Windows", "macOS", "Ubuntu-24.04", "Fedora-40", "iOS", "Android"] |
| 28 |
include: |
| 29 |
- target: "Windows" |
| 30 |
output-format: "app" |
| 31 |
runs-on: "windows-latest" |
| 32 |
|
| 33 |
- target: "macOS" |
| 34 |
output-format: "app" |
| 35 |
runs-on: "macos-latest" |
| 36 |
|
| 37 |
- target: "Ubuntu-24.04" |
| 38 |
platform: "Linux" |
| 39 |
output-format: "system" |
| 40 |
runs-on: "ubuntu-latest" |
| 41 |
pre-command: "sudo apt -y install socat" |
| 42 |
briefcase-run-prefix: "xvfb-run" |
| 43 |
briefcase-args: "--target ubuntu:24.04" |
| 44 |
|
| 45 |
- target: "Fedora-40" |
| 46 |
platform: "Linux" |
| 47 |
output-format: "system" |
| 48 |
runs-on: "ubuntu-latest" |
| 49 |
pre-command: "sudo apt -y install socat" |
| 50 |
briefcase-run-prefix: "xvfb-run" |
| 51 |
briefcase-args: "--target fedora:40" |
| 52 |
|
| 53 |
- target: "iOS" |
| 54 |
output-format: "Xcode" |
| 55 |
runs-on: "macos-latest" |
| 56 |
briefcase-run-args: "--device 'iPhone SE (3rd generation)'" |
| 57 |
|
| 58 |
- target: "Android" |
| 59 |
output-format: "Gradle" |
| 60 |
runs-on: "ubuntu-latest" |
| 61 |
pre-command: | |
| 62 |
# Enable KVM permissions for the emulator |
| 63 |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' \ |
| 64 |
| sudo tee /etc/udev/rules.d/99-kvm4all.rules |
| 65 |
sudo udevadm control --reload-rules |
| 66 |
sudo udevadm trigger --name-match=kvm |
| 67 |
briefcase-run-args: >- |
| 68 |
--device '{"avd":"beePhone"}' |
| 69 |
--shutdown-on-exit |
| 70 |
--Xemulator=-no-window |
| 71 |
--Xemulator=-no-snapshot |
| 72 |
--Xemulator=-no-audio |
| 73 |
--Xemulator=-no-boot-anim |
| 74 |
|
| 75 |
steps: |
| 76 |
- name: Checkout |
| 77 |
uses: actions/checkout@v4 |
| 78 |
|
| 79 |
- name: Setup Python |
| 80 |
uses: actions/setup-python@v4 |
| 81 |
with: |
| 82 |
python-version: "3.12" # update with your targeted Python version |
| 83 |
|
| 84 |
- name: Install Briefcase |
| 85 |
run: | |
| 86 |
python -m pip install -U pip setuptools wheel |
| 87 |
python -m pip install briefcase |
| 88 |
|
| 89 |
- name: Setup Environment |
| 90 |
run: | |
| 91 |
# Use GitHub's preinstalled JDK 17 for Android builds |
| 92 |
echo JAVA_HOME="${JAVA_HOME_17_X64:-$JAVA_HOME_17_arm64}" | tee -a ${GITHUB_ENV} |
| 93 |
${{ matrix.pre-command }} |
| 94 |
|
| 95 |
- name: Build App |
| 96 |
run: | |
| 97 |
${{ matrix.briefcase-build-prefix }} \ |
| 98 |
briefcase build \ |
| 99 |
${{ matrix.platform || matrix.target }} \ |
| 100 |
${{ matrix.output-format }} \ |
| 101 |
--test --no-input --log \ |
| 102 |
${{ matrix.briefcase-args }} \ |
| 103 |
${{ matrix.briefcase-build-args }} |
| 104 |
|
| 105 |
- name: Test App |
| 106 |
run: | |
| 107 |
${{ matrix.briefcase-run-prefix }} \ |
| 108 |
briefcase run \ |
| 109 |
${{ matrix.platform || matrix.target }} \ |
| 110 |
${{ matrix.output-format }} \ |
| 111 |
--test --no-input --log \ |
| 112 |
${{ matrix.briefcase-args }} \ |
| 113 |
${{ matrix.briefcase-run-args }} |
| 114 |
|
| 115 |
- name: Package App |
| 116 |
run: | |
| 117 |
${{ matrix.briefcase-package-prefix }} \ |
| 118 |
briefcase package \ |
| 119 |
${{ matrix.platform || matrix.target }} \ |
| 120 |
${{ matrix.output-format }} \ |
| 121 |
--update --adhoc-sign --no-input --log \ |
| 122 |
${{ matrix.briefcase-args }} \ |
| 123 |
${{ matrix.briefcase-package-args }} |
| 124 |
|
| 125 |
- name: Upload App |
| 126 |
# Briefcase cannot create iOS artefacts; instead, apps |
| 127 |
# must be packaged and published for iOS through Xcode. |
| 128 |
if: matrix.target != 'iOS' |
| 129 |
uses: actions/upload-artifact@v4 |
| 130 |
with: |
| 131 |
name: App-${{ matrix.target }} |
| 132 |
path: dist |
| 133 |
if-no-files-found: error |
| 134 |
|
| 135 |
- name: Upload Log |
| 136 |
if: failure() |
| 137 |
uses: actions/upload-artifact@v4 |
| 138 |
with: |
| 139 |
name: Log-Failure-${{ matrix.target }} |
| 140 |
path: logs/* |