From 8ee77f00b7633e67a88baf8cb811b496fd21119d Mon Sep 17 00:00:00 2001 From: Jai A Date: Thu, 30 Mar 2023 15:31:15 -0700 Subject: [PATCH] Add linting --- .github/workflows/cli-build.yml | 13 ++++++++--- .github/workflows/lint.yml | 37 ------------------------------- .github/workflows/tauri-build.yml | 33 +++++++++++++++++++++++---- 3 files changed, 39 insertions(+), 44 deletions(-) delete mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/cli-build.yml b/.github/workflows/cli-build.yml index a5d2a026a..d91089cce 100644 --- a/.github/workflows/cli-build.yml +++ b/.github/workflows/cli-build.yml @@ -1,4 +1,4 @@ -name: CLI Build +name: CLI Build + Lint on: push: @@ -23,13 +23,20 @@ jobs: uses: actions/cache@v2 with: path: ../target/** - key: ${{ runner.os }}-build-cache + key: ${{ runner.os }}-theseus-cli-${{ hashFiles('Cargo.lock') }} - name: Install toolchain uses: actions-rs/toolchain@v1 with: toolchain: stable + override: true + components: rustfmt, clippy - uses: actions-rs/cargo@v1 name: Build program with: command: build - args: --bin theseus_cli \ No newline at end of file + args: --bin theseus_cli + - name: Run Lint + uses: actions-rs/clippy-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + args: --bin theseus_cli diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index 560944124..000000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Clippy - -on: - push: - branches: [ master ] - pull_request: - -env: - CARGO_TERM_COLOR: always - -jobs: - lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Install toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - components: rustfmt, clippy - - name: Cache build artifacts - id: cache-build - uses: actions/cache@v2 - with: - path: target/** - key: ${{ runner.os }}-build-cache - - name: Theseus Clippy - uses: actions-rs/clippy-check@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - args: --bin theseus - - name: Theseus CLI Clippy - uses: actions-rs/clippy-check@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - args: --bin theseus_cli \ No newline at end of file diff --git a/.github/workflows/tauri-build.yml b/.github/workflows/tauri-build.yml index eb97cf361..eb8af96da 100644 --- a/.github/workflows/tauri-build.yml +++ b/.github/workflows/tauri-build.yml @@ -20,15 +20,40 @@ jobs: uses: actions/setup-node@v3 with: node-version: 16 - - name: install Rust stable - uses: dtolnay/rust-toolchain@stable + - name: Install toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + components: rustfmt, clippy - name: install dependencies (ubuntu only) if: matrix.platform == 'ubuntu-20.04' 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-gui-${{ hashFiles('Cargo.lock') }} + - 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 + run: yarn install --immutable --immutable-cache --check-cache - uses: tauri-apps/tauri-action@v0 env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Run Lint + if: matrix.platform == 'ubuntu-20.04' + uses: actions-rs/clippy-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + args: --bin theseus_cli \ No newline at end of file