Skip to content

Commit a0c0bb4

Browse files
authored
Merge pull request #2 from variableway/feature/executable-tutorial
Feature/executable tutorial
2 parents 3fe473a + 6f20a50 commit a0c0bb4

File tree

133 files changed

+12347
-333
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+12347
-333
lines changed
Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
name: Executable Tutorial CI/CD
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
paths:
7+
- 'apps/desktop/**'
8+
- 'packages/**'
9+
- '.github/workflows/executable-tutorial.yml'
10+
pull_request:
11+
branches: [ main, develop ]
12+
paths:
13+
- 'apps/desktop/**'
14+
- 'packages/**'
15+
workflow_dispatch:
16+
inputs:
17+
task:
18+
description: 'Task to execute'
19+
required: true
20+
default: 'build'
21+
type: choice
22+
options:
23+
- build
24+
- test
25+
- lint
26+
- release
27+
28+
env:
29+
CARGO_TERM_COLOR: always
30+
NODE_VERSION: '20'
31+
32+
jobs:
33+
# 代码检查和测试
34+
check:
35+
runs-on: ${{ matrix.os }}
36+
strategy:
37+
matrix:
38+
os: [ubuntu-latest, macos-latest, windows-latest]
39+
40+
steps:
41+
- uses: actions/checkout@v4
42+
43+
- name: Setup Node.js
44+
uses: actions/setup-node@v4
45+
with:
46+
node-version: ${{ env.NODE_VERSION }}
47+
cache: 'npm'
48+
49+
- name: Setup Rust
50+
uses: dtolnay/rust-action@stable
51+
52+
- name: Install dependencies
53+
run: |
54+
npm ci
55+
cd apps/desktop && npm ci
56+
57+
- name: Run linter
58+
run: |
59+
cd apps/desktop
60+
npm run lint
61+
continue-on-error: true
62+
63+
- name: Run tests
64+
run: |
65+
cd apps/desktop
66+
npm run test
67+
continue-on-error: true
68+
69+
# 构建桌面应用
70+
build:
71+
needs: check
72+
runs-on: ${{ matrix.os }}
73+
strategy:
74+
matrix:
75+
include:
76+
- os: macos-latest
77+
target: aarch64-apple-darwin
78+
args: '--target aarch64-apple-darwin'
79+
- os: macos-latest
80+
target: x86_64-apple-darwin
81+
args: '--target x86_64-apple-darwin'
82+
- os: windows-latest
83+
target: x86_64-pc-windows-msvc
84+
args: ''
85+
- os: ubuntu-latest
86+
target: x86_64-unknown-linux-gnu
87+
args: ''
88+
89+
steps:
90+
- uses: actions/checkout@v4
91+
92+
- name: Setup Node.js
93+
uses: actions/setup-node@v4
94+
with:
95+
node-version: ${{ env.NODE_VERSION }}
96+
cache: 'npm'
97+
98+
- name: Setup Rust
99+
uses: dtolnay/rust-action@stable
100+
with:
101+
targets: ${{ matrix.target }}
102+
103+
- name: Install Linux dependencies
104+
if: matrix.os == 'ubuntu-latest'
105+
run: |
106+
sudo apt-get update
107+
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf
108+
109+
- name: Install dependencies
110+
run: |
111+
npm ci
112+
cd apps/desktop && npm ci
113+
114+
- name: Build Tauri app
115+
run: |
116+
cd apps/desktop/src-tauri
117+
cargo build --release ${{ matrix.args }}
118+
119+
- name: Upload artifacts
120+
uses: actions/upload-artifact@v4
121+
with:
122+
name: executable-tutorial-${{ matrix.target }}
123+
path: |
124+
apps/desktop/src-tauri/target/release/bundle/**/*.dmg
125+
apps/desktop/src-tauri/target/release/bundle/**/*.app
126+
apps/desktop/src-tauri/target/release/bundle/**/*.exe
127+
apps/desktop/src-tauri/target/release/bundle/**/*.msi
128+
apps/desktop/src-tauri/target/release/bundle/**/*.deb
129+
apps/desktop/src-tauri/target/release/bundle/**/*.AppImage
130+
131+
# 发布版本
132+
release:
133+
needs: build
134+
runs-on: ubuntu-latest
135+
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
136+
137+
steps:
138+
- uses: actions/checkout@v4
139+
140+
- name: Download all artifacts
141+
uses: actions/download-artifact@v4
142+
with:
143+
path: artifacts
144+
145+
- name: Create Release
146+
uses: softprops/action-gh-release@v1
147+
if: startsWith(github.ref, 'refs/tags/')
148+
with:
149+
files: artifacts/**/*
150+
env:
151+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: Local Workflow Trigger
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
task_file:
7+
description: 'Task file path (relative to repo root)'
8+
required: true
9+
type: string
10+
action:
11+
description: 'Action to perform'
12+
required: true
13+
default: 'start'
14+
type: choice
15+
options:
16+
- start
17+
- complete
18+
- pause
19+
- resume
20+
21+
env:
22+
WORKFLOW_STATE_FILE: '.local-workflow.state.json'
23+
24+
jobs:
25+
manage-task:
26+
runs-on: ubuntu-latest
27+
28+
steps:
29+
- uses: actions/checkout@v4
30+
31+
- name: Setup workflow state
32+
run: |
33+
if [ ! -f ${{ env.WORKFLOW_STATE_FILE }} ]; then
34+
echo '{"tasks": []}' > ${{ env.WORKFLOW_STATE_FILE }}
35+
fi
36+
37+
- name: Update task status
38+
run: |
39+
TASK_FILE="${{ github.event.inputs.task_file }}"
40+
ACTION="${{ github.event.inputs.action }}"
41+
TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
42+
43+
echo "Managing task: $TASK_FILE"
44+
echo "Action: $ACTION"
45+
echo "Timestamp: $TIMESTAMP"
46+
47+
# Update workflow state (in real scenario, this would commit back to repo)
48+
cat > ${{ env.WORKFLOW_STATE_FILE }} << EOF
49+
{
50+
"current_task": "$TASK_FILE",
51+
"action": "$ACTION",
52+
"timestamp": "$TIMESTAMP",
53+
"actor": "${{ github.actor }}"
54+
}
55+
EOF
56+
57+
cat ${{ env.WORKFLOW_STATE_FILE }}
58+
59+
- name: Create task tracking file
60+
if: github.event.inputs.action == 'start'
61+
run: |
62+
TASK_FILE="${{ github.event.inputs.task_file }}"
63+
TASK_DIR=$(dirname "$TASK_FILE")
64+
TASK_NAME=$(basename "$TASK_FILE" .md)
65+
TRACING_DIR="tasks/tracing"
66+
67+
mkdir -p "$TRACING_DIR"
68+
69+
TRACING_FILE="$TRACING_DIR/$(echo $TASK_NAME | sed 's/[^a-zA-Z0-9]/-/g').md"
70+
71+
cat > "$TRACING_FILE" << EOF
72+
# Task Tracing: $TASK_NAME
73+
74+
## Metadata
75+
- **Source**: $TASK_FILE
76+
- **Started**: $(date -u +"%Y-%m-%dT%H:%M:%SZ")
77+
- **Status**: In Progress
78+
- **Actor**: ${{ github.actor }}
79+
80+
## Progress Log
81+
82+
### $(date -u +"%Y-%m-%d %H:%M:%S") - Task Started
83+
- Action: ${{ github.event.inputs.action }}
84+
85+
## Notes
86+
87+
<!-- Add progress notes here -->
88+
89+
EOF
90+
91+
echo "Created tracing file: $TRACING_FILE"
92+
93+
- name: Commit workflow state
94+
run: |
95+
git config --local user.email "action@github.com"
96+
git config --local user.name "GitHub Action"
97+
git add ${{ env.WORKFLOW_STATE_FILE }}
98+
git add tasks/tracing/ || true
99+
git diff --staged --quiet || git commit -m "Update workflow state: ${{ github.event.inputs.action }} ${{ github.event.inputs.task_file }}"
100+
101+
- name: Push changes
102+
uses: ad-m/github-push-action@master
103+
with:
104+
github_token: ${{ secrets.GITHUB_TOKEN }}
105+
branch: ${{ github.ref }}

