diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..c79b67c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,47 @@ +name: CI + +on: + push: + branches: [ "main", "phase-*" ] + pull_request: + branches: [ "main" ] + +jobs: + test: + name: Rust & Workspace Tests (${{ matrix.os }}) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Rust stable + uses: dtolnay/rust-toolchain@stable + + - name: Setup Rust cache + uses: Swatinem/rust-cache@v2 + + - name: Install Linux dependencies + if: runner.os == 'Linux' + run: | + sudo apt-get update + sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf libssl-dev + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Install GUI frontend dependencies + working-directory: gui + run: npm ci + + - name: Build GUI frontend + working-directory: gui + run: npm run build + + - name: Run Workspace Tests + run: cargo test --workspace --verbose diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..56157b1 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,168 @@ +name: Release + +on: + push: + tags: + - 'v*' + workflow_dispatch: + +permissions: + contents: write + +jobs: + build-cli: + name: Build CLI (${{ matrix.target }}) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - os: macos-latest + target: aarch64-apple-darwin + binary_name: nut + artifact_name: nut-aarch64-apple-darwin.tar.gz + - os: macos-latest + target: x86_64-apple-darwin + binary_name: nut + artifact_name: nut-x86_64-apple-darwin.tar.gz + - os: ubuntu-latest + target: x86_64-unknown-linux-musl + binary_name: nut + artifact_name: nut-x86_64-unknown-linux-musl.tar.gz + use_cross: true + - os: ubuntu-latest + target: aarch64-unknown-linux-musl + binary_name: nut + artifact_name: nut-aarch64-unknown-linux-musl.tar.gz + use_cross: true + - os: windows-latest + target: x86_64-pc-windows-msvc + binary_name: nut.exe + artifact_name: nut-x86_64-pc-windows-msvc.zip + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Rust stable + uses: dtolnay/rust-toolchain@stable + with: + targets: ${{ matrix.target }} + + - name: Setup Rust cache + uses: Swatinem/rust-cache@v2 + + - name: Install cross + if: matrix.use_cross + run: cargo install cross --git https://github.com/cross-rs/cross + + - name: Build static CLI binary (with cross) + if: matrix.use_cross + run: cross build --release --target ${{ matrix.target }} -p nut + + - name: Build CLI binary (standard) + if: "!matrix.use_cross" + run: cargo build --release --target ${{ matrix.target }} -p nut + + - name: Package Unix binary + if: runner.os != 'Windows' + run: | + mkdir -p staging + cp target/${{ matrix.target }}/release/${{ matrix.binary_name }} staging/ + cp README.md LICENSE staging/ + tar -czf ${{ matrix.artifact_name }} -C staging . + + - name: Package Windows binary + if: runner.os == 'Windows' + shell: pwsh + run: | + New-Item -ItemType Directory -Force -Path staging + Copy-Item target/${{ matrix.target }}/release/${{ matrix.binary_name }} staging/ + Copy-Item README.md, LICENSE staging/ + Compress-Archive -Path staging/* -DestinationPath ${{ matrix.artifact_name }} + + - name: Upload CLI Artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.artifact_name }} + path: ${{ matrix.artifact_name }} + + build-gui: + name: Build GUI (${{ matrix.platform }}) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - platform: macOS + os: macos-latest + - platform: Linux + os: ubuntu-latest + - platform: Windows + os: windows-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Install Rust stable + uses: dtolnay/rust-toolchain@stable + + - name: Setup Rust cache + uses: Swatinem/rust-cache@v2 + + - name: Install Linux dependencies + if: runner.os == 'Linux' + run: | + sudo apt-get update + sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf libssl-dev rpm + + - name: Install frontend dependencies + working-directory: gui + run: npm ci + + - name: Build Tauri GUI + uses: tauri-apps/tauri-action@v0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + projectPath: "./gui" + tagName: ${{ github.ref_name }} + releaseName: "Nextcloud Upload Tool ${{ github.ref_name }}" + releaseBody: "See release notes for changes." + releaseDraft: true + prerelease: false + + publish-release: + name: Publish Release & Checksums + needs: [build-cli, build-gui] + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Download all CLI artifacts + uses: actions/download-artifact@v4 + with: + path: artifacts + + - name: Generate Checksums + run: | + cd artifacts + find . -type f -name "*.tar.gz" -o -name "*.zip" -exec sha256sum {} + > SHA256SUMS + cat SHA256SUMS + + - name: Upload Checksums to GitHub Release + if: startsWith(github.ref, 'refs/tags/v') + uses: softprops/action-gh-release@v2 + with: + files: | + artifacts/**/* + artifacts/SHA256SUMS + draft: false + prerelease: false diff --git a/.gitignore b/.gitignore index a63b308..8f9f561 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ /target/ **/target/ **/*.rs.bk +dist-packages/ # Cargo local configs .cargo/config.toml.local diff --git a/Tasks.md b/Tasks.md index 9d5134c..f704f12 100644 --- a/Tasks.md +++ b/Tasks.md @@ -70,7 +70,6 @@ This document defines the complete project roadmap and task tracking system for | ID | Title | Status | Type | |---|---|---|---| -| [NUT-018](#nut-018) | Implement Packaging for macOS, Windows, Linux | Triage | Chore | | [NUT-019](#nut-019) | Implement Homebrew/Winget/Chocolatey Manifests | Triage | Chore | | [NUT-020](#nut-020) | Write Documentation + Examples | Triage | Chore | | [NUT-022](#nut-022) | Implement CLI Shell Completions Generation | Triage | Feature | @@ -93,6 +92,7 @@ This document defines the complete project roadmap and task tracking system for | [NUT-015](#nut-015) | Implement GUI Upload Progress Bars | Fixed | Feature | | [NUT-016](#nut-016) | Implement Shared Auth Token Reuse | Fixed | Integration | | [NUT-017](#nut-017) | Implement Multi-Account Switching (GUI + CLI) | Fixed | Integration | +| [NUT-018](#nut-018) | Implement Packaging for macOS, Windows, Linux | Fixed | Chore | | [NUT-021](#nut-021) | Support Headless & SSH Remote Authentication Modes | Fixed | Feature | --- @@ -442,20 +442,20 @@ Add multi-account switching to both CLI and GUI. - NUT-014 - + ### Implement Packaging for macOS, Windows, Linux **ID:** NUT-018 -**Status:** Triage +**Status:** Fixed **Type:** Chore **Description:** -Package the CLI and GUI for distribution. +Package the CLI and GUI for distribution across macOS, Windows, and Linux. **Requirements:** -- [ ] macOS `.app` + `.dmg` -- [ ] Windows `.exe` + installer -- [ ] Linux `.deb` + `.rpm` -- [ ] Static CLI binaries +- [x] macOS `.app` + `.dmg` +- [x] Windows `.exe` + installer +- [x] Linux `.deb` + `.rpm` +- [x] Static CLI binaries **Dependencies:** - NUT-008 diff --git a/gui/src-tauri/tauri.conf.json b/gui/src-tauri/tauri.conf.json index da4fdd7..a51e26f 100644 --- a/gui/src-tauri/tauri.conf.json +++ b/gui/src-tauri/tauri.conf.json @@ -31,6 +31,38 @@ "icons/128x128@2x.png", "icons/icon.icns", "icons/icon.ico" - ] + ], + "category": "Utility", + "shortDescription": "Fast, seamless Nextcloud file uploader and share link generator", + "longDescription": "Upload files to Nextcloud with ease, automatically generate share links, and manage multiple accounts with secure OS keychain storage.", + "linux": { + "deb": { + "depends": [ + "libwebkit2gtk-4.1-0 | libwebkit2gtk-4.0-37", + "libayatana-appindicator3-1 | libappindicator3-1", + "librsvg2-common" + ] + }, + "rpm": { + "depends": [ + "webkit2gtk4.1", + "libappindicator-gtk3" + ] + } + }, + "macOS": { + "minimumSystemVersion": "10.15", + "dmg": { + "windowSize": { + "width": 600, + "height": 400 + } + } + }, + "windows": { + "nsis": { + "installMode": "currentUser" + } + } } } diff --git a/scripts/build-cli.sh b/scripts/build-cli.sh new file mode 100755 index 0000000..b39f14d --- /dev/null +++ b/scripts/build-cli.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Nextcloud Upload Tool — CLI Packaging Helper Script +# Builds release binaries and packages archives for distribution + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +ROOT_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)" +DIST_DIR="${ROOT_DIR}/dist-packages" + +echo "==> Building static/optimized release CLI binary..." +cd "${ROOT_DIR}" +cargo build --release -p nut + +TARGET_BIN="${ROOT_DIR}/target/release/nut" +VERSION=$(cargo pkgid -p nut | cut -d# -f2 | cut -d: -f2 || echo "0.1.0") +ARCH=$(uname -m) +OS=$(uname -s | tr '[:upper:]' '[:lower:]') + +mkdir -p "${DIST_DIR}" +ARCHIVE_NAME="nut-v${VERSION}-${OS}-${ARCH}.tar.gz" + +echo "==> Creating distribution archive: ${ARCHIVE_NAME}" +TMP_STAGE=$(mktemp -d) +cp "${TARGET_BIN}" "${TMP_STAGE}/nut" +cp "${ROOT_DIR}/README.md" "${TMP_STAGE}/" +cp "${ROOT_DIR}/LICENSE" "${TMP_STAGE}/" + +tar -czf "${DIST_DIR}/${ARCHIVE_NAME}" -C "${TMP_STAGE}" . +rm -rf "${TMP_STAGE}" + +echo "✓ CLI package created successfully at: ${DIST_DIR}/${ARCHIVE_NAME}" diff --git a/scripts/build-gui.sh b/scripts/build-gui.sh new file mode 100755 index 0000000..3a4dec6 --- /dev/null +++ b/scripts/build-gui.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +set -euo pipefail + +# Nextcloud Upload Tool — Tauri GUI Packaging Helper Script +# Builds production frontend and packages native desktop installer/bundles + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +ROOT_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)" +GUI_DIR="${ROOT_DIR}/gui" + +echo "==> Building frontend assets..." +cd "${GUI_DIR}" +npm run build + +echo "==> Packaging native desktop bundle with Tauri..." +npm run tauri build + +echo "✓ Native desktop bundle packaged in: ${GUI_DIR}/src-tauri/target/release/bundle/"