Under New Management #152
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- '*' | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
windows-exe: | |
runs-on: windows-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
target: [x64] | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
architecture: ${{ matrix.target }} | |
- name: Build .exe | |
run: | | |
pip install pyinstaller | |
cargo build --release | |
ren ./target/release/tt_damage_calculator.dll tt_damage_calculator.pyd | |
move ./target/release/tt_damage_calculator.pyd ./src/tt_damage_calculator | |
pyinstaller "Toontown Damage Calculator.spec" | |
robocopy "./src/tt_damage_calculator/assets" "./dist/assets" /s; if ($lastexitcode -lt 8) { $global:LASTEXITCODE = $null } | |
copy "./LICENSE" "./dist" | |
- name: Upload .exe | |
uses: actions/upload-artifact@v4 | |
with: | |
name: executable-windows-x64 | |
path: dist | |
windows-wheel: | |
runs-on: ${{ matrix.platform.runner }} | |
strategy: | |
matrix: | |
platform: | |
- runner: windows-latest | |
target: x64 | |
- runner: windows-latest | |
target: x86 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
architecture: ${{ matrix.platform.target }} | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: ${{ matrix.platform.target }} | |
args: --release --out dist --find-interpreter | |
sccache: 'true' | |
- name: Upload wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-windows-${{ matrix.platform.target }} | |
path: dist | |
ubuntu-exe: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
target: [x86_64] | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Install requirements | |
run: | | |
sudo apt-get install python3-tk | |
pip install pyinstaller | |
- name: Build executable | |
run: | | |
cargo build --release | |
mv -n target/release/libtt_damage_calculator.so src/tt_damage_calculator/tt_damage_calculator.so | |
pyinstaller "Toontown Damage Calculator.spec" | |
cp -r -f src/tt_damage_calculator/assets dist | |
cp -f LICENSE dist/LICENSE | |
- name: Upload executable | |
uses: actions/upload-artifact@v4 | |
with: | |
name: executable-ubuntu-x86_64 | |
path: dist | |
linux-wheel: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
target: [x86_64] | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
# i cant seem to get the maturin action to work properly for linux | |
# so i will be trying my best to emulate it with a list of commands instead | |
- name: Build Wheel | |
run: | | |
pip install maturin | |
maturin build --release --out dist --find-interpreter | |
- name: Upload Wheel | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-linux-x86_64 | |
path: dist | |
macos-exe: | |
runs-on: macos-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
target: [x86_64] | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Build executable | |
run: | | |
brew install python-tk | |
pip install pyinstaller | |
cargo rustc --release -- -C link-arg=-undefined -C link-arg=dynamic_lookup | |
mv ./target/release/libtt_damage_calculator.dylib ./src/tt_damage_calculator/tt_damage_calculator.so | |
pyinstaller "Toontown Damage Calculator.spec" | |
cp -R ./src/tt_damage_calculator/assets ./dist/assets | |
cp -R ./LICENSE ./dist | |
- name: Upload executable | |
uses: actions/upload-artifact@v4 | |
with: | |
name: executable-macos-x86_64 | |
path: dist | |
macos-wheel: | |
runs-on: ${{ matrix.platform.runner }} | |
strategy: | |
matrix: | |
platform: | |
- runner: macos-latest | |
target: x86_64 | |
- runner: macos-14 | |
target: aarch64 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: ${{ matrix.platform.target }} | |
args: --release --out dist --find-interpreter | |
sccache: 'true' | |
- name: Upload wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-macos-${{ matrix.platform.target }} | |
path: dist | |
sdist: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build sdist | |
uses: PyO3/maturin-action@v1 | |
with: | |
command: sdist | |
args: --out dist | |
- name: Upload sdist | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-sdist | |
path: dist | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: [linux-wheel, windows-wheel, macos-wheel, sdist] | |
steps: | |
- uses: actions/download-artifact@v4 | |
- name: Publish to PyPI | |
uses: PyO3/maturin-action@v1 | |
env: | |
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} | |
with: | |
command: upload | |
args: --non-interactive --skip-existing wheels-*/* | |