From 55e52eb2ec1c7bb6165d5e37d3b04ac189d7eed4 Mon Sep 17 00:00:00 2001 From: Oscar Beaumont Date: Mon, 20 Jun 2022 11:27:37 +0800 Subject: [PATCH] fix clippy workflow (hopefully) --- .github/scripts/setup-system.sh | 14 +++++++---- .github/workflows/ci.yml | 2 +- .github/workflows/clippy.yml | 41 ++++++++++++++++++++++++++++++--- 3 files changed, 48 insertions(+), 9 deletions(-) diff --git a/.github/scripts/setup-system.sh b/.github/scripts/setup-system.sh index 2c9bcc999..68d0df0ab 100755 --- a/.github/scripts/setup-system.sh +++ b/.github/scripts/setup-system.sh @@ -10,10 +10,14 @@ if [ $? -eq 1 ]; then exit 1 fi -which pnpm &> /dev/null -if [ $? -eq 1 ]; then - echo "PNPM was not detected on your system. Ensure the 'pnpm' command is in your \$PATH. You are **not** able to use Yarn or NPM." - exit 1 +if [ "${SPACEDRIVE_SKIP_PNPM_CHECK:-}" != "true" ]; then + which pnpm &> /dev/null + if [ $? -eq 1 ]; then + echo "PNPM was not detected on your system. Ensure the 'pnpm' command is in your \$PATH. You are not able to use Yarn or NPM." + exit 1 + fi +else + echo "Skipped PNPM check!" fi if [[ "$OSTYPE" == "linux-gnu"* ]]; then @@ -24,7 +28,7 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then DEBIAN_BINDGEN_DEPS="pkg-config clang" # Bindgen dependencies - it's used by a dependency of Spacedrive sudo apt-get -y update - sudo apt-get -y install ${CUSTOM_APT_FLAGS:-} $DEBIAN_TAURI_DEPS $DEBIAN_FFMPEG_DEPS $DEBIAN_BINDGEN_DEPS + sudo apt-get -y install ${SPACEDRIVE_CUSTOM_APT_FLAGS:-} $DEBIAN_TAURI_DEPS $DEBIAN_FFMPEG_DEPS $DEBIAN_BINDGEN_DEPS elif which pacman &> /dev/null; then echo "Detected 'pacman' based distro!" ARCH_TAURI_DEPS="webkit2gtk base-devel curl wget openssl appmenu-gtk-module gtk3 libappindicator-gtk3 librsvg libvips" # Tauri deps https://tauri.studio/guides/getting-started/setup/linux#1-system-dependencies diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d20520496..013354f45 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ on: env: CARGO_INCREMENTAL: 1 - CUSTOM_APT_FLAGS: --no-install-recommends + SPACEDRIVE_CUSTOM_APT_FLAGS: --no-install-recommends jobs: typescript: diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml index a1d220690..1a11968c4 100644 --- a/.github/workflows/clippy.yml +++ b/.github/workflows/clippy.yml @@ -5,17 +5,52 @@ on: push: paths: - '**.rs' + - '**.toml' + - ./.github/workflows workflow_dispatch: +env: + CARGO_INCREMENTAL: 1 + SPACEDRIVE_CUSTOM_APT_FLAGS: --no-install-recommends + SPACEDRIVE_SKIP_PNPM_CHECK: true + jobs: clippy_check: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - name: Checkout repository + uses: actions/checkout@v3 - - run: rustup component add clippy + - name: Install Rust stable + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + override: true + components: clippy - - uses: actions-rs/clippy-check@v1 + - name: Cache Rust Dependencies + uses: Swatinem/rust-cache@v1 + with: + sharedKey: core-v1-${{ hashFiles('**/Cargo.lock') }} + + - name: Run 'setup-system.sh' script + run: ./.github/scripts/setup-system.sh + + - name: Cache Prisma codegen + id: cache-prisma + uses: actions/cache@v3 + with: + path: ./core/src/prisma.rs + key: prisma-${{ hashFiles('./core/prisma/Cargo.toml', './core/prisma/schema.prisma', './core/prisma/src/main.rs') }} + + - name: Generate Prisma client + working-directory: core + if: steps.cache-prisma.outputs.cache-hit != 'true' + run: cargo run --frozen -p prisma-cli --release -- generate + + - name: Run Clippy + uses: actions-rs/clippy-check@v1 with: token: ${{ secrets.GITHUB_TOKEN }} args: --all-features \ No newline at end of file