Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .env.example

This file was deleted.

208 changes: 47 additions & 161 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,11 @@ name: CI/CD
on:
pull_request:
push:
branches:
- main
- master
tags:
- "v*"
branches: [main, master]
tags: ["v*"]
release:
types: [published]
workflow_dispatch:
inputs:
run_live_e2e:
description: "Run live CurseForge/DeepSeek e2e tests"
required: false
default: false
type: boolean
live_deepseek_entries:
description: "Sample size for live DeepSeek e2e"
required: false
default: "12"
type: string

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -28,180 +16,78 @@ concurrency:
permissions:
contents: read

env:
PYTHON_VERSION: "3.11"
UV_LOCKED: "1"
UV_SYSTEM_PYTHON: "1"

jobs:
test:
name: Test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest

os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install uv
uses: astral-sh/setup-uv@v5
node-version: 22
cache: npm
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
enable-cache: true

- name: Sync dependencies
run: uv sync --dev --locked

- name: Run unit tests
run: uv run python -m tests.run_groups unit
workspaces: src-tauri
- name: Linux system dependencies
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- run: npm ci
- run: npm run build
- run: cargo test --manifest-path src-tauri/Cargo.toml

package:
name: Package (${{ matrix.suffix }})
name: Package (${{ matrix.os }})
needs: test
runs-on: ${{ matrix.os }}
if: github.event_name != 'pull_request'
if: >-
github.event_name == 'release' ||
github.event_name == 'workflow_dispatch' ||
startsWith(github.ref, 'refs/tags/v')
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
suffix: windows
- os: macos-latest
suffix: macos

os: [windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install uv
uses: astral-sh/setup-uv@v5
node-version: 22
cache: npm
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
enable-cache: true

- name: Sync dependencies
run: uv sync --dev --locked

- name: Build Windows exe
if: runner.os == 'Windows'
run: >
uv run python -m PyInstaller
--noconfirm
--clean
--onefile
--windowed
--name FTB-Translater
--collect-data customtkinter
main.py

- name: Prepare Windows artifact
if: runner.os == 'Windows'
shell: pwsh
run: |
New-Item -ItemType Directory -Force artifacts | Out-Null
Copy-Item "dist/FTB-Translater.exe" "artifacts/FTB-Translater-windows.exe" -Force
Get-Item "artifacts/FTB-Translater-windows.exe"

- name: Build macOS app
if: runner.os == 'macOS'
run: >
uv run python -m PyInstaller
--noconfirm
--clean
--windowed
--name FTB-Translater
--collect-data customtkinter
main.py

- name: Prepare macOS dmg
if: runner.os == 'macOS'
run: |
mkdir -p artifacts
hdiutil create \
-volname FTB-Translater \
-srcfolder dist/FTB-Translater.app \
-ov \
-format UDZO \
artifacts/FTB-Translater-macos.dmg
ls -lh artifacts/FTB-Translater-macos.dmg

- name: Upload package artifact
uses: actions/upload-artifact@v4
workspaces: src-tauri
- run: npm ci
- run: npm run tauri -- build
- uses: actions/upload-artifact@v4
with:
name: FTB-Translater-${{ matrix.suffix }}
path: artifacts/*
name: FTB-Translater-${{ runner.os }}
path: |
src-tauri/target/release/bundle/dmg/*.dmg
src-tauri/target/release/bundle/nsis/*.exe
src-tauri/target/release/bundle/msi/*.msi
if-no-files-found: error
retention-days: 14

live-e2e:
name: Live e2e
needs: test
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch' && inputs.run_live_e2e
env:
DEEPSEEK_API_KEY: ${{ secrets.DEEPSEEK_API_KEY }}
FTB_TRANSLATER_CURSEFORGE_URL: ${{ secrets.FTB_TRANSLATER_CURSEFORGE_URL }}
FTB_TRANSLATER_LIVE_DEEPSEEK_ENTRIES: ${{ inputs.live_deepseek_entries }}

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true

- name: Sync dependencies
run: uv sync --dev --locked

- name: Run full e2e tests
run: uv run python -m tests.run_groups e2e

- name: Upload e2e output
if: always()
uses: actions/upload-artifact@v4
with:
name: live-e2e-output
path: .ftb-translater/e2e-runs/
if-no-files-found: ignore
retention-days: 7

release:
name: Publish GitHub release
needs: package
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
if: github.event_name == 'release' || startsWith(github.ref, 'refs/tags/v')
permissions:
contents: write

steps:
- name: Download package artifacts
uses: actions/download-artifact@v4
- uses: actions/download-artifact@v4
with:
path: release-artifacts
merge-multiple: true

- name: Publish release assets
uses: softprops/action-gh-release@v2
- uses: softprops/action-gh-release@v2
with:
files: release-artifacts/*
tag_name: ${{ github.event.release.tag_name || github.ref_name }}
files: release-artifacts/**/*
fail_on_unmatched_files: true
7 changes: 1 addition & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
.env
.venv/
.idea/
.venv/
__pycache__/
*.py[cod]
.pytest_cache/
.ftb-translater/
history.sqlite3
*.egg-info/
build/
dist/
node_modules/
src-tauri/target/
*.spec
Loading
Loading