Add github actions for macos
This commit is contained in:
parent
e71ae0fa89
commit
52786e9d5b
1 changed files with 115 additions and 0 deletions
115
.github/workflows/default.yml
vendored
Normal file
115
.github/workflows/default.yml
vendored
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
# This is a basic workflow to help you get started with Actions
|
||||
|
||||
name: CI
|
||||
|
||||
# Controls when the workflow will run
|
||||
on:
|
||||
# Triggers the workflow on push or pull request events but only for the "master" branch
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
pull_request:
|
||||
branches: [ "master" ]
|
||||
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
||||
jobs:
|
||||
macos:
|
||||
name: Build for macOS
|
||||
runs-on: [macos-11, macos-12]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup Homebrew
|
||||
run: |
|
||||
NONINTERACTIVE=1 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||||
brew install create-dmg
|
||||
- name: Setup Python
|
||||
run: |
|
||||
wget https://www.python.org/ftp/python/3.10.8/python-3.10.8-macos11.pkg
|
||||
sudo installer -verbose -pkg ./python-3*.pkg -target /
|
||||
echo "/Library/Frameworks/Python.framework/Versions/3.10/bin" >> $GITHUB_PATH
|
||||
- name: Setup Env Vars
|
||||
run: |
|
||||
echo "BUILD_DIR=build" >> $GITHUB_ENV
|
||||
export VER="$(cat info.py | awk '/version/ {gsub("\047", "", $3); print $NF}')"
|
||||
export PROJ_NAME="$(cat info.py | awk '/name/ {gsub("\047", "", $3); print $NF}')"
|
||||
export PROJ_MOD="$(cat info.py | awk '/module_name/ {gsub("\047", "", $3); print $NF}')"
|
||||
export MAIN_FILE="$(cat info.py | awk '/main_file/ {gsub("\047", "", $3); print $NF}')"
|
||||
export BUNDLE_ID="$(cat info.py | awk '/bundle_identifier/ {gsub("\047", "", $3); print $NF}')"
|
||||
echo "VER=$VER" >> $GITHUB_ENV
|
||||
echo "PROJECT_NAME=$PROJ_NAME" >> $GITHUB_ENV
|
||||
echo "PROJ_DIR=$PROJ_MOD" >> $GITHUB_ENV
|
||||
echo "MAIN_FILE=$MAIN_FILE" >> $GITHUB_ENV
|
||||
echo "BUNDLE_ID=$BUNDLE_ID" >> $GITHUB_ENV
|
||||
- name: Check Python install
|
||||
run: |
|
||||
which python3
|
||||
python3 --version
|
||||
which pip3
|
||||
pip3 --version
|
||||
file python3
|
||||
- name: Install Python dependencies
|
||||
run: |
|
||||
pip3 install --upgrade pip
|
||||
python3 -m venv venv
|
||||
source venv/bin/activate
|
||||
pip3 install -U pip setuptools wheel certifi
|
||||
pip3 install -r requirements.txt
|
||||
pip3 install py2app
|
||||
PYINSTALLER_COMPILE_BOOTLOADER=1 MACOSX_DEPLOYMENT_TARGET=10.9 pip3 install https://github.com/pyinstaller/pyinstaller/tarball/develop --no-binary :all:
|
||||
- name: Install universal2 dependencies
|
||||
env:
|
||||
CFLAGS: -arch x86_64 -arch arm64
|
||||
ARCHFLAGS: -arch x86_64 -arch arm64
|
||||
run: |
|
||||
pip3 uninstall cffi -y
|
||||
pip3 install --no-binary :all: cffi
|
||||
pip3 uninstall cryptography -y
|
||||
pip3 download --platform macosx_10_10_universal2 --only-binary :all: --no-deps --dest . cryptography
|
||||
pip3 install --no-cache-dir --no-index --find-links . cryptography
|
||||
- name: Check Python dependencies
|
||||
run: |
|
||||
python3 -c "from PySide6 import __version__; print(__version__)"
|
||||
python3 -c "from PySide6.QtCore import __version__; print(__version__)"
|
||||
python3 -c "from PySide6.QtCore import QLibraryInfo; print(QLibraryInfo.location(QLibraryInfo.LibrariesPath))"
|
||||
python3 -c "import ssl; print(ssl)"
|
||||
python3 -c "from py2app.recipes import pyside6"
|
||||
python3 -c 'from distutils.sysconfig import get_config_var; print(get_config_var("LDLIBRARY"))'
|
||||
- name: Build
|
||||
run: |
|
||||
python3 buildPy2app.py py2app
|
||||
pyinstaller -w --hidden-import PySide6 \
|
||||
--add-data "${{ env.PROJ_DIR }}/resources" \
|
||||
--icon "${{ env.PROJ_DIR }}/resources/icon.icns" \
|
||||
--target-architecture universal2 \
|
||||
--osx-bundle-identifier "pl.${{ env.PROJ_DIR }}.${{ env.PROJ_DIR }}"
|
||||
--hidden-import pkg_resources \
|
||||
--distpath "${{ env.BUILD_DIR }}/" \
|
||||
--onefile -n "${{ env.PROJECT_NAME }}" "${{ env.PROJ_DIR }}/${{ env.MAIN_FILE }}"
|
||||
- name: Prepare for deployment
|
||||
run: |
|
||||
mkdir "${{ env.BUILD_DIR }}/"
|
||||
test -f "${{ env.PROJECT_NAME }}_${{ env.VER }}.dmg" && rm "${{ env.PROJECT_NAME }}_${{ env.VER }}.dmg"
|
||||
create-dmg \
|
||||
--volname "${{ env.PROJECT_NAME }}-${{ env.VER }} Installer" \
|
||||
--volicon "${{ env.PROJ_DIR }}/resources/icon.icns" \
|
||||
--window-pos 200 120 \
|
||||
--window-size 800 400 \
|
||||
--icon-size 100 \
|
||||
--icon "${{ env.PROJECT_NAME }}.app" 200 190 \
|
||||
--hide-extension "${{ env.PROJECT_NAME }}.app" \
|
||||
--app-drop-link 600 185 \
|
||||
"${{ env.PROJECT_NAME }}_${{ env.VER }}.dmg" \
|
||||
"${{ env.BUILD_DIR }}/"
|
||||
ci/macos-deploy.sh
|
||||
ls -al dist_actions
|
||||
- name: Deploy
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: ${{ env.PROJECT_NAME }}_${{ env.VER }}.dmg
|
||||
path: |
|
||||
dist_actions/${{ env.PROJECT_NAME }}_${{ env.VER }}.dmg
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue