Skip to content

Commit 754a658

Browse files
committed
workflow
1 parent 2e11b35 commit 754a658

File tree

1 file changed

+119
-50
lines changed

1 file changed

+119
-50
lines changed

.github/workflows/rust.yml

Lines changed: 119 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,136 @@
1-
name: Rust
1+
name: Rust Testing
22

33
on:
44
push:
5-
branches: [ "main" ]
5+
branches: [ "*" ] # Run on all branches
66
pull_request:
7-
branches: [ "main" ]
7+
branches: [ "*" ] # Run on PRs to any branch
8+
workflow_dispatch: # Enable manual trigger button
9+
inputs:
10+
run_full_tests:
11+
description: 'Run full test suite (including performance tests)'
12+
required: false
13+
default: 'true'
14+
type: boolean
15+
run_benchmarks:
16+
description: 'Run performance benchmarks'
17+
required: false
18+
default: 'false'
19+
type: boolean
820

921
env:
1022
CARGO_TERM_COLOR: always
11-
VERSION_MAJOR: 1
12-
VERSION_MINOR: 0
1323

1424
jobs:
15-
build_windows:
16-
runs-on: windows-latest
25+
test_linux:
26+
runs-on: ubuntu-latest
1727

1828
steps:
19-
- uses: actions/checkout@v3
20-
- name: Setup node
21-
uses: actions/setup-node@v3
22-
with:
23-
node-version: 18
24-
- run: npm i -g yarn
25-
26-
- name: Make sure you have Tauri CLI installed
29+
- name: Checkout repository
30+
uses: actions/checkout@v4
31+
32+
- name: Display workflow inputs
33+
if: github.event_name == 'workflow_dispatch'
2734
run: |
28-
cargo install tauri-cli
35+
echo "🔧 Manual workflow trigger detected"
36+
echo "📊 Run full tests: ${{ github.event.inputs.run_full_tests }}"
37+
echo "🏃 Run benchmarks: ${{ github.event.inputs.run_benchmarks }}"
38+
39+
- name: Setup Node.js
40+
uses: actions/setup-node@v4
41+
with:
42+
node-version: '20'
43+
cache: 'npm'
44+
45+
- name: Setup Rust
46+
uses: actions-rs/toolchain@v1
47+
with:
48+
toolchain: stable
49+
profile: minimal
50+
override: true
51+
components: rustfmt, clippy
2952

30-
- name: Install dependencies
31-
run: yarn
32-
33-
- name: Build for production
53+
- name: Install system dependencies (Linux)
3454
run: |
35-
cargo tauri build
36-
dir "./src-tauri/target/release/bundle"
37-
38-
- name: Create Release
39-
id: create_release
40-
uses: actions/create-release@v1
41-
env:
42-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
55+
sudo apt update
56+
sudo apt install -y libwebkit2gtk-4.0-dev build-essential curl wget file libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev
57+
58+
- name: Install Node.js dependencies
59+
run: npm install
60+
61+
- name: Cache Rust dependencies
62+
uses: actions/cache@v3
4363
with:
44-
tag_name: v${{ env.VERSION_MAJOR }}.${{ env.VERSION_MINOR }}.${{ github.run_number }}
45-
release_name: Release ${{ env.VERSION_MAJOR }}.${{ env.VERSION_MINOR }}.${{ github.run_number }}
46-
47-
- name: Upload MSI
48-
id: upload-release-asset-msi
49-
uses: actions/upload-release-asset@v1
50-
env:
51-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
64+
path: |
65+
~/.cargo/bin/
66+
~/.cargo/registry/index/
67+
~/.cargo/registry/cache/
68+
~/.cargo/git/db/
69+
target/
70+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
71+
72+
- name: Run cargo fmt check
73+
run: cargo fmt --all -- --check
74+
working-directory: ./src-tauri
75+
76+
- name: Run cargo clippy
77+
run: cargo clippy --all-targets --all-features -- -D warnings
78+
working-directory: ./src-tauri
79+
80+
- name: Generate test data
81+
run: |
82+
echo "📁 Generating test data for fuzzy search..."
83+
echo "This creates 176,840 empty files in ./src-tauri/test-data-for-fuzzy-search/"
84+
cargo test create_test_data --features "generate-test-data" -- --nocapture
85+
working-directory: ./src-tauri
86+
87+
- name: Run basic tests
88+
run: |
89+
echo "🧪 Running basic functionality tests..."
90+
cargo test
91+
working-directory: ./src-tauri
92+
93+
- name: Run comprehensive tests (without file opening)
94+
if: github.event.inputs.run_full_tests != 'false'
95+
run: |
96+
echo "🚀 Running comprehensive test suite..."
97+
echo "Note: This runs the full feature set but without opening default apps"
98+
cargo test --features "full-no-generate-test-data" -- --test-threads=1
99+
working-directory: ./src-tauri
100+
101+
- name: Run performance benchmarks
102+
if: github.event.inputs.run_benchmarks == 'true'
103+
run: |
104+
echo "⚡ Running performance benchmarks..."
105+
cargo test --features benchmarks --release -- bench
106+
working-directory: ./src-tauri
107+
continue-on-error: true
108+
109+
- name: Verify test data was created
110+
run: |
111+
echo "📊 Verifying test data creation..."
112+
if [ -d "./src-tauri/test-data-for-fuzzy-search" ]; then
113+
echo "✅ Test data directory exists"
114+
find ./src-tauri/test-data-for-fuzzy-search -type f | wc -l | xargs echo "Total files created:"
115+
else
116+
echo "❌ Test data directory not found"
117+
fi
118+
119+
- name: Upload test logs
120+
uses: actions/upload-artifact@v3
121+
if: always()
52122
with:
53-
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
54-
asset_path: ./src-tauri/target/release/bundle/msi/file-explorer_0.0.0_x64_en-US.msi
55-
asset_name: file-explorer_${{ env.VERSION_MAJOR }}.${{ env.VERSION_MINOR }}.${{ github.run_number }}_x64_en-US.msi
56-
asset_content_type: application/x-msi
57-
58-
- name: Upload Executable
59-
id: upload-release-asset-exe
60-
uses: actions/upload-release-asset@v1
61-
env:
62-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
123+
name: test-logs
124+
path: |
125+
./src-tauri/logs/
126+
./src-tauri/app.log
127+
./src-tauri/error.log
128+
129+
- name: Upload test data artifacts
130+
uses: actions/upload-artifact@v3
131+
if: always()
63132
with:
64-
upload_url: ${{ steps.create_release.outputs.upload_url }}
65-
asset_path: ./src-tauri/target/release/bundle/nsis/file-explorer_0.0.0_x64-setup.exe
66-
asset_name: file-explorer_${{ env.VERSION_MAJOR }}.${{ env.VERSION_MINOR }}.${{ github.run_number }}_x64-setup.exe
67-
asset_content_type: application/x-msdownload
133+
name: test-data
134+
path: |
135+
./src-tauri/test-data-for-fuzzy-search/
136+
if-no-files-found: warn

0 commit comments

Comments
 (0)