Skip to content

Commit

Permalink
chore: Attempt to fix MacOS build
Browse files Browse the repository at this point in the history
  • Loading branch information
Loukious committed Aug 22, 2024
1 parent 4e29b81 commit e665ee5
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 54 deletions.
154 changes: 103 additions & 51 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,87 +1,119 @@
name: Release

on:
push:
tags:
- v*

env:
FORCE_COLOR: true

jobs:

build_windows:
runs-on: windows-latest
strategy:
matrix:
build_type: [Release, Debug]

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

- name: Set Release variable
run: |
$env:Release = '${{ matrix.build_type }}'
- name: Install sccache
run: choco install sccache -y

- name: Configure sccache
run: |
set SCCACHE_DIR=D:\a\StreamLabsTikTokStreamKeyGenerator\StreamLabsTikTokStreamKeyGenerator\.sccache
set SCCACHE_CACHE_SIZE=500M
set RUSTC_WRAPPER=sccache
- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.12"
python-version: "3.10"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pyinstaller
pip install Nuitka
if (Test-Path requirements.txt) {
pip install -r requirements.txt
}
- name: Build Normal Executable (without console)
run: pyinstaller --onefile --clean -w --add-data ".seleniumwire/seleniumwire-ca.pem;seleniumwire/.seleniumwire" --add-data ".seleniumwire/seleniumwire-dhparam.pem;seleniumwire/.seleniumwire" StreamLabsTikTokStreamKeyGenerator.py
- name: Rename Normal Executable
run: Rename-Item -Path dist/StreamLabsTikTokStreamKeyGenerator.exe -NewName StreamLabsTikTokStreamKeyGeneratorRelease.exe
- name: Build Debug Executable (with console)
run: pyinstaller --onefile --clean --add-data ".seleniumwire/seleniumwire-ca.pem;seleniumwire/.seleniumwire" --add-data ".seleniumwire/seleniumwire-dhparam.pem;seleniumwire/.seleniumwire" StreamLabsTikTokStreamKeyGenerator.py
- name: Rename Debug Executable
run: Rename-Item -Path dist/StreamLabsTikTokStreamKeyGenerator.exe -NewName StreamLabsTikTokStreamKeyGeneratorDebug.exe
- name: Clean up obsolete files
run: Remove-Item -Path build, StreamLabsTikTokStreamKeyGenerator.spec -Recurse -Force

- name: Build Executable
run: |
if ($env:Release -eq 'Release') {
sccache --show-stats
nuitka --windows-console-mode=disable --msvc=latest --assume-yes-for-downloads --onefile --follow-imports --enable-plugin=tk-inter --include-data-file=.seleniumwire/seleniumwire-ca.pem=seleniumwire/.seleniumwire/seleniumwire-ca.pem --include-data-file=.seleniumwire/seleniumwire-dhparam.pem=seleniumwire/.seleniumwire/seleniumwire-dhparam.pem StreamLabsTikTokStreamKeyGenerator.py
sccache --show-stats
} else {
sccache --show-stats
nuitka --msvc=latest --assume-yes-for-downloads --onefile --follow-imports --enable-plugin=tk-inter --include-data-file=.seleniumwire/seleniumwire-ca.pem=seleniumwire/.seleniumwire/seleniumwire-ca.pem --include-data-file=.seleniumwire/seleniumwire-dhparam.pem=seleniumwire/.seleniumwire/seleniumwire-dhparam.pem StreamLabsTikTokStreamKeyGenerator.py
sccache --show-stats
}
- name: Rename Executable
run: Rename-Item -Path StreamLabsTikTokStreamKeyGenerator.exe -NewName StreamLabsTikTokStreamKeyGenerator${{ matrix.build_type }}.exe

- name: Compress Executable
run: Compress-Archive -Path StreamLabsTikTokStreamKeyGenerator${{ matrix.build_type }}.exe -DestinationPath StreamLabsTikTokStreamKeyGenerator${{ matrix.build_type }}.zip

- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: windows
path: |
dist/StreamLabsTikTokStreamKeyGeneratorRelease.exe
dist/StreamLabsTikTokStreamKeyGeneratorDebug.exe
./StreamLabsTikTokStreamKeyGeneratorRelease.zip
./StreamLabsTikTokStreamKeyGeneratorDebug.zip
build_macos:
runs-on: macos-latest

strategy:
matrix:
architecture: [x86_64, arm64]
build_type: [Release, Debug]

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

- name: Set up ccache
uses: hendrikmuhs/[email protected]
with:
create-symlink: true

