diff options
Diffstat (limited to '.github')
| -rw-r--r-- | .github/agents/commit.agent.md | 2 | ||||
| -rw-r--r-- | .github/instructions/commit.instructions.md | 2 | ||||
| -rw-r--r-- | .github/workflows/check.yml | 2 | ||||
| -rw-r--r-- | .github/workflows/issue-checker.yml | 84 | ||||
| -rw-r--r-- | .github/workflows/prek.yml | 52 | ||||
| -rw-r--r-- | .github/workflows/test.yml | 69 |
6 files changed, 121 insertions, 90 deletions
diff --git a/.github/agents/commit.agent.md b/.github/agents/commit.agent.md index 13372e5..7187402 100644 --- a/.github/agents/commit.agent.md +++ b/.github/agents/commit.agent.md @@ -257,4 +257,4 @@ git commit --amend -m "<new message>" ## References -- Commit spec: <a>.github/references/git/conventional-commit.md</a>
\ No newline at end of file +- Commit spec: <a>.github/references/git/conventional-commit.md</a> diff --git a/.github/instructions/commit.instructions.md b/.github/instructions/commit.instructions.md index cc29e9c..f01f080 100644 --- a/.github/instructions/commit.instructions.md +++ b/.github/instructions/commit.instructions.md @@ -35,4 +35,4 @@ When user requests commit help → Follow <a>.github/agents/commit.agent.md</a> ## User Triggers -"create commit", "commit message", "conventional commit"
\ No newline at end of file +"create commit", "commit message", "conventional commit" diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 1280ad7..ba8ce54 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -40,6 +40,6 @@ jobs: - run: pnpm lint working-directory: ui - - run: pnpm format --check + - run: pnpm format working-directory: ui diff --git a/.github/workflows/issue-checker.yml b/.github/workflows/issue-checker.yml deleted file mode 100644 index a598488..0000000 --- a/.github/workflows/issue-checker.yml +++ /dev/null @@ -1,84 +0,0 @@ -name: Issue Checker - -on: - issues: - types: [opened, edited] - pull_request_target: - types: [opened, edited] - -permissions: - issues: write - pull-requests: write - -jobs: - check: - runs-on: ubuntu-latest - steps: - - name: Check and Label Issues - uses: actions/github-script@v7 - with: - script: | - const issue = context.payload.issue || context.payload.pull_request; - if (!issue) return; - - const body = issue.body || ''; - const title = issue.title || ''; - const isIssue = !!context.payload.issue; - const issueNumber = issue.number; - - // Skip if "I have not read carefully" is checked - handled by issue-checkbox-checker.yml - const hasNotReadChecked = - body.includes('- [x] I have not read carefully') || - body.includes('- [X] I have not read carefully') || - body.includes('- [x] 我未仔细阅读') || - body.includes('- [X] 我未仔细阅读'); - - if (hasNotReadChecked) { - // Let issue-checkbox-checker handle this - return; - } - - const labels = []; - - // Platform labels - if (body.match(/Windows|windows/i)) labels.push('platform: windows'); - if (body.match(/macOS|macos|Mac/i)) labels.push('platform: macos'); - if (body.match(/Linux|linux|Ubuntu|Debian|Arch|Fedora/i)) labels.push('platform: linux'); - - // Mod loader labels - if (body.match(/Fabric/i)) labels.push('mod-loader: fabric'); - if (body.match(/Forge/i)) labels.push('mod-loader: forge'); - - // Java related - if (body.match(/Java|java|JRE|JDK/i)) labels.push('java'); - - // Authentication issues - if (body.match(/login|authentication|Microsoft|Xbox|account/i)) labels.push('authentication'); - - // Download issues - if (body.match(/download|downloading|assets|libraries/i)) labels.push('download'); - - // Launch issues - if (body.match(/launch|start|won't start|crash|crashed/i)) labels.push('launch'); - - // UI issues - if (body.match(/UI|interface|display|rendering|visual/i)) labels.push('ui'); - - // Performance issues - if (body.match(/slow|performance|lag|freeze|hang/i)) labels.push('performance'); - - // Check for unclear titles - if (isIssue && (title.length < 10 || - title.match(/^(help|问题|stuck|卡住|error|错误|bug)$/i))) { - labels.push('needs-clarification'); - } - - // Apply labels - if (labels.length > 0) { - await github.rest.issues.addLabels({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: issue.number, - labels: labels - }); - } diff --git a/.github/workflows/prek.yml b/.github/workflows/prek.yml new file mode 100644 index 0000000..b49447d --- /dev/null +++ b/.github/workflows/prek.yml @@ -0,0 +1,52 @@ +name: Prek Checks + +on: + push: + branches: ["main", "dev"] + workflow_dispatch: + +permissions: + contents: write + +jobs: + prek: + runs-on: ubuntu-latest + if: "!contains(github.event.head_commit.message, '[skip ci]')" + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + fetch-depth: 0 + + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + + - name: Install system dependencies + if: runner.os == 'Linux' + run: | + sudo apt-get update || true + sudo apt-get install -y \ + libwebkit2gtk-4.1-dev \ + build-essential \ + libssl-dev \ + libgtk-3-dev \ + libayatana-appindicator3-dev \ + librsvg2-dev \ + pkg-config + + - name: Run prek (auto-fix) + id: prek + uses: j178/prek-action@v1 + continue-on-error: true + with: + all_files: true + + - name: Commit fixes + if: steps.prek.outcome == 'failure' + uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: "chore: apply prek auto-fixes [skip ci]" + commit_user_name: "hydroroll-bot" + commit_user_email: "bot@hydroroll.team" + skip_dirty_check: true diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5440cd8..8bf6d2f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -45,8 +45,8 @@ jobs: - name: Install Dependencies (Ubuntu) if: runner.os == 'Linux' && !matrix.wayland run: | - sudo apt-get update - sudo apt-get install -y libwebkit2gtk-4.1-dev build-essential curl wget file libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev + sudo apt-get update || true + sudo apt-get install -y libwebkit2gtk-4.1-dev build-essential curl wget file libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev libfuse2 - name: Install Dependencies (Arch Linux) if: matrix.wayland @@ -65,6 +65,27 @@ jobs: - name: Install Rust uses: dtolnay/rust-toolchain@stable + - name: Install Node.js + if: github.event_name == 'workflow_dispatch' + uses: actions/setup-node@v4 + with: + node-version: 22 + + - name: Install pnpm + if: github.event_name == 'workflow_dispatch' + uses: pnpm/action-setup@v2 + with: + version: 9 + + - name: Install Frontend Dependencies + if: github.event_name == 'workflow_dispatch' + working-directory: ./ui + run: pnpm install + + - name: Install Tauri CLI + if: github.event_name == 'workflow_dispatch' + run: cargo install tauri-cli + - name: Rust Cache uses: swatinem/rust-cache@v2 with: @@ -74,6 +95,48 @@ jobs: working-directory: ./src-tauri run: cargo test --verbose - - name: Build (Dev) + - name: Build Rust Only (Push/PR) + if: github.event_name != 'workflow_dispatch' working-directory: ./src-tauri run: cargo build --verbose + + - name: Build App (Debug) + if: github.event_name == 'workflow_dispatch' + run: cargo tauri build --debug + + - name: Get Short SHA + if: github.event_name == 'workflow_dispatch' + id: slug + run: echo "sha8=$(echo ${GITHUB_SHA} | cut -c1-8)" >> $GITHUB_OUTPUT + + - name: Upload Artifact (Linux) + if: runner.os == 'Linux' && github.event_name == 'workflow_dispatch' + uses: actions/upload-artifact@v4 + with: + name: dropout-linux-${{ matrix.wayland && 'arch' || 'ubuntu' }}-${{ steps.slug.outputs.sha8 }} + path: | + src-tauri/target/debug/bundle/appimage/*.AppImage + src-tauri/target/debug/bundle/deb/*.deb + src-tauri/target/debug/dropout + retention-days: 5 + + - name: Upload Artifact (Windows) + if: runner.os == 'Windows' && github.event_name == 'workflow_dispatch' + uses: actions/upload-artifact@v4 + with: + name: dropout-windows-${{ steps.slug.outputs.sha8 }} + path: | + src-tauri/target/debug/bundle/msi/*.msi + src-tauri/target/debug/bundle/nsis/*.exe + src-tauri/target/debug/dropout.exe + retention-days: 5 + + - name: Upload Artifact (macOS) + if: runner.os == 'macOS' && github.event_name == 'workflow_dispatch' + uses: actions/upload-artifact@v4 + with: + name: dropout-macos-${{ steps.slug.outputs.sha8 }} + path: | + src-tauri/target/debug/bundle/dmg/*.dmg + src-tauri/target/debug/bundle/macos/DropOut.app + retention-days: 5 |