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
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.{rs,gd}]
indent_size = 4

[*.gd]
indent_style = tab
60 changes: 60 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: CI

on:
push:
branches: [master, v2]
pull_request:

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: pnpm/action-setup@v6
- uses: actions/setup-node@v7
with:
node-version-file: .node-version
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: pnpm check
- run: pnpm build
- run: pnpm exec playwright install --with-deps chromium webkit
- run: pnpm test:e2e
- uses: actions/upload-artifact@v7
if: failure()
with:
name: playwright-report
path: |
test-results/
tests/fixtures/expected/*.actual.png
tests/fixtures/expected/*.diff.png
retention-days: 7

desktop:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v7
- name: Linux build dependencies
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- uses: pnpm/action-setup@v6
- uses: actions/setup-node@v7
with:
node-version-file: .node-version
cache: pnpm
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
with:
workspaces: src-tauri -> target
- run: pnpm install --frozen-lockfile
# the Rust build embeds ../dist
- run: pnpm build
- name: cargo fmt, clippy and test
working-directory: src-tauri
run: |
cargo fmt --check
cargo clippy --locked -- -D warnings
cargo test --locked
54 changes: 54 additions & 0 deletions .github/workflows/itch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: itch.io

# Optional: pushes a published release and the web version to itch.io with butler. Inactive until the repository
# has the variable ITCH_GAME (e.g. `route1rodent/autotiler`) and the secret BUTLER_API_KEY (`butler login`, or
# https://itch.io/user/settings/api-keys).

on:
release:
types: [published]
workflow_dispatch:
inputs:
tag:
description: Release tag to push, e.g. v2.0.0
required: true

jobs:
push:
if: vars.ITCH_GAME != ''
runs-on: ubuntu-latest
env:
TAG: ${{ github.event.release.tag_name || inputs.tag }}
ITCH_GAME: ${{ vars.ITCH_GAME }}
BUTLER_API_KEY: ${{ secrets.BUTLER_API_KEY }}
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v7
with:
ref: ${{ env.TAG }}
- uses: pnpm/action-setup@v6
- uses: actions/setup-node@v7
with:
node-version-file: .node-version
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: pnpm build
- name: Download the release bundles
run: |
mkdir -p itch/macos itch/windows itch/linux
gh release download "$TAG" --dir itch/macos --pattern '*_universal.dmg'
gh release download "$TAG" --dir itch/windows --pattern '*-setup.exe'
gh release download "$TAG" --dir itch/linux --pattern '*.AppImage'
- name: Install butler
run: |
curl -fsSL -o butler.zip https://broth.itch.zone/butler/linux-amd64/LATEST/archive/default
unzip -q butler.zip -d "$RUNNER_TEMP/butler"
chmod +x "$RUNNER_TEMP/butler/butler"
echo "$RUNNER_TEMP/butler" >> "$GITHUB_PATH"
- name: Push to itch.io
run: |
version="${TAG#v}"
butler push dist "$ITCH_GAME:html5" --userversion "$version"
butler push itch/macos "$ITCH_GAME:macos-universal" --userversion "$version"
butler push itch/windows "$ITCH_GAME:windows" --userversion "$version"
butler push itch/linux "$ITCH_GAME:linux-universal" --userversion "$version"
44 changes: 44 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Pages

# Publishes the web version to GitHub Pages (repository settings → Pages → Source: GitHub Actions).

on:
push:
branches: [master]
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: pages
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: pnpm/action-setup@v6
- uses: actions/setup-node@v7
with:
node-version-file: .node-version
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: pnpm build
- uses: actions/configure-pages@v6
- uses: actions/upload-pages-artifact@v5
with:
path: dist

deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v5
70 changes: 70 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Release

# Builds the desktop apps and attaches them to a *draft* GitHub Release named after the version in package.json.
# Push a tag (`git tag v2.0.0 && git push origin v2.0.0`) or run it by hand, then review and publish the draft.

on:
push:
tags: ["v*"]
workflow_dispatch:

permissions:
contents: write

jobs:
desktop:
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
args: --target universal-apple-darwin
rust-targets: aarch64-apple-darwin,x86_64-apple-darwin
- os: windows-latest
args: ""
rust-targets: ""
# the oldest supported Ubuntu keeps the glibc requirement of the Linux bundles low
- os: ubuntu-22.04
args: ""
rust-targets: ""
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v7
- name: Linux build dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf xdg-utils
- uses: pnpm/action-setup@v6
- uses: actions/setup-node@v7
with:
node-version-file: .node-version
cache: pnpm
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.rust-targets }}
- uses: Swatinem/rust-cache@v2
with:
workspaces: src-tauri -> target
- run: pnpm install --frozen-lockfile
- uses: tauri-apps/tauri-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# macOS apps are ad-hoc signed (`signingIdentity: "-"`). With an Apple Developer account, add these
# secrets to sign and notarize instead: APPLE_CERTIFICATE, APPLE_CERTIFICATE_PASSWORD,
# APPLE_SIGNING_IDENTITY, APPLE_API_ISSUER, APPLE_API_KEY, APPLE_API_KEY_PATH.
with:
tagName: v__VERSION__
releaseName: Autotiler v__VERSION__
releaseBody: |
See [CHANGELOG.md](https://github.com/itsjavi/autotiler/blob/master/CHANGELOG.md) for what's new.

- **macOS** (Apple Silicon and Intel, macOS 13+): `Autotiler_*_universal.dmg`. The app isn't notarized:
the first time, open it, then allow it in *System Settings → Privacy & Security → Open Anyway*.
- **Windows**: `Autotiler_*_x64-setup.exe` (or the `.msi`).
- **Linux**: `.AppImage`, `.deb` or `.rpm`.
- **No install**: the web version at https://itsjavi.github.io/autotiler/
releaseDraft: true
prerelease: false
uploadUpdaterJson: false
args: ${{ matrix.args }}
42 changes: 23 additions & 19 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
node_modules
/.pnp
.pnp.js

# testing
# build output
/dist
/src-tauri/target
/src-tauri/gen

# test output
/coverage
/test-results
/playwright-report
/blob-report
/.vitest
/tests/fixtures/**/*.actual.png
/tests/fixtures/**/*.diff.png