.local-workflow.state.json

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
{
2-
"task_file": "tasks/features/F1.3-app-layout-navigation.md",
3-
"task_id": "local-20260407-718bcac3",
4-
"title": "F1.3 \u5e94\u7528\u5e03\u5c40\u4e0e\u5bfc\u822a",
5-
"started_at": "2026-04-07 04:37:04",
6-
"status": "in_progress",
7-
"tracing_file": "tasks/tracing/F1.3-app-layout-navigation.md"
8-
}
2+
"task_file": "tasks/mindstorm/executable-tutorial.md",
3+
"task_id": "local-20260408-08025e73",
4+
"title": "executable-tutorial",
5+
"started_at": "2026-04-08 15:35:00",
6+
"status": "completed",
7+
"completed_at": "2026-04-08 16:20:00",
8+
"tracing_file": "tasks/tracing/executable-tutorial.md"
9+
}

.local-workflow.state.json.tmp

Whitespace-only changes.

apps/desktop/.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?

apps/desktop/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Tauri + React + Typescript
2+
3+
This template should help get you started developing with Tauri, React and Typescript in Vite.
4+
5+
## Recommended IDE Setup
6+
7+
- [VS Code](https://code.visualstudio.com/) + [Tauri](https://marketplace.visualstudio.com/items?itemName=tauri-apps.tauri-vscode) + [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer)

apps/desktop/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!doctype html>
2+
<html lang="zh-CN">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Executable Tutorial</title>
8+
</head>
9+
<body>
10+
<div id="root"></div>
11+
<script type="module" src="/src/main.tsx"></script>
12+
</body>
13+
</html>

apps/desktop/package.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"name": "desktop",
3+
"private": true,
4+
"version": "0.1.0",
5+
"type": "module",
6+
"scripts": {
7+
"dev": "vite",
8+
"build": "tsc && vite build",
9+
"preview": "vite preview",
10+
"tauri": "tauri"
11+
},
12+
"dependencies": {
13+
"@tauri-apps/api": "^2.10.1",
14+
"@tauri-apps/plugin-opener": "^2",
15+
"lucide-react": "^1.7.0",
16+
"react": "^19.1.0",
17+
"react-dom": "^19.1.0",
18+
"zustand": "^5.0.12"
19+
},
20+
"devDependencies": {
21+
"@tauri-apps/cli": "^2",
22+
"@types/react": "^19.1.8",
23+
"@types/react-dom": "^19.1.6",
24+
"@vitejs/plugin-react": "^4.6.0",
25+
"autoprefixer": "^10.4.27",
26+
"postcss": "^8.5.9",
27+
"tailwindcss": "^3.4.19",
28+
"typescript": "~5.8.3",
29+
"vite": "^7.0.4"
30+
}
31+
}

apps/desktop/postcss.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export default {
2+
plugins: {
3+
tailwindcss: {},
4+
autoprefixer: {},
5+
},
6+
}

apps/desktop/public/tauri.svg

Lines changed: 6 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)