Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
151 changes: 151 additions & 0 deletions .github/workflows/executable-tutorial.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
name: Executable Tutorial CI/CD

on:
push:
branches: [ main, develop ]
paths:
- 'apps/desktop/**'
- 'packages/**'
- '.github/workflows/executable-tutorial.yml'
pull_request:
branches: [ main, develop ]
paths:
- 'apps/desktop/**'
- 'packages/**'
workflow_dispatch:
inputs:
task:
description: 'Task to execute'
required: true
default: 'build'
type: choice
options:
- build
- test
- lint
- release

env:
CARGO_TERM_COLOR: always
NODE_VERSION: '20'

jobs:
# 代码检查和测试
check:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]

steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'

- name: Setup Rust
uses: dtolnay/rust-action@stable

- name: Install dependencies
run: |
npm ci
cd apps/desktop && npm ci

- name: Run linter
run: |
cd apps/desktop
npm run lint
continue-on-error: true

- name: Run tests
run: |
cd apps/desktop
npm run test
continue-on-error: true

# 构建桌面应用
build:
needs: check
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: macos-latest
target: aarch64-apple-darwin
args: '--target aarch64-apple-darwin'
- os: macos-latest
target: x86_64-apple-darwin
args: '--target x86_64-apple-darwin'
- os: windows-latest
target: x86_64-pc-windows-msvc
args: ''
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
args: ''

steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'

- name: Setup Rust
uses: dtolnay/rust-action@stable
with:
targets: ${{ matrix.target }}

- name: Install Linux dependencies
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf

- name: Install dependencies
run: |
npm ci
cd apps/desktop && npm ci

- name: Build Tauri app
run: |
cd apps/desktop/src-tauri
cargo build --release ${{ matrix.args }}

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: executable-tutorial-${{ matrix.target }}
path: |
apps/desktop/src-tauri/target/release/bundle/**/*.dmg
apps/desktop/src-tauri/target/release/bundle/**/*.app
apps/desktop/src-tauri/target/release/bundle/**/*.exe
apps/desktop/src-tauri/target/release/bundle/**/*.msi
apps/desktop/src-tauri/target/release/bundle/**/*.deb
apps/desktop/src-tauri/target/release/bundle/**/*.AppImage

# 发布版本
release:
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && github.event_name == 'push'

steps:
- uses: actions/checkout@v4

- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts

- name: Create Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: artifacts/**/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
105 changes: 105 additions & 0 deletions .github/workflows/local-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: Local Workflow Trigger

on:
workflow_dispatch:
inputs:
task_file:
description: 'Task file path (relative to repo root)'
required: true
type: string
action:
description: 'Action to perform'
required: true
default: 'start'
type: choice
options:
- start
- complete
- pause
- resume

env:
WORKFLOW_STATE_FILE: '.local-workflow.state.json'

jobs:
manage-task:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup workflow state
run: |
if [ ! -f ${{ env.WORKFLOW_STATE_FILE }} ]; then
echo '{"tasks": []}' > ${{ env.WORKFLOW_STATE_FILE }}
fi

- name: Update task status
run: |
TASK_FILE="${{ github.event.inputs.task_file }}"
ACTION="${{ github.event.inputs.action }}"
TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ")

echo "Managing task: $TASK_FILE"
echo "Action: $ACTION"
echo "Timestamp: $TIMESTAMP"

# Update workflow state (in real scenario, this would commit back to repo)
cat > ${{ env.WORKFLOW_STATE_FILE }} << EOF
{
"current_task": "$TASK_FILE",
"action": "$ACTION",
"timestamp": "$TIMESTAMP",
"actor": "${{ github.actor }}"
}
EOF

cat ${{ env.WORKFLOW_STATE_FILE }}

- name: Create task tracking file
if: github.event.inputs.action == 'start'
run: |
TASK_FILE="${{ github.event.inputs.task_file }}"
TASK_DIR=$(dirname "$TASK_FILE")
TASK_NAME=$(basename "$TASK_FILE" .md)
TRACING_DIR="tasks/tracing"

mkdir -p "$TRACING_DIR"

TRACING_FILE="$TRACING_DIR/$(echo $TASK_NAME | sed 's/[^a-zA-Z0-9]/-/g').md"

cat > "$TRACING_FILE" << EOF
# Task Tracing: $TASK_NAME

## Metadata
- **Source**: $TASK_FILE
- **Started**: $(date -u +"%Y-%m-%dT%H:%M:%SZ")
- **Status**: In Progress
- **Actor**: ${{ github.actor }}

## Progress Log

### $(date -u +"%Y-%m-%d %H:%M:%S") - Task Started
- Action: ${{ github.event.inputs.action }}

## Notes

<!-- Add progress notes here -->

EOF

echo "Created tracing file: $TRACING_FILE"

- name: Commit workflow state
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add ${{ env.WORKFLOW_STATE_FILE }}
git add tasks/tracing/ || true
git diff --staged --quiet || git commit -m "Update workflow state: ${{ github.event.inputs.action }} ${{ github.event.inputs.task_file }}"

- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
15 changes: 8 additions & 7 deletions .local-workflow.state.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"task_file": "tasks/features/F1.3-app-layout-navigation.md",
"task_id": "local-20260407-718bcac3",
"title": "F1.3 \u5e94\u7528\u5e03\u5c40\u4e0e\u5bfc\u822a",
"started_at": "2026-04-07 04:37:04",
"status": "in_progress",
"tracing_file": "tasks/tracing/F1.3-app-layout-navigation.md"
}
"task_file": "tasks/mindstorm/executable-tutorial.md",
"task_id": "local-20260408-08025e73",
"title": "executable-tutorial",
"started_at": "2026-04-08 15:35:00",
"status": "completed",
"completed_at": "2026-04-08 16:20:00",
"tracing_file": "tasks/tracing/executable-tutorial.md"
}
Empty file added .local-workflow.state.json.tmp
Empty file.
24 changes: 24 additions & 0 deletions apps/desktop/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
7 changes: 7 additions & 0 deletions apps/desktop/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Tauri + React + Typescript

This template should help get you started developing with Tauri, React and Typescript in Vite.

## Recommended IDE Setup

- [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)
13 changes: 13 additions & 0 deletions apps/desktop/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Executable Tutorial</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
31 changes: 31 additions & 0 deletions apps/desktop/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "desktop",
"private": true,
"version": "0.1.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview",
"tauri": "tauri"
},
"dependencies": {
"@tauri-apps/api": "^2.10.1",
"@tauri-apps/plugin-opener": "^2",
"lucide-react": "^1.7.0",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"zustand": "^5.0.12"
},
"devDependencies": {
"@tauri-apps/cli": "^2",
"@types/react": "^19.1.8",
"@types/react-dom": "^19.1.6",
"@vitejs/plugin-react": "^4.6.0",
"autoprefixer": "^10.4.27",
"postcss": "^8.5.9",
"tailwindcss": "^3.4.19",
"typescript": "~5.8.3",
"vite": "^7.0.4"
}
}
6 changes: 6 additions & 0 deletions apps/desktop/postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}
6 changes: 6 additions & 0 deletions apps/desktop/public/tauri.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions apps/desktop/public/vite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions apps/desktop/src-tauri/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Generated by Cargo
# will have compiled files and executables
/target/

# Generated by Tauri
# will have schema files for capabilities auto-completion
/gen/schemas
Loading
Loading