Skip to content

Commit

Permalink
Under New Management (#17)
Browse files Browse the repository at this point in the history
add any necessary changes needed for the "Under New Management" update.
  • Loading branch information
Vhou-Atroph authored May 24, 2024
2 parents 1cb64a6 + 9f014ae commit fd78a44
Show file tree
Hide file tree
Showing 36 changed files with 1,047 additions and 593 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**

- OS: [e.g. Windows 10, Linux Mint]
- Program Version: [e.g. 3.2.0, you can find this in mod/version.txt]
- Program Version: [e.g. 4.3.0, you can find this in assets/version.txt]

**Additional context**
Add any other context about the problem here.
214 changes: 214 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,214 @@
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: Build virtual environment
run: |
sudo apt-get install python3-tk
sudo apt-get install python3-venv
python3 -m venv .env
source .env/bin/activate
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
source .env/bin/activate
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-*/*

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.venv
*.pyc
*.so
dist
build

Expand Down
8 changes: 8 additions & 0 deletions .kateproject
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "Toontown Damage Calculator",
"files": [
{
"git": 1
}
]
}
9 changes: 9 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Contributing to TT-Damage-Calculator

The preferred way to contribute to the Toontown Damage Calculator is through reporting bugs and requesting features on the [issue tracker](https://github.com/Vhou-Atroph/TT-Damage-Calculator/issues)!

To submit an issue, click on the "New issue" button and select whether your issue is a bug report, or a feature request. It is highly recommended to follow the template provided to ensure clear communication! If your issue is a bug report, a screenshot can be very helpful for identifying what problem you are experiencing. If possible, following the [debugging guide](https://github.com/Vhou-Atroph/TT-Damage-Calculator/wiki/Building:-Windows-Executable#debugging) can be very helpful for making bug reports!

In the submission of multiple bugs, please make an issue for each one! This will help make sure it's easy to track when each individual bug has been fixed.

When submitting your issue, please keep swearing and other profane language to a minimum. Running into problems can be frustrating, but the issue tracker isn't the place for venting these frustrations- it's for identifying bugs, or thinking of potential enhancements for the program!
21 changes: 12 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,27 @@ name = "rustygag"
description = "Rust library providing the backend of the Toontown Damage Calculator."
authors = ["Vhou-Atroph"]
license = "GPLv3"
version = "4.2.0"
version = "4.3.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[lib]
name = "rustygag"
name = "tt_damage_calculator"
crate-type = ["cdylib"]

[dependencies.pyo3]
version = "0.18.1"
version = "0.21.2"
features = ["extension-module"]

[package.metadata.maturin]
name = "tt_damage_calculator.rustygag"
[dependencies.serde]
version = "1.0.201"
features = ["derive"]

[dependencies.tokio]
version = "1.37.0"
features = ["full"]

[dependencies]
serde = { version = "1.0.154", features = ["derive"] }
toml = "0.7.2"
reqwest = "0.11.14"
tokio = { version = "1.26.0", features = ["full"] }
toml = "0.8.12"
reqwest = "0.12.4"
22 changes: 15 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
all:
windows:
maturin build -i python
linux:
maturin build

exe:
pip install pyinstaller
cargo build --release
rename target\release\rustygag.dll rustygag.pyd
move target\release\rustygag.pyd src\tt_damage_calculator
pyinstaller "Toontown Damage Calculator.spec"
rename .\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"
copy ".\src\tt_damage_calculator\assets" ".\dist\assets"
copy ".\src\tt_damage_calculator\assets\img" ".\dist\assets\img"
copy "./LICENSE" "./dist"

exe-linux:
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
Loading

0 comments on commit fd78a44

Please sign in to comment.