Skip to content

Commit

Permalink
build: added workflow to build & upload artifacts for various platforms
Browse files Browse the repository at this point in the history
In theory this workflow should generate binaries for Windows, macOS
and Linux.

The universal2 target for macOS might not work with Python 3.9
See:
- actions/runner-images#4133 (comment)
- pyinstaller/pyinstaller#5315 (comment)
  • Loading branch information
lukadd16 committed Apr 16, 2023
1 parent 0994258 commit 6230632
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 2 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Artifacts

on:
push:
tags:
- '*'
branches:
- main
pull_request:
branches:
- main

defaults:
run:
shell: bash

jobs:
unix-build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]

steps:
- uses: actions/checkout@v3

- name: Setup Python 3.9
uses: actions/setup-python@v3
with:
python-version: 3.9

- name: Generate Binary
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install
OS=$(uname -s | tr A-Z a-z)
VERSION=$(poetry version) | cut -d " " -f 2
pyinstaller --target-architecture=universal2 --noconsole --clean --noconfirm --onefile run_away/__main__.py --name "run-away-$VERSION-$OS" --add-data "run_away/resources:resources"
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
path: dist/run-away.*

windows-build:
runs-on: windows-latest

steps:
- uses: actions/checkout@v3

- name: Setup Python 3.9
uses: actions/setup-python@v3
with:
python-version: 3.9

- name: Generate Binary
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install
VERSION=$(poetry version) | cut -d " " -f 2
pyinstaller --noconsole --clean --noconfirm --onefile run_away/__main__.py --name "run-away-$VERSION-windows" --add-data "run_away/resources;resources"
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
path: dist/run-away.*
8 changes: 7 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,33 @@ on:
jobs:
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9

- name: Setup Python 3.9
uses: actions/setup-python@v3
with:
python-version: 3.9

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install
- name: Lint with ruff (errors)
uses: chartboost/ruff-action@v1
with:
version: 0.0.255
args: --format=github --select=E9,F7,F63,F82 --show-source

- name: Lint with ruff (warnings)
uses: chartboost/ruff-action@v1
with:
version: 0.0.255
args: --exit-zero

- name: Check formatting with black
uses: psf/black@stable
with:
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -166,4 +166,5 @@ cython_debug/
.vscode/settings.json

# PyInstaller
!*.spec
!run-away.spec
!run-away-debug.spec

0 comments on commit 6230632

Please sign in to comment.