From accd0a26c3d1a7696ed14298f3f8afc3ca234078 Mon Sep 17 00:00:00 2001 From: NDoolan360 Date: Thu, 26 Oct 2023 16:05:28 +1100 Subject: [PATCH 1/3] Change to actions/cache --- .github/workflows/ci.yml | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bea38f9..6cdfd9f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,8 +12,14 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Rust cache - uses: Swatinem/rust-cache@v2 + - name: Cache Crates + uses: actions/cache@v3 + with: + path: | + ~/.cargo + ./src-tauri/target + key: rust-dev-${{ hashFiles('./src-tauri/Cargo.lock') }} + restore-keys: rust-dev- - name: Prepare env and install Tauri dependencies run: | @@ -50,7 +56,6 @@ jobs: node-version: 21 - name: Check node_modules cache - id: node_module_cache uses: actions/cache@v3 with: path: node_modules @@ -58,7 +63,6 @@ jobs: restore-keys: node_modules - name: Install frontend dependencies - if: steps.node_module_cache.outputs.cache-hit != 'true' run: npm install - name: Run ESLint @@ -76,8 +80,21 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Rust cache - uses: Swatinem/rust-cache@v2 + - name: Cache Crates + uses: actions/cache@v3 + with: + path: | + ~/.cargo + ./src-tauri/target + key: rust-dev-${{ hashFiles('./src-tauri/Cargo.lock') }} + restore-keys: rust-dev- + + - name: Cache node_modules + uses: actions/cache@v3 + with: + path: node_modules + key: node_modules-${{hashFiles('package-lock.json')}} + restore-keys: node_modules - name: Prepare env and install Tauri dependencies run: | @@ -103,16 +120,7 @@ jobs: with: node-version: 21 - - name: Check node_modules cache - id: node_module_cache - uses: actions/cache@v3 - with: - path: node_modules - key: node_modules-${{hashFiles('package-lock.json')}} - restore-keys: node_modules - - name: Npm install - if: steps.node_module_cache.outputs.cache-hit != 'true' run: npm install - name: Run Vitest From 31b68ee7411ab9ce0794c2b0393fcad63997806f Mon Sep 17 00:00:00 2001 From: NDoolan360 Date: Thu, 26 Oct 2023 23:11:46 +1100 Subject: [PATCH 2/3] split into npm and cargo --- .github/workflows/ci.yml | 140 ++++++++++++--------------------------- 1 file changed, 41 insertions(+), 99 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6cdfd9f..e7c439c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,127 +1,69 @@ +name: Continuous Integration + on: - pull_request: push: - branches: master - -name: Continuous Integration + branches: + - main + pull_request: + branches: + - main + - dev jobs: - clippy_fmt: - name: Cargo Format and Clippy + npm: runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Cache Crates - uses: actions/cache@v3 - with: - path: | - ~/.cargo - ./src-tauri/target - key: rust-dev-${{ hashFiles('./src-tauri/Cargo.lock') }} - restore-keys: rust-dev- - - - name: Prepare env and install Tauri dependencies - run: | - mkdir build - echo "${{ secrets.ENV_FILE }}" > .env - sudo apt-get update - sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf - - - name: Install minimal Rust stable - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - components: clippy,rustfmt - - name: Cargo fmt - working-directory: ./src-tauri - run: cargo fmt --all -- --check - - - name: Cargo clippy - working-directory: ./src-tauri - run: cargo clippy --all-targets --all-features - - eslint_prettier_stylelint: - name: ESLint, Prettier and Stylelint - runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - name: Checkout code + uses: actions/checkout@v2 - - name: Setup node - uses: actions/setup-node@v3 + - name: Setup Node.js + uses: actions/setup-node@v2 with: - node-version: 21 + node-version: 18 - - name: Check node_modules cache - uses: actions/cache@v3 + - name: Cache Node modules + uses: actions/cache@v2 with: path: node_modules - key: node_modules-${{hashFiles('package-lock.json')}} - restore-keys: node_modules - - - name: Install frontend dependencies - run: npm install - - - name: Run ESLint - run: npm run eslint:check - - - name: Run Prettier - run: npm run prettier:check + key: npm-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: npm-${{ runner.os }}- - - name: Run Stylelint - run: npm run stylelint:check + - run: npm ci + - run: npm run eslint:check + - run: npm run prettier:check + - run: npm run stylelint:check + - run: npm run test - tests: - name: Cargo Test and Vitest + cargo: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - name: Checkout code + uses: actions/checkout@v2 - - name: Cache Crates - uses: actions/cache@v3 + - name: Setup Rust + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + + - name: Cache Rust crates + uses: actions/cache@v2 with: path: | ~/.cargo ./src-tauri/target - key: rust-dev-${{ hashFiles('./src-tauri/Cargo.lock') }} - restore-keys: rust-dev- + key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }} + restore-keys: cargo-${{ runner.os }}- - - name: Cache node_modules - uses: actions/cache@v3 - with: - path: node_modules - key: node_modules-${{hashFiles('package-lock.json')}} - restore-keys: node_modules - - - name: Prepare env and install Tauri dependencies + - name: Set up Tauri env run: | mkdir build echo "${{ secrets.ENV_FILE }}" > .env sudo apt-get update sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf + cd src-tauri - - name: Install minimal Rust stable - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - components: cargo - - - name: Cargo test - working-directory: ./src-tauri - run: cargo test --all-targets --all-features - - - name: Setup node - uses: actions/setup-node@v3 - with: - node-version: 21 - - - name: Npm install - run: npm install - - - name: Run Vitest - run: npm run test + - run: cargo fmt --all -- --check + - run: cargo clippy --all-targets --all-features + - run: cargo test --all-targets --all-features From b60374eb5bbcddeb7a9910b7083c0086145d86db Mon Sep 17 00:00:00 2001 From: NDoolan360 Date: Thu, 26 Oct 2023 23:15:49 +1100 Subject: [PATCH 3/3] maybe fix wrong dir error --- .github/workflows/ci.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e7c439c..980b8e1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -62,8 +62,7 @@ jobs: echo "${{ secrets.ENV_FILE }}" > .env sudo apt-get update sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf - cd src-tauri - - run: cargo fmt --all -- --check - - run: cargo clippy --all-targets --all-features - - run: cargo test --all-targets --all-features + - run: cd src-tauri && cargo fmt --all -- --check + - run: cd src-tauri && cargo clippy --all-targets --all-features + - run: cd src-tauri && cargo test --all-targets --all-features