Skip to content

Merge pull request #395 from tanjo3/wizzrobe-logic #562

Merge pull request #395 from tanjo3/wizzrobe-logic

Merge pull request #395 from tanjo3/wizzrobe-logic #562

Workflow file for this run

name: Build
on:
push:
branches: [ master ]
paths-ignore:
- 'docs/**'
pull_request:
branches: [ master ]
paths-ignore:
- 'docs/**'
workflow_dispatch:
inputs:
version:
description: Version
env:
description: Environment
type: environment
required: true
default: "Production"
jobs:
build:
strategy:
matrix:
include:
- name: Windows
os: windows-latest
architecture: x64
artifact: windows
upload_path_suffix: '/*'
reqs_file: requirements_full.txt
- name: Windows (Qt 5)
os: windows-latest
architecture: x64
artifact: windows-qt5
upload_path_suffix: '/*'
reqs_file: requirements_qt5_full.txt
- name: MacOS
os: macos-latest
architecture: x64
artifact: macos
upload_path_suffix: '.zip'
reqs_file: requirements_full.txt
- name: Linux
os: ubuntu-latest
architecture: x64
artifact: linux
upload_path_suffix: '/*'
reqs_file: requirements_full.txt
runs-on: ${{ matrix.os }}
environment: ${{ github.event.inputs.env || 'Development' }}
defaults:
run:
shell: bash
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
MACOSX_DEPLOYMENT_TARGET: 10.15
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Add keys
run: |
echo "$SEED_KEY" > keys/seed_key.py
env:
SEED_KEY: ${{ secrets.SEED_KEY }}
- name: Set up Python
id: setup-py
uses: actions/setup-python@v4
with:
python-version: '3.12'
check-latest: true
architecture: ${{ matrix.architecture }}
cache: 'pip' # Cache all pip dependency downloads
- name: Cache venv
id: cache-venv
uses: actions/cache@v3
with:
path: ./.venv
key: ${{ runner.os }}-venv-${{ steps.setup-py.outputs.python-version }}-${{ matrix.reqs_file }}-${{ 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 ${{ matrix.reqs_file }}
- 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 wwrando.spec
- name: Bundle Python App
run: python build.py
- name: Upload Python App
uses: actions/upload-artifact@v3
with:
name: wwrando-${{ steps.vars.outputs.full_version }}-${{ matrix.artifact }}-${{ matrix.architecture }}
path: dist/release_archive_${{ steps.vars.outputs.full_version }}_${{ matrix.architecture }}${{ matrix.upload_path_suffix }}