Skip to content

Commit

Permalink
chore: [DNM] tauri v2 upgrade (tari-project#1100)
Browse files Browse the repository at this point in the history
Description
---

- upgrade `tauri` to V2 see their [migration guide for more
info](https://tauri.app/start/migrate/from-tauri-1/):
  * moved auto update and systray logic to FE using tauri v2 plugins
  * updated imports and uses where needed
- updated gh workflows:
  * separate workflow for beta builds
  * adjusted CI runs to suit V2
- split out our tauri_commands to their own file (`commands.rs`) to
declutter `main.rs`


Motivation and Context
---
- we want notifications and cool V2 things!

How Has This Been Tested?
---
- locally 

What process can a PR reviewer use to test or verify this change?
---

- run app
- check it works the same as before (if not better 🤞🏼)


Breaking Changes
---

- yet to be seen

---------

Co-authored-by: Misieq01 <[email protected]>
Co-authored-by: Brian Pearce <[email protected]>
  • Loading branch information
3 people authored Dec 5, 2024
1 parent 030d70e commit 19e0622
Show file tree
Hide file tree
Showing 113 changed files with 3,921 additions and 3,361 deletions.
195 changes: 47 additions & 148 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: CI
workflow_dispatch:
push:
branches:
- "ci-*"
- 'ci-*'
pull_request:
types:
- opened
Expand All @@ -21,37 +21,35 @@ concurrency:
permissions: {}

jobs:
clippy:
name: clippy
runs-on: [ ubuntu-latest ]
cargo-checks:
name: cargo checks (fmt, clippy, check)
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4

- name: created empty dist dir
- uses: actions/checkout@v4
- name: create empty dist dir
run: |
mkdir dist
- name: install dependencies (linux)
if: startsWith(runner.os,'Linux')
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends --assume-yes \
libwebkit2gtk-4.0-dev \
libwebkit2gtk-4.1-dev \
libappindicator3-dev \
librsvg2-dev \
patchelf \
libprotobuf-dev \
protobuf-compiler
- name: toolchain
uses: dtolnay/rust-toolchain@stable
- name: install dependencies (linux/OpenCL)
run: |
sudo apt-get install --no-install-recommends --assume-yes \
opencl-headers \
ocl-icd-opencl-dev
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt

- name: cache cargo files and outputs
if: ${{ ( startsWith(runner.environment,'github-hosted') ) && ( ! startsWith(github.ref, 'refs/tags/v') ) }}
uses: swatinem/rust-cache@v2
- uses: swatinem/[email protected]
with:
workspaces: './src-tauri -> target'

Expand All @@ -60,7 +58,7 @@ jobs:
run: |
cargo fmt --all -- --check
- name: clippy check (with lints)
- name: clippy lint
working-directory: ./src-tauri
env:
AIRDROP_BASE_URL: http://localhost:4000
Expand All @@ -69,22 +67,18 @@ jobs:
run: |
cargo install cargo-lints
cargo lints clippy --all-targets --all-features
- name: cargo check
working-directory: ./src-tauri
run: |
cargo check --release --all-targets --workspace
machete:
name: machete
runs-on: [ ubuntu-latest ]
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4

- name: toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt

- name: cache cargo files and outputs
if: ${{ ( startsWith(runner.environment,'github-hosted') ) && ( ! startsWith(github.ref, 'refs/tags/v') ) }}
uses: swatinem/rust-cache@v2
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: swatinem/[email protected]
with:
workspaces: './src-tauri -> target'

Expand All @@ -94,46 +88,50 @@ jobs:
cargo install cargo-machete
cargo machete
cargo-check:
name: cargo-check
runs-on: [ ubuntu-latest ]
tauri-test-build:
name: tauri-build
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4

- uses: actions/checkout@v4
- name: install dependencies (linux)
if: startsWith(runner.os,'Linux')
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends --assume-yes \
libwebkit2gtk-4.0-dev \
libwebkit2gtk-4.1-dev \
libappindicator3-dev \
librsvg2-dev \
patchelf \
libprotobuf-dev \
protobuf-compiler
- name: toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: install dependencies (linux/OpenCL)
run: |
sudo apt-get install --no-install-recommends --assume-yes \
opencl-headers \
ocl-icd-opencl-dev
- name: cache cargo files and outputs
if: ${{ ( startsWith(runner.environment,'github-hosted') ) && ( ! startsWith(github.ref, 'refs/tags/v') ) }}
uses: swatinem/rust-cache@v2
- uses: actions/setup-node@v4
with:
node-version: lts/*
cache: 'npm'
- name: Install dependencies (node)
run: npm ci
- uses: dtolnay/rust-toolchain@stable
- uses: swatinem/[email protected]
with:
workspaces: './src-tauri -> target'

- name: cargo check
- name: cargo tauri build
working-directory: ./src-tauri
run: |
cargo check --release --all-targets --workspace --locked
cargo install tauri-cli --version "^2" --locked
cargo tauri --version
cargo tauri build --ci --bundles deb
file-licenses:
# disable for now
if: ${{ false }}
name: file-licenses
runs-on: [ ubuntu-latest ]
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4
Expand All @@ -145,102 +143,3 @@ jobs:
rg --version || exit 1
- name: run the license check
run: ./scripts/file_license_check.sh

i18n-checks:
name: i18n-checks
runs-on: [ ubuntu-latest ]
steps:
- name: checkout
uses: actions/checkout@v4

- name: install jsonlint
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends --assume-yes \
python3-demjson
- name: basic jsonlint
run: |
find public -iname '*.json' -print0 | \
xargs -0 -n1 jsonlint -v
- name: setup folder for logs
run: |
mkdir -p ${{ runner.temp }}/i18n_logs
- name: i18n compare
continue-on-error: true
working-directory: ./public/locales
run: |
python3 ../../scripts/i18n_checker.py \
compare --en-locale-path en \
--base-path . \
--search-path .. \
--output-dir ${{ runner.temp }}/i18n_logs
- name: i18n unused
continue-on-error: true
working-directory: ./public/locales
run: |
python3 ../../scripts/i18n_checker.py \
unused --en-locale-path en \
--base-path . \
--search-path .. \
--output-dir ${{ runner.temp }}/i18n_logs
- name: Artifact upload for i18n checks
uses: actions/upload-artifact@v4
with:
name: i18n-logs
path: ${{ runner.temp }}/i18n_logs

tauri-build:
name: tauri-build
runs-on: [ ubuntu-latest ]
steps:
- name: checkout
uses: actions/checkout@v4

- name: install dependencies (linux)
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends --assume-yes \
libwebkit2gtk-4.0-dev \
libappindicator3-dev \
librsvg2-dev \
patchelf \
libprotobuf-dev \
protobuf-compiler
- name: install dependencies (linux/OpenCL)
run: |
sudo apt-get install --no-install-recommends --assume-yes \
opencl-headers \
ocl-icd-opencl-dev
- name: Node.js setup
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: 'npm'

- name: Install dependencies (node)
run: |
npm --version
npm install
- name: toolchain
uses: dtolnay/rust-toolchain@stable

- name: cache cargo files and outputs
if: ${{ ( startsWith(runner.environment,'github-hosted') ) && ( ! startsWith(github.ref, 'refs/tags/v') ) }}
uses: swatinem/rust-cache@v2
with:
workspaces: './src-tauri -> target'

- name: cargo tauri build
working-directory: ./src-tauri
run: |
cargo install tauri-cli --version "1.6.4"
cargo tauri --version
cargo tauri build --ci --bundles deb
32 changes: 15 additions & 17 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,18 @@ name: Lint
on: pull_request

jobs:
run-linters:
name: Run linters
runs-on: ubuntu-latest

steps:
- name: Check out Git repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install Node.js dependencies
run: npm ci
- name: check lint/prettier errors
run: npm run lint
- name: check taplo
run: npm run lint:taplo
run-linters:
name: Run linters
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: 'npm'
node-version: lts/*
- name: Install Node.js dependencies
run: npm ci
- name: check lint/prettier errors
run: npm run lint
- name: check taplo
run: npm run lint:taplo
83 changes: 83 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
---
name: PR
on:
pull_request:
types:
- opened
- reopened
- edited
- synchronize

concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: ${{ !startsWith(github.ref, 'refs/tags/v') || github.ref != 'refs/heads/development' || github.ref != 'refs/heads/nextnet' || github.ref != 'refs/heads/stagenet' }}

permissions: {}

jobs:
check-signed-commits:
name: Check signed commits
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: 1Password/check-signed-commits-action@v1
check-title:
name: Check title
runs-on: ubuntu-latest
steps:
- name: Install Dependencies
run: |
npm install -g @commitlint/cli @commitlint/config-conventional
echo "module.exports = {extends: ['@commitlint/config-conventional']}" > commitlint.config.js
- name: Lint Title
env:
PR_TITLE: ${{github.event.pull_request.title}}
run: |
echo "$PR_TITLE" | commitlint
check-i18n:
name: Check i18n
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install jsonlint
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends --assume-yes \
python3-demjson
- name: Basic jsonlint
run: |
find public -iname '*.json' -print0 | \
xargs -0 -n1 jsonlint -v
- name: setup folder for logs
run: |
mkdir -p ${{ runner.temp }}/i18n_logs
- name: i18n compare
continue-on-error: true
working-directory: ./public/locales
run: |
python3 ../../scripts/i18n_checker.py \
compare --en-locale-path en \
--base-path . \
--search-path .. \
--output-dir ${{ runner.temp }}/i18n_logs
- name: i18n unused
continue-on-error: true
working-directory: ./public/locales
run: |
python3 ../../scripts/i18n_checker.py \
unused --en-locale-path en \
--base-path . \
--search-path .. \
--output-dir ${{ runner.temp }}/i18n_logs
- name: Artifact upload for i18n checks
uses: actions/upload-artifact@v4
with:
name: i18n-logs
path: ${{ runner.temp }}/i18n_logs
Loading

0 comments on commit 19e0622

Please sign in to comment.