diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml new file mode 100644 index 0000000..cc8dfbc --- /dev/null +++ b/.github/dependabot.yaml @@ -0,0 +1,31 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "./.github/workflows" + schedule: + interval: "monthly" + day: "sunday" + groups: + gh-dependency: + patterns: + - "*" + + - package-ecosystem: "bun" + directory: "/" + schedule: + interval: "monthly" + day: "sunday" + groups: + bun-dependency: + patterns: + - "*" + + - package-ecosystem: "cargo" + directory: "./src-tauri" + schedule: + interval: "monthly" + day: "sunday" + groups: + cargo-dependency: + patterns: + - "*" diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..6c775f0 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,65 @@ +name: "Release" + +on: + workflow_dispatch: + push: + tags: + - "*" + +jobs: + publish: + permissions: + contents: write + strategy: + fail-fast: false + matrix: + include: + - platform: "macos-latest" # for Arm based macs (M1 and above). + args: "--target aarch64-apple-darwin" + - platform: "macos-latest" # for Intel based macs. + args: "--target x86_64-apple-darwin" + - platform: "ubuntu-22.04" # for Tauri v1 you could replace this with ubuntu-20.04. + args: "" + - platform: "windows-latest" + args: "" + + runs-on: ${{ matrix.platform }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: setup node + uses: actions/setup-node@v4 + with: + node-version: lts/* + + - name: Setup Bun + uses: oven-sh/setup-bun@v2 + with: + bun-version: latest + + - name: install Rust stable + uses: dtolnay/rust-toolchain@stable + with: + # Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds. + targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }} + + - name: install dependencies (ubuntu only) + if: matrix.platform == 'ubuntu-22.04' + run: | + sudo apt-get update + sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf + + - name: install frontend dependencies + run: bun install + + - uses: tauri-apps/tauri-action@v0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tagName: v__VERSION__ + releaseName: "sqwerk v__VERSION__" + releaseBody: "See the assets to download this version and install." + releaseDraft: true + prerelease: false + args: ${{ matrix.args }} diff --git a/.github/workflows/rs-ci.yaml b/.github/workflows/rs-ci.yaml new file mode 100644 index 0000000..6abf3f9 --- /dev/null +++ b/.github/workflows/rs-ci.yaml @@ -0,0 +1,59 @@ +name: Rust CI + +on: + workflow_dispatch: + push: + branches: + - main + paths: + - "src-tauri/**" + - ".github/**" + pull_request: + branches: + - main + paths: + - "src-tauri/**" + - ".github/**" +env: + CARGO_TERM_COLOR: always + +jobs: + rust-ci: + runs-on: ubuntu-latest + + defaults: + run: + working-directory: ./src-tauri + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Prerequisites + run: | + sudo apt update + sudo apt install libwebkit2gtk-4.1-dev \ + build-essential \ + curl \ + wget \ + file \ + libxdo-dev \ + libssl-dev \ + librsvg2-dev \ + libappindicator3-dev \ + patchelf + + - name: Check formatting + run: cargo fmt --all -- --check + + - name: Run linter + run: cargo clippy -- -D warnings + + - name: Check cargo + run: cargo check --release --all-targets --all-features + + - name: Run tests + run: cargo test --verbose + + - name: Build for all features + run: cargo build --release --all-features diff --git a/.github/workflows/ts-ci.yaml b/.github/workflows/ts-ci.yaml new file mode 100644 index 0000000..bae3e45 --- /dev/null +++ b/.github/workflows/ts-ci.yaml @@ -0,0 +1,33 @@ +name: TS CI + +on: + workflow_dispatch: + push: + branches: + - main + paths-ignore: + - "src-tauri/**" + pull_request: + branches: + - main + paths-ignore: + - "src-tauri/**" + +jobs: + ts-ci: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Bun + uses: oven-sh/setup-bun@v2 + with: + bun-version: latest + + - name: Install Dependencies + run: bun install + + - name: Run Lint + run: bun run lint diff --git a/biome.json b/biome.json new file mode 100644 index 0000000..de7014e --- /dev/null +++ b/biome.json @@ -0,0 +1,48 @@ +{ + "$schema": "https://biomejs.dev/schemas/1.9.4/schema.json", + "vcs": { + "enabled": false, + "clientKind": "git", + "useIgnoreFile": false + }, + "files": { + "ignoreUnknown": false, + "ignore": [] + }, + "formatter": { + "enabled": true, + "indentStyle": "space", + "lineWidth": 80, + "indentWidth": 2 + }, + "organizeImports": { + "enabled": true + }, + "linter": { + "enabled": true, + "rules": { + "recommended": true, + "performance": { + "all": true + }, + "security": { + "all": true + }, + "style": { + "all": true, + "noDefaultExport": "off", + "useFilenamingConvention": { + "level": "error", + "options": { + "filenameCases": ["kebab-case"] + } + } + } + } + }, + "javascript": { + "formatter": { + "quoteStyle": "double" + } + } +} diff --git a/bun.lock b/bun.lock index 609a18d..96a0224 100644 --- a/bun.lock +++ b/bun.lock @@ -10,6 +10,7 @@ "react-dom": "^18.3.1", }, "devDependencies": { + "@biomejs/biome": "1.9.4", "@tauri-apps/cli": "^2", "@types/react": "^18.3.1", "@types/react-dom": "^18.3.1", @@ -58,6 +59,24 @@ "@babel/types": ["@babel/types@7.27.6", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.27.1" } }, "sha512-ETyHEk2VHHvl9b9jZP5IHPavHYk57EhanlRRuae9XCpb/j5bDCbPPMOBfCWhnl/7EDJz0jEMCi/RhccCE8r1+Q=="], + "@biomejs/biome": ["@biomejs/biome@1.9.4", "", { "optionalDependencies": { "@biomejs/cli-darwin-arm64": "1.9.4", "@biomejs/cli-darwin-x64": "1.9.4", "@biomejs/cli-linux-arm64": "1.9.4", "@biomejs/cli-linux-arm64-musl": "1.9.4", "@biomejs/cli-linux-x64": "1.9.4", "@biomejs/cli-linux-x64-musl": "1.9.4", "@biomejs/cli-win32-arm64": "1.9.4", "@biomejs/cli-win32-x64": "1.9.4" }, "bin": { "biome": "bin/biome" } }, "sha512-1rkd7G70+o9KkTn5KLmDYXihGoTaIGO9PIIN2ZB7UJxFrWw04CZHPYiMRjYsaDvVV7hP1dYNRLxSANLaBFGpog=="], + + "@biomejs/cli-darwin-arm64": ["@biomejs/cli-darwin-arm64@1.9.4", "", { "os": "darwin", "cpu": "arm64" }, "sha512-bFBsPWrNvkdKrNCYeAp+xo2HecOGPAy9WyNyB/jKnnedgzl4W4Hb9ZMzYNbf8dMCGmUdSavlYHiR01QaYR58cw=="], + + "@biomejs/cli-darwin-x64": ["@biomejs/cli-darwin-x64@1.9.4", "", { "os": "darwin", "cpu": "x64" }, "sha512-ngYBh/+bEedqkSevPVhLP4QfVPCpb+4BBe2p7Xs32dBgs7rh9nY2AIYUL6BgLw1JVXV8GlpKmb/hNiuIxfPfZg=="], + + "@biomejs/cli-linux-arm64": ["@biomejs/cli-linux-arm64@1.9.4", "", { "os": "linux", "cpu": "arm64" }, "sha512-fJIW0+LYujdjUgJJuwesP4EjIBl/N/TcOX3IvIHJQNsAqvV2CHIogsmA94BPG6jZATS4Hi+xv4SkBBQSt1N4/g=="], + + "@biomejs/cli-linux-arm64-musl": ["@biomejs/cli-linux-arm64-musl@1.9.4", "", { "os": "linux", "cpu": "arm64" }, "sha512-v665Ct9WCRjGa8+kTr0CzApU0+XXtRgwmzIf1SeKSGAv+2scAlW6JR5PMFo6FzqqZ64Po79cKODKf3/AAmECqA=="], + + "@biomejs/cli-linux-x64": ["@biomejs/cli-linux-x64@1.9.4", "", { "os": "linux", "cpu": "x64" }, "sha512-lRCJv/Vi3Vlwmbd6K+oQ0KhLHMAysN8lXoCI7XeHlxaajk06u7G+UsFSO01NAs5iYuWKmVZjmiOzJ0OJmGsMwg=="], + + "@biomejs/cli-linux-x64-musl": ["@biomejs/cli-linux-x64-musl@1.9.4", "", { "os": "linux", "cpu": "x64" }, "sha512-gEhi/jSBhZ2m6wjV530Yy8+fNqG8PAinM3oV7CyO+6c3CEh16Eizm21uHVsyVBEB6RIM8JHIl6AGYCv6Q6Q9Tg=="], + + "@biomejs/cli-win32-arm64": ["@biomejs/cli-win32-arm64@1.9.4", "", { "os": "win32", "cpu": "arm64" }, "sha512-tlbhLk+WXZmgwoIKwHIHEBZUwxml7bRJgk0X2sPyNR3S93cdRq6XulAZRQJ17FYGGzWne0fgrXBKpl7l4M87Hg=="], + + "@biomejs/cli-win32-x64": ["@biomejs/cli-win32-x64@1.9.4", "", { "os": "win32", "cpu": "x64" }, "sha512-8Y5wMhVIPaWe6jw2H+KlEm4wP/f7EW3810ZLmDlrEEy5KvBsb9ECEfu/kMWD484ijfQ8+nIi0giMgu9g1UAuuA=="], + "@esbuild/aix-ppc64": ["@esbuild/aix-ppc64@0.25.5", "", { "os": "aix", "cpu": "ppc64" }, "sha512-9o3TMmpmftaCMepOdA5k/yDw8SfInyzWWTjYTFCX3kPSDJMROQTb8jg+h9Cnwnmm1vOzvxN7gIfB5V2ewpjtGA=="], "@esbuild/android-arm": ["@esbuild/android-arm@0.25.5", "", { "os": "android", "cpu": "arm" }, "sha512-AdJKSPeEHgi7/ZhuIPtcQKr5RQdo6OO2IL87JkianiMYMPbCtot9fxPbrMiBADOWWm3T2si9stAiVsGbTQFkbA=="], diff --git a/package.json b/package.json index 4239db5..f365695 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,9 @@ "dev": "vite", "build": "tsc && vite build", "preview": "vite preview", - "tauri": "NO_STRIP=true tauri" + "tauri": "NO_STRIP=true tauri", + "format": "biome format src --write", + "lint": "biome lint src" }, "dependencies": { "react": "^18.3.1", @@ -16,11 +18,12 @@ "@tauri-apps/plugin-opener": "^2" }, "devDependencies": { + "@biomejs/biome": "1.9.4", + "@tauri-apps/cli": "^2", "@types/react": "^18.3.1", "@types/react-dom": "^18.3.1", "@vitejs/plugin-react": "^4.3.4", "typescript": "~5.6.2", - "vite": "^6.0.3", - "@tauri-apps/cli": "^2" + "vite": "^6.0.3" } } diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index d3f0d17..78fb67b 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -22,4 +22,3 @@ tauri = { version = "2", features = [] } tauri-plugin-opener = "2" serde = { version = "1", features = ["derive"] } serde_json = "1" - diff --git a/src/App.tsx b/src/app.tsx similarity index 85% rename from src/App.tsx rename to src/app.tsx index 9855368..3b252a9 100644 --- a/src/App.tsx +++ b/src/app.tsx @@ -17,13 +17,13 @@ function App() {