- name: Set up Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.12"
python-version: "3.10"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pyinstaller
pip install Nuitka
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Build Normal Executable (without console)
run: pyinstaller --onefile --clean -w --add-data ".seleniumwire/seleniumwire-ca.pem:seleniumwire/.seleniumwire" --add-data ".seleniumwire/seleniumwire-dhparam.pem:seleniumwire/.seleniumwire" StreamLabsTikTokStreamKeyGenerator.py
- name: Create .app Bundle
run: |
mkdir -p StreamLabsTikTokStreamKeyGenerator.app/Contents/MacOS
mv dist/StreamLabsTikTokStreamKeyGenerator StreamLabsTikTokStreamKeyGenerator.app/Contents/MacOS/StreamLabsTikTokStreamKeyGenerator
- name: Zip Normal Executable
run: zip -r dist/StreamLabsTikTokStreamKeyGeneratorRelease.MacOS.zip StreamLabsTikTokStreamKeyGenerator.app
- name: Build Debug Executable (with console)
run: pyinstaller --onefile --clean --add-data ".seleniumwire/seleniumwire-ca.pem:seleniumwire/.seleniumwire" --add-data ".seleniumwire/seleniumwire-dhparam.pem:seleniumwire/.seleniumwire" StreamLabsTikTokStreamKeyGenerator.py
- name: Create .app Bundle for Debug
- name: Build Executable
run: |
mkdir -p StreamLabsTikTokStreamKeyGenerator.app/Contents/MacOS
mv dist/StreamLabsTikTokStreamKeyGenerator StreamLabsTikTokStreamKeyGenerator.app/Contents/MacOS/StreamLabsTikTokStreamKeyGenerator
- name: Zip Debug Executable
run: zip -r dist/StreamLabsTikTokStreamKeyGeneratorDebug.MacOS.zip StreamLabsTikTokStreamKeyGenerator.app
- name: Clean up obsolete files
run: rm -rf build StreamLabsTikTokStreamKeyGenerator.spec StreamLabsTikTokStreamKeyGenerator.app

- name: Upload artifacts
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
arch -${{ matrix.architecture }} nuitka --windows-console-mode=disable --assume-yes-for-downloads --standalone --macos-create-app-bundle --onefile --follow-imports --enable-plugin=tk-inter --include-data-file=.seleniumwire/seleniumwire-ca.pem=seleniumwire/.seleniumwire/seleniumwire-ca.pem --include-data-file=.seleniumwire/seleniumwire-dhparam.pem=seleniumwire/.seleniumwire/seleniumwire-dhparam.pem StreamLabsTikTokStreamKeyGenerator.py
- name: Rename Executable
run: mv StreamLabsTikTokStreamKeyGenerator.app StreamLabsTikTokStreamKeyGenerator${{ matrix.build_type }}-${{ matrix.architecture }}.app

- name: Compress Executable
run: zip -r StreamLabsTikTokStreamKeyGenerator${{ matrix.build_type }}-${{ matrix.architecture }}.zip StreamLabsTikTokStreamKeyGenerator${{ matrix.build_type }}-${{ matrix.architecture }}.app

- name: Upload architecture-specific artifacts
uses: actions/upload-artifact@v3
with:
name: macos
path: |
dist/StreamLabsTikTokStreamKeyGeneratorRelease.MacOS.zip
dist/StreamLabsTikTokStreamKeyGeneratorDebug.MacOS.zip
name: macos-${{ matrix.build_type }}-${{ matrix.architecture }}
path: StreamLabsTikTokStreamKeyGenerator${{ matrix.build_type }}-${{ matrix.architecture }}.zip

release:
runs-on: ubuntu-latest
Expand All @@ -97,22 +129,42 @@ jobs:
name: windows
path: ./windows

- name: Download MacOS artifacts
- name: Download MacOS x86_64 Release artifacts
uses: actions/download-artifact@v3
with:
name: macos-Release-x86_64
path: ./macos/x86_64

- name: Download MacOS arm64 Release artifacts
uses: actions/download-artifact@v3
with:
name: macos-Release-arm64
path: ./macos/arm64

- name: Download MacOS x86_64 Debug artifacts
uses: actions/download-artifact@v3
with:
name: macos-Debug-x86_64
path: ./macos/x86_64

- name: Download MacOS arm64 Debug artifacts
uses: actions/download-artifact@v3
with:
name: macos
path: ./macos
name: macos-Debug-arm64
path: ./macos/arm64

- name: Create the release
uses: softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5 # v1
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: ${{ github.ref_name }}
prerelease: false
prerelease: ${{ github.event.inputs.prerelease }}
draft: false
files: |
./windows/StreamLabsTikTokStreamKeyGeneratorRelease.exe
./windows/StreamLabsTikTokStreamKeyGeneratorDebug.exe
./macos/StreamLabsTikTokStreamKeyGeneratorRelease.MacOS.zip
./macos/StreamLabsTikTokStreamKeyGeneratorDebug.MacOS.zip
./windows/StreamLabsTikTokStreamKeyGeneratorRelease.zip
./windows/StreamLabsTikTokStreamKeyGeneratorDebug.zip
./macos/x86_64/StreamLabsTikTokStreamKeyGeneratorRelease-x86_64.zip
./macos/x86_64/StreamLabsTikTokStreamKeyGeneratorDebug-x86_64.zip
./macos/arm64/StreamLabsTikTokStreamKeyGeneratorRelease-arm64.zip
./macos/arm64/StreamLabsTikTokStreamKeyGeneratorDebug-arm64.zip
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ dist/*
.env
__pycache__/*
cookies.json
.venv/*
.venv/*
StreamLabsTikTokStreamKeyGenerator.dist/*
*.xml
*.exe
2 changes: 0 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
requests>=2.31.0
pyinstaller>=6.6.0
setuptools>=69.5.1
selenium-wire>=5.1.0
undetected_chromedriver>=3.5.5
blinker==1.7.0

0 comments on commit e665ee5

Please sign in to comment.