Skip to content

chore: update GitHub Actions workflow and enhance DataTable component #38

chore: update GitHub Actions workflow and enhance DataTable component

chore: update GitHub Actions workflow and enhance DataTable component #38

Workflow file for this run

name: PR Checks
on:
pull_request:
branches: ["main"]
permissions:
pull-requests: write
jobs:
frontend-typecheck:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "yarn"
- name: Install frontend dependencies
run: yarn install --frozen-lockfile
- name: TypeScript compile check
run: yarn tsc -b
test:
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install nightly toolchain for JSON test output
run: rustup toolchain install nightly
- name: Cache Cargo build
uses: actions/cache@v4
with:
path: |
src-tauri/target
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-test-${{ hashFiles('src-tauri/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-test-
- name: Run cargo check
working-directory: src-tauri
run: cargo check
- name: Run unit tests with output capture
working-directory: src-tauri
run: |
rustup run nightly cargo test --lib -- -Z unstable-options --format json > test-results.json 2>&1 || true
cargo test --lib -- --nocapture > test-results.txt 2>&1 || true
- name: Generate test report
working-directory: src-tauri
run: python3 scripts/generate-test-report.py
- name: Comment PR with test report
if: github.event_name == 'pull_request'
working-directory: src-tauri
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
REPOSITORY: ${{ github.repository }}
run: |
REPORT_FILE="test-report.md"
if [ ! -f "$REPORT_FILE" ]; then
echo "No report file found, skipping comment"
exit 0
fi
REPORT_CONTENT=$(cat "$REPORT_FILE")
EXISTING_COMMENT=$(gh api repos/"$REPOSITORY"/issues/"$PR_NUMBER"/comments \
--jq '.[] | select(.body | startswith("## 🧪 Test Results Report")) | .id' | head -1)
if [ -n "$EXISTING_COMMENT" ]; then
gh api repos/"$REPOSITORY"/issues/comments/"$EXISTING_COMMENT" \
--method PATCH \
--field body="$REPORT_CONTENT" \
--silent
else
gh api repos/"$REPOSITORY"/issues/"$PR_NUMBER"/comments \
--method POST \
--field body="$REPORT_CONTENT" \
--silent
fi