-
Notifications
You must be signed in to change notification settings - Fork 0
163 lines (143 loc) · 4.39 KB
/
ci.yml
File metadata and controls
163 lines (143 loc) · 4.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
name: Full Stack CI
on:
push:
branches: [ "main" ]
paths-ignore:
- '**.md'
- '.gitignore'
- 'LICENSE'
pull_request:
branches: [ "main" ]
paths-ignore:
- '**.md'
- '.gitignore'
- 'LICENSE'
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
# Check if we should skip CI
changes:
name: Detect Changes
runs-on: ubuntu-latest
outputs:
backend: ${{ steps.changes.outputs.backend }}
frontend: ${{ steps.changes.outputs.frontend }}
general: ${{ steps.changes.outputs.general }}
gha: ${{ steps.changes.outputs.gha }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Check for changes
uses: dorny/paths-filter@v3
id: changes
with:
# Define filters for different parts of the project to conditionally run jobs
filters: |
backend:
- 'src-tauri/**'
frontend:
- 'src/**'
- 'public/**'
- 'package.json'
- 'pnpm-lock.yaml'
- 'index.html'
- 'vite.config.*'
- 'tsconfig.json'
- 'tsconfig.node.json'
- 'postcss.config.js'
- 'tailwind.config.*'
- 'components.json'
- 'app-icon.png'
- 'pnpm-lock.yaml'
general:
- '**.md'
- '.gitignore'
- 'LICENSE'
- 'docs/**'
gha:
- '.github/**'
# Combined Full Stack Test and Build
full-stack-test-build:
name: Full Stack Test & Build
runs-on: ${{ matrix.os }}
needs: changes
if: needs.changes.outputs.general == 'false' || (needs.changes.outputs.backend == 'true' || needs.changes.outputs.frontend == 'true' || needs.changes.outputs.gha == 'true')
strategy:
fail-fast: false
matrix:
os: [ macos-latest ]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
# Setup all required tools
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Install Rust Toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
cache: true
# Enhanced caching strategy
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Cache All Dependencies
uses: actions/cache@v4
with:
path: |
${{ env.STORE_PATH }}
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
src-tauri/target/
node_modules
dist/
key: ${{ runner.os }}-fullstack-${{ hashFiles('**/Cargo.lock', '**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-fullstack-
${{ runner.os }}-
# Install all dependencies
- name: Install Frontend Dependencies
run: pnpm install --frozen-lockfile
# Backend tests and checks (if backend changed)
- name: Run Rust Unit Tests
if: needs.changes.outputs.backend == 'true'
run: |
cd src-tauri
cargo test --verbose --all-features --lib
# Frontend tests and checks (if frontend changed)
- name: Run Frontend Unit Tests
if: needs.changes.outputs.frontend == 'true'
run: pnpm test
env:
NODE_ENV: test
# Build frontend first (required for Tauri)
- name: Build Frontend
run: pnpm run build
# Run Tauri integration tests
- name: Run Tauri Integration Tests
run: |
cd src-tauri
cargo test
# Start backend for integration tests (if needed)
- name: Start Backend for Integration Tests
if: needs.changes.outputs.frontend == 'true' && needs.changes.outputs.backend == 'true'
run: |
cd src-tauri
cargo check --release
# Build Tauri application (includes both frontend and backend)
- name: Build Tauri Application
run: pnpm tauri build --verbose
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}