From da2529bd9694b24ad80323f516af4f053af1c2ff Mon Sep 17 00:00:00 2001 From: pikann22 Date: Sat, 27 Jun 2026 16:10:32 +0000 Subject: [PATCH] feat: add GitHub Actions workflows for backend, frontend, and release processes --- .github/workflows/backend-pr-ci.yml | 101 +++++++++++++++++++++++++++ .github/workflows/frontend-pr-ci.yml | 53 ++++++++++++++ .github/workflows/release.yml | 80 +++++++++++++++++++++ 3 files changed, 234 insertions(+) create mode 100644 .github/workflows/backend-pr-ci.yml create mode 100644 .github/workflows/frontend-pr-ci.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/backend-pr-ci.yml b/.github/workflows/backend-pr-ci.yml new file mode 100644 index 0000000..d933904 --- /dev/null +++ b/.github/workflows/backend-pr-ci.yml @@ -0,0 +1,101 @@ +name: backend-pr-ci + +on: + pull_request: + paths: + - "backend/**" + - ".github/workflows/backend-pr-ci.yml" + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: backend-pr-ci-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +env: + GO_VERSION: "1.24" + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + timeout-minutes: 10 + + defaults: + run: + working-directory: backend + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: ${{ env.GO_VERSION }} + cache-dependency-path: backend/go.sum + + - name: Install golangci-lint + run: go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest + + - name: Run golangci-lint + run: golangci-lint run --timeout=5m + + build: + name: Build + runs-on: ubuntu-latest + timeout-minutes: 10 + + defaults: + run: + working-directory: backend + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: ${{ env.GO_VERSION }} + cache-dependency-path: backend/go.sum + + - name: Build WASM + run: GOOS=wasip1 GOARCH=wasm go build -buildmode=c-shared -o webhook.wasm . + + test: + name: Tests + runs-on: ubuntu-latest + timeout-minutes: 15 + + defaults: + run: + working-directory: backend + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: ${{ env.GO_VERSION }} + cache-dependency-path: backend/go.sum + + - name: Run tests (race detector) + run: go test -race -timeout 60s -coverprofile=coverage.out $(go list ./...) + + - name: Upload coverage report + uses: actions/upload-artifact@v4 + with: + name: coverage-report + path: backend/coverage.out + retention-days: 7 diff --git a/.github/workflows/frontend-pr-ci.yml b/.github/workflows/frontend-pr-ci.yml new file mode 100644 index 0000000..8798bad --- /dev/null +++ b/.github/workflows/frontend-pr-ci.yml @@ -0,0 +1,53 @@ +name: frontend-pr-ci + +on: + pull_request: + paths: + - "frontend/**" + - ".github/workflows/frontend-pr-ci.yml" + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: frontend-pr-ci-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + web-quality: + name: Typecheck and build frontend + runs-on: ubuntu-latest + timeout-minutes: 20 + + defaults: + run: + working-directory: frontend + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Setup Bun + uses: oven-sh/setup-bun@v2 + with: + bun-version: "1.2.23" + + - name: Cache Bun packages + uses: actions/cache@v4 + with: + path: ~/.bun/install/cache + key: ${{ runner.os }}-bun-${{ hashFiles('frontend/bun.lock') }} + restore-keys: | + ${{ runner.os }}-bun- + + - name: Install dependencies + run: bun install --frozen-lockfile + + - name: Typecheck + run: bun run typecheck + + - name: Build production bundle + run: bun run build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..2b12767 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,80 @@ +name: Build and Release Plugin Assets + +on: + push: + tags: + - "v*" + workflow_dispatch: + +permissions: + contents: write + +jobs: + build-and-release: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: "1.24" + + - name: Setup Bun + uses: oven-sh/setup-bun@v2 + with: + bun-version: latest + + - name: Build backend WASM + working-directory: backend + run: | + set -euo pipefail + mkdir -p ../release/backend + GOOS=wasip1 GOARCH=wasm go build -buildmode=c-shared -o ../release/backend/webhook.wasm . + + - name: Build frontend + working-directory: frontend + run: | + set -euo pipefail + bun install --frozen-lockfile + bun run build + + - name: Collect release files + run: | + set -euo pipefail + mkdir -p release/frontend + cp -R frontend/dist release/frontend/dist + + mkdir -p release/migrations + cp -R backend/migrations/. release/migrations/ + + cp plugin.json release/plugin.json + + - name: Create archives + run: | + set -euo pipefail + tar -czf webhook-backend-wasm.tar.gz -C release/backend webhook.wasm + tar -czf webhook-frontend-dist.tar.gz -C release/frontend dist + tar -czf webhook-migrations.tar.gz -C release migrations + tar -czf webhook-plugin-manifest.tar.gz -C release plugin.json + + - name: Generate checksums + run: | + set -euo pipefail + sha256sum webhook-backend-wasm.tar.gz \ + webhook-frontend-dist.tar.gz \ + webhook-migrations.tar.gz \ + webhook-plugin-manifest.tar.gz > checksums.txt + + - name: Publish GitHub Release assets + uses: softprops/action-gh-release@v2 + with: + generate_release_notes: true + files: | + webhook-backend-wasm.tar.gz + webhook-frontend-dist.tar.gz + webhook-migrations.tar.gz + webhook-plugin-manifest.tar.gz + checksums.txt