# production
/build
# env
.env*.local

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
# logs
*.log

npm-debug.log*
yarn-debug.log*
yarn-error.log*
/dist
*~
# OS / editors
.DS_Store
Thumbs.db
*:encryptable
*~
*:encryptable

# local research, notes and scratch files (not versioned)
/.local/
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
24
14 changes: 14 additions & 0 deletions .oxfmtrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "./node_modules/oxfmt/configuration_schema.json",
"printWidth": 120,
"sortImports": true,
"sortTailwindcss": { "stylesheet": "./src/app/styles.css", "functions": ["cn"] },
"ignorePatterns": [
"dist/**",
"src-tauri/gen/**",
"src-tauri/target/**",
"tests/fixtures/**",
"public/**",
"**/__snapshots__/**"
]
}
39 changes: 39 additions & 0 deletions .oxlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": ["eslint", "typescript", "unicorn", "oxc", "react", "jsx-a11y", "import", "vitest"],
"categories": { "correctness": "error", "suspicious": "warn", "perf": "warn" },
"env": { "browser": true, "es2024": true },
"options": { "typeAware": true },
"rules": {
"react/rules-of-hooks": "error",
"react/exhaustive-deps": "warn",
"react/react-in-jsx-scope": "off",
"import/no-unassigned-import": ["warn", { "allow": ["**/*.css"] }],
"typescript/no-floating-promises": "error",
"import/no-cycle": "error"
},
"overrides": [
{
"files": ["src/core/**"],
"rules": {
"no-restricted-imports": [
"error",
{
"patterns": [
{
"group": ["react", "react-dom", "react/*", "react-dom/*", "@tauri-apps/*", "node:*", "**/app/**"],
"message": "src/core must stay environment-free (no DOM, Node, React or Tauri)."
}
]
}
]
}
},
{
"files": ["*.config.ts", "scripts/**", "tests/**", "src/**/*.test.ts"],
"env": { "node": true },
"rules": { "no-restricted-imports": "off" }
}
],
"ignorePatterns": ["dist/**", "src-tauri/**", "public/**", "**/__snapshots__/**"]
}
8 changes: 8 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"recommendations": [
"oxc.oxc-vscode",
"TypeScriptTeam.native-preview",
"rust-lang.rust-analyzer",
"tauri-apps.tauri-vscode"
]
}
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"editor.defaultFormatter": "oxc.oxc-vscode",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": { "source.fixAll.oxc": "always" },
"oxc.typeAware": true,
"js/ts.experimental.useTsgo": true,
"[rust]": { "editor.defaultFormatter": "rust-lang.rust-analyzer" }
}
Loading
Loading