-
Notifications
You must be signed in to change notification settings - Fork 7
134 lines (124 loc) · 4.37 KB
/
build.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
name: Build
on:
push:
branches:
- main
workflow_dispatch:
inputs:
# we don't currently take in the input version, instead
# we read the version from the constants/randoconstants.py file
# version:
# description: Version
# type: string
env:
description: Environment
type: string
required: true
default: "Production"
workflow_call: # allows the workflow to be called from other workflows
inputs:
# version:
# description: Version
# type: string
env:
description: Environment
type: string
required: true
default: "Production"
jobs:
build:
strategy:
matrix:
include:
- name: Windows Build
os: windows-latest
architecture: x64
artifact: windows
artifact_suffix: ""
- name: MacOS Build x64
os: macos-13
architecture: x64
artifact: macos
artifact_suffix: _intel
- name: MacOS Build arm64
os: macos-14
architecture: arm64
artifact: macos
artifact_suffix: _apple_silicon
- name: Linux Build
os: ubuntu-latest
architecture: x64
artifact: linux
artifact_suffix: ""
runs-on: ${{ matrix.os }}
environment: ${{ github.event.inputs.env || 'Production' }}
defaults:
run:
shell: bash
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
MACOSX_DEPLOYMENT_TARGET: 13
steps:
- uses: actions/checkout@v4
# Setup Python
- name: Set up Python
id: setup-py
uses: actions/setup-python@v5
with:
# TODO: Unfreeze python version when this is resolved: https://github.com/actions/setup-python/issues/886
python-version: "3.12.3"
check-latest: true
architecture: ${{ matrix.architecture }}
cache: "pip" # Cache all pip dependency downloads
- name: Cache venv
id: cache-venv
uses: actions/cache@v4
with:
path: ./.venv
key: ${{ matrix.os }}-venv-${{ steps.setup-py.outputs.python-version }}-${{ hashFiles('**/req*.txt') }}
- name: Create venv
if: steps.cache-venv.outputs.cache-hit != 'true'
run: |
python -m venv ./.venv
- name: Activate venv
run: |
source ./.venv/bin/activate || source ./.venv/Scripts/activate
echo $PATH >> $GITHUB_PATH
# Build and compile
- name: Install venv dependencies
if: steps.cache-venv.outputs.cache-hit != 'true'
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
- name: Install any missing Qt dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y qtbase5-dev
sudo apt-get install -y libxcb-cursor0
- name: Build Python App
run: python -m PyInstaller --log-level=WARN sshdrando.spec
- name: Bundle Python App
run: python build.py
- name: Read Version
uses: SebRollen/[email protected]
id: read_toml
with:
file: "constants/randoconstants.py"
field: "VERSION"
# Archive and upload artifacts
- name: Tar Files if not Windows Build
if: runner.os != 'Windows'
run: tar -C "dist/release_archive_${{ steps.read_toml.outputs.value }}_${{ matrix.artifact }}/" -cvf "Skyward Sword HD Randomizer v${{ steps.read_toml.outputs.value }} (${{ matrix.artifact }}${{ matrix.artifact_suffix }}).tar" .
- name: Upload non-Windows Artifact
if: runner.os != 'Windows'
uses: actions/upload-artifact@v4
with:
name: Skyward Sword HD Randomizer v${{ steps.read_toml.outputs.value }} (${{ matrix.artifact }}${{ matrix.artifact_suffix }})
path: Skyward Sword HD Randomizer v${{ steps.read_toml.outputs.value }} (${{ matrix.artifact }}${{ matrix.artifact_suffix }}).tar
- name: Upload Windows Artifact
if: runner.os == 'Windows'
uses: actions/upload-artifact@v4
with:
name: Skyward Sword HD Randomizer v${{ steps.read_toml.outputs.value }} (${{ matrix.artifact }})
path: dist/release_archive_${{ steps.read_toml.outputs.value }}_${{ matrix.artifact }}