Under New Management #92
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@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
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@v3 | |
with: | |
name: win64-executable | |
path: dist | |
windows-wheel: | |
runs-on: windows-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
target: [x64, x86] | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
architecture: ${{ matrix.target }} | |
- name: Build Wheel | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: ${{ matrix.target }} | |
args: --release --out dist --find-interpreter | |
sccache: 'true' | |
- name: Upload Wheel | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: dist | |
linux-wheel: | |
runs-on: ${{ matrix.platform.runner }} | |
strategy: | |
matrix: | |
platform: | |
- runner: ubuntu-latest | |
target: x86_64 | |
- runner: ubuntu-latest | |
target: x86 | |
- runner: ubuntu-latest | |
target: aarch64 | |
- runner: ubuntu-latest | |
target: armv7 | |
- runner: ubuntu-latest | |
target: s390x | |
- runner: ubuntu-latest | |
target: ppc64le | |
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' | |
manylinux: auto | |
- name: Upload wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-linux-${{ matrix.platform.target }} | |
path: dist | |
macos-exe: | |
runs-on: macos-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
target: [x86_64] | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Build executable | |
run: | | |
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@v3 | |
with: | |
name: mac64-executable | |
path: dist | |
macos-wheel: | |
runs-on: macos-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
target: [x86_64, aarch64] | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Build Wheel | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: ${{ matrix.target }} | |
args: --release --out dist --find-interpreter | |
sccache: 'true' | |
- name: Upload Wheel | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: dist | |
sdist: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Build Source Distribution | |
run: | | |
pip install maturin | |
maturin build --release --sdist --out dist | |
- name: Upload Source Distribution | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: dist | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: [windows-wheel, linux-wheel, macos-wheel, sdist] | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: wheels | |
- 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 * |