This repository has been archived by the owner on Nov 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from NDoolan360/dev
Improved Actions
- Loading branch information
Showing
1 changed file
with
43 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,119 +1,68 @@ | ||
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: Rust cache | ||
uses: Swatinem/rust-cache@v2 | ||
|
||
- 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 | ||
id: node_module_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 | ||
if: steps.node_module_cache.outputs.cache-hit != 'true' | ||
run: npm install | ||
|
||
- name: Run ESLint | ||
run: npm run eslint:check | ||
key: npm-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: npm-${{ runner.os }}- | ||
|
||
- name: Run Prettier | ||
run: npm run prettier:check | ||
- run: npm ci | ||
- run: npm run eslint:check | ||
- run: npm run prettier:check | ||
- run: npm run stylelint:check | ||
- run: npm run test | ||
|
||
- name: Run Stylelint | ||
run: npm run stylelint:check | ||
|
||
tests: | ||
name: Cargo Test and Vitest | ||
cargo: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Rust cache | ||
uses: Swatinem/rust-cache@v2 | ||
|
||
- 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: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install minimal Rust stable | ||
- name: Setup Rust | ||
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 | ||
- name: Cache Rust crates | ||
uses: actions/cache@v2 | ||
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 | ||
path: | | ||
~/.cargo | ||
./src-tauri/target | ||
key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: cargo-${{ runner.os }}- | ||
|
||
- name: Npm install | ||
if: steps.node_module_cache.outputs.cache-hit != 'true' | ||
run: npm install | ||
- 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 | ||
- name: Run Vitest | ||
run: npm run test | ||
- 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 |