-
Notifications
You must be signed in to change notification settings - Fork 4
133 lines (127 loc) · 4.62 KB
/
python-app.yml
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
name: Build
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
inputs:
version:
description: Version
jobs:
build:
strategy:
matrix:
include:
- name: Windows Build
os: windows-latest
architecture: x64
artifact: windows
upload_path_suffix: '/*'
- name: MacOS Build
os: macos-latest
architecture: x64
artifact: macos
upload_path_suffix: '.zip'
- name: Linux Build
os: ubuntu-20.04
architecture: x64
artifact: linux
upload_path_suffix: '/*'
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
MACOSX_DEPLOYMENT_TARGET: 10.15
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up Python 3.11
id: setup-py
uses: actions/setup-python@v4
with:
python-version: '3.11'
check-latest: true
architecture: ${{ matrix.architecture }}
cache: 'pip' # Cache all pip dependency downloads
- name: Get PyJ3DUltra submodule status for cache
run: |
git submodule status ./PyJ3DUltra > pyj3dultra_submodule_status.txt
- name: Cache PyJ3DUltra
id: cache-pyj3dultra
uses: actions/cache@v3
with:
path: '${{ github.workspace }}/PyJ3DUltra/build'
key: pyj3dultra-${{ runner.os }}-py${{ steps.setup-py.outputs.python-version }}-${{ hashFiles('pyj3dultra_submodule_status.txt') }}
- name: Setup cmake
if: steps.cache-pyj3dultra.outputs.cache-hit != 'true'
uses: lukka/get-cmake@latest
- name: Setup vcpkg
if: runner.os == 'Windows' && steps.cache-pyj3dultra.outputs.cache-hit != 'true'
uses: lukka/run-vcpkg@v11.1
with:
vcpkgGitCommitId: 'ad46340bfce415333d6a2139592c22a499fb0df0'
vcpkgDirectory: '${{ github.workspace }}/vcpkg'
vcpkgJsonGlob: '**/PyJ3DUltra/vcpkg.json'
- name: Integrate vcpkg
if: runner.os == 'Windows' && steps.cache-pyj3dultra.outputs.cache-hit != 'true'
run: |
vcpkg integrate install
- name: Run CMake
if: steps.cache-pyj3dultra.outputs.cache-hit != 'true'
uses: lukka/run-cmake@v3
with:
cmakeListsOrSettingsJson: CMakeListsTxtAdvanced
cmakeListsTxtPath: '${{ github.workspace }}/PyJ3DUltra/CMakeLists.txt'
buildDirectory: '${{ github.workspace }}/PyJ3DUltra/build'
useVcpkgToolchainFile: true
cmakeAppendedArgs: '-G Ninja'
buildWithCMakeArgs: --config Release
- name: Cache venv
id: cache-venv
uses: actions/cache@v3
with:
path: ./.venv
key: ${{ runner.os }}-venv-${{ steps.setup-py.outputs.python-version }}-${{ hashFiles('**/requirements*.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
- 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_full.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: Set variables
id: vars
run: |
USER_INPUT_VERSION=${{ github.event.inputs.version }}
TXT_VERSION=$(cat version.txt)
GIT_SHA_SHORT=$(git rev-parse --short=7 ${{ github.sha }})
echo "full_version=${USER_INPUT_VERSION:-${TXT_VERSION}_${GIT_SHA_SHORT}}" >> $GITHUB_OUTPUT
- name: Set version
id: version
run: |
echo ${{ steps.vars.outputs.full_version }} > version.txt
- name: Build Python App
run: python -m PyInstaller --log-level=WARN gcft.spec
- name: Bundle Python App
run: python build.py
- name: Upload Python App
uses: actions/upload-artifact@v3
with:
name: gcft-${{ steps.vars.outputs.full_version }}-${{ matrix.artifact }}-${{ matrix.architecture }}
path: dist/release_archive_${{ steps.vars.outputs.full_version }}_${{ matrix.architecture }}${{ matrix.upload_path_suffix }}