diff --git a/.github/workflows/cli-build.yml b/.github/workflows/cli-build.yml index b20e0c436..49367bd7f 100644 --- a/.github/workflows/cli-build.yml +++ b/.github/workflows/cli-build.yml @@ -13,28 +13,30 @@ jobs: run: working-directory: ./theseus_cli steps: - - uses: actions/checkout@v2 - - name: install dependencies (ubuntu only) + - name: Checkout + uses: actions/checkout@v3 + + - name: install dependencies run: | sudo apt-get update sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf - - name: Get build cache - id: cache-build - uses: actions/cache@v2 + + - name: Rust setup + uses: dtolnay/rust-toolchain@stable with: - path: ../target/** - key: ${{ runner.os }}-theseus - - name: Install toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true components: rustfmt, clippy + + - name: Rust cache + uses: swatinem/rust-cache@v2 + with: + workspaces: './src-tauri -> target' + - uses: actions-rs/cargo@v1 name: Build program with: command: build args: --bin theseus_cli + - name: Run Lint uses: actions-rs/clippy-check@v1 with: diff --git a/.github/workflows/gui-build.yml b/.github/workflows/gui-build.yml index 54cd43258..7efe5719c 100644 --- a/.github/workflows/gui-build.yml +++ b/.github/workflows/gui-build.yml @@ -13,22 +13,19 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 - - name: Use Node.js + + - name: Sync node version and setup cache uses: actions/setup-node@v3 with: - node-version: 18.x - - name: Get yarn cache - id: yarn-cache - run: echo "::set-output name=dir::$(yarn cache dir)" - - uses: actions/cache@v3 - with: - path: ${{ steps.yarn-cache.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- + node-version: 16 + cache: 'yarn' + cache-dependency-path: "theseus_gui" + - name: Install dependencies run: yarn install --immutable --immutable-cache --check-cache + - name: Run Lint run: yarn run lint + - name: Build - run: yarn run build + run: yarn run build \ No newline at end of file diff --git a/.github/workflows/tauri-build.yml b/.github/workflows/tauri-build.yml index 161c01d1a..f0ca47f61 100644 --- a/.github/workflows/tauri-build.yml +++ b/.github/workflows/tauri-build.yml @@ -14,46 +14,80 @@ jobs: defaults: run: working-directory: ./theseus_gui + steps: - uses: actions/checkout@v3 - - name: setup node + + - name: Rust setup (mac) + if: startsWith(matrix.platform, 'macos') + uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt, clippy + targets: aarch64-apple-darwin + + - name: Rust setup + if: "!startsWith(matrix.platform, 'macos')" + uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt, clippy + + - name: Rust cache + uses: swatinem/rust-cache@v2 + with: + workspaces: './src-tauri -> target' + + - name: Sync node version and setup cache uses: actions/setup-node@v3 with: node-version: 16 - - name: Install toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - components: rustfmt, clippy + cache: 'yarn' + cache-dependency-path: "theseus_gui" + - name: install dependencies (ubuntu only) - if: matrix.platform == 'ubuntu-20.04' + if: startsWith(matrix.platform, 'ubuntu') run: | sudo apt-get update sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf - - name: Get build cache - id: cache-build - uses: actions/cache@v2 - with: - path: ../target/** - key: ${{ runner.os }}-theseus - - name: Get yarn cache - id: yarn-cache - run: echo "::set-output name=dir::$(yarn cache dir)" - - uses: actions/cache@v3 - with: - path: ${{ steps.yarn-cache.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- + - name: install frontend dependencies run: yarn install --immutable --immutable-cache --check-cache - - uses: tauri-apps/tauri-action@v0 + + - name: build app (macos) + uses: tauri-apps/tauri-action@v0 + id: build_os_mac + if: startsWith(matrix.platform, 'macos') env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Run Lint - if: matrix.platform == 'ubuntu-20.04' - uses: actions-rs/clippy-check@v1 + ENABLE_CODE_SIGNING: ${{ secrets.APPLE_CERTIFICATE }} + APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }} + APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} + APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }} + APPLE_ID: ${{ secrets.APPLE_ID }} + APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }} + TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} + TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} with: - token: ${{ secrets.GITHUB_TOKEN }} - args: --bin theseus_cli \ No newline at end of file + args: --target universal-apple-darwin + + - name: build app + uses: tauri-apps/tauri-action@v0 + id: build_os + if: "!startsWith(matrix.platform, 'macos')" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} + TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} + + - name: upload ${{ matrix.platform }} + uses: actions/upload-artifact@v3 + if: startsWith(matrix.platform, 'macos') + with: + name: ${{ matrix.platform }} + path: "${{ join(fromJSON(steps.build_os_mac.outputs.artifactPaths), '\n') }}" + + - name: upload ${{ matrix.platform }} + uses: actions/upload-artifact@v3 + if: "!startsWith(matrix.platform, 'macos')" + with: + name: ${{ matrix.platform }} + path: "${{ join(fromJSON(steps.build_os.outputs.artifactPaths), '\n') }}" diff --git a/Cargo.lock b/Cargo.lock index 1bd9f004a..d7f8bec82 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -179,6 +179,22 @@ dependencies = [ "system-deps 6.0.4", ] +[[package]] +name = "attohttpc" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fcf00bc6d5abb29b5f97e3c61a90b6d3caa12f3faf897d4a3e3607c050a35a7" +dependencies = [ + "flate2", + "http", + "log", + "native-tls", + "serde", + "serde_json", + "serde_urlencoded", + "url", +] + [[package]] name = "autocfg" version = "1.1.0" @@ -2048,6 +2064,12 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" +[[package]] +name = "minisign-verify" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "933dca44d65cdd53b355d0b73d380a2ff5da71f87f036053188bf1eab6a19881" + [[package]] name = "miniz_oxide" version = "0.6.2" @@ -3540,6 +3562,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe7e0f1d535e7cbbbab43c82be4fc992b84f9156c16c160955617e0260ebc449" dependencies = [ "anyhow", + "attohttpc", + "base64 0.13.1", "cocoa", "dirs-next", "embed_plist", @@ -3552,6 +3576,7 @@ dependencies = [ "heck 0.4.1", "http", "ignore", + "minisign-verify", "objc", "once_cell", "open", @@ -3573,12 +3598,14 @@ dependencies = [ "tauri-utils", "tempfile", "thiserror", + "time 0.3.20", "tokio", "url", "uuid 1.3.0", "webkit2gtk", "webview2-com", "windows 0.39.0", + "zip", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 3d0c76f31..7fea9d1ad 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,8 +8,21 @@ members = [ "theseus_macros" ] +[profile.dev] +opt-level = 0 +debug = true +debug-assertions = true +overflow-checks = true +lto = false +panic = 'unwind' +incremental = true +codegen-units = 256 +rpath = false + # Optimize for speed and reduce size on release builds [profile.release] -codegen-units = 1 -lto = true -strip = true \ No newline at end of file +panic = "abort" # Strip expensive panic clean-up logic +codegen-units = 1 # Compile crates one after another so the compiler can optimize better +lto = true # Enables link to optimizations +opt-level = "s" # Optimize for binary size +strip = true # Remove debug symbols diff --git a/theseus/src/api/profile.rs b/theseus/src/api/profile.rs index 28b6da903..b9c394336 100644 --- a/theseus/src/api/profile.rs +++ b/theseus/src/api/profile.rs @@ -6,7 +6,6 @@ use crate::state::ProjectMetadata; use crate::{ auth::{self, refresh}, event::{emit::emit_profile, ProfilePayloadType}, - profile, state::MinecraftChild, }; pub use crate::{ diff --git a/theseus_gui/.gitignore b/theseus_gui/.gitignore index bedd035f5..a343f1d61 100644 --- a/theseus_gui/.gitignore +++ b/theseus_gui/.gitignore @@ -22,3 +22,4 @@ node_modules *.njsproj *.sln *.sw? +dist diff --git a/theseus_gui/index.html b/theseus_gui/index.html index 1e1698142..c27c868e5 100644 --- a/theseus_gui/index.html +++ b/theseus_gui/index.html @@ -4,7 +4,7 @@ -