diff --git a/.github/workflows/ci.yml b/.github/workflows/ci-cd.yml similarity index 95% rename from .github/workflows/ci.yml rename to .github/workflows/ci-cd.yml index 9e72e89..f5b7368 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci-cd.yml @@ -46,7 +46,7 @@ jobs: format: name: Auto-format with gofmt (Linux only) runs-on: ubuntu-latest - if: github.event_name == 'push' + if: github.event_name == 'push' && github.actor != 'github-actions[bot]' permissions: contents: write diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml new file mode 100644 index 0000000..c439067 --- /dev/null +++ b/.github/workflows/pages.yml @@ -0,0 +1,40 @@ +name: Deploy GitHub Pages + +on: + push: + branches: + - main + paths: + - 'docs/**' + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Pages + uses: actions/configure-pages@v4 + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: './docs' + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 031f668..934ab5b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,43 +1,103 @@ -name: Release on merge of versioned branch into main +name: Release on Git Tag on: - pull_request: - types: [closed] - branches: - - main + push: + tags: + - 'v*' jobs: release: - if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'v') runs-on: ubuntu-latest + permissions: + contents: write + strategy: + matrix: + goos: [linux, darwin, windows] + goarch: [amd64, arm64] + exclude: + - goos: windows + goarch: arm64 steps: - name: Checkout code uses: actions/checkout@v4 - - name: Extract version from branch name - run: echo "VERSION=${GITHUB_HEAD_REF}" >> $GITHUB_ENV + - name: Extract version from tag + run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV - name: Set up Go uses: actions/setup-go@v5 with: go-version: '1.24.4' - - name: Build with version - run: go build -ldflags "-X main.Version=${VERSION}" -o req - - - name: Tag main with version + - name: Build binary for ${{ matrix.goos }}-${{ matrix.goarch }} + env: + GOOS: ${{ matrix.goos }} + GOARCH: ${{ matrix.goarch }} run: | - git config user.name "github-actions" - git config user.email "github-actions@github.com" - git fetch --unshallow --tags - git tag "${VERSION}" - git push origin "${VERSION}" + BINARY_NAME="req-${{ env.VERSION }}-${{ matrix.goos }}-${{ matrix.goarch }}" + if [ "${{ matrix.goos }}" = "windows" ]; then + BINARY_NAME="${BINARY_NAME}.exe" + fi + go build -ldflags "-X main.Version=${{ env.VERSION }}" -o "${BINARY_NAME}" . + echo "BINARY_NAME=${BINARY_NAME}" >> $GITHUB_ENV + + - name: Upload binary as artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ env.BINARY_NAME }} + path: ${{ env.BINARY_NAME }} + + create-release: + needs: release + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - name: Extract version from tag + run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV + + - name: Download all artifacts + uses: actions/download-artifact@v4 + with: + path: ./binaries - name: Create GitHub Release uses: softprops/action-gh-release@v2 with: tag_name: ${{ env.VERSION }} - files: req + name: "Req ${{ env.VERSION }}" + body: | + A terminal-based API client built for the Boot.dev Hackathon 2025. + + **Installation:** + ```bash + go install github.com/maniac-en/req@${{ env.VERSION }} + ``` + + **Prebuilt binaries:** + - Linux: `req-${{ env.VERSION }}-linux-amd64`, `req-${{ env.VERSION }}-linux-arm64` + - macOS: `req-${{ env.VERSION }}-darwin-amd64`, `req-${{ env.VERSION }}-darwin-arm64` + - Windows: `req-${{ env.VERSION }}-windows-amd64.exe` + + **Usage:** Run `req` in your terminal + + **Breaking Changes:** + Database schema has been updated. Please remove your existing database: + ```bash + # Linux/macOS + rm ~/.cache/req/app.db + + # Windows + del %LOCALAPPDATA%\req\app.db + ``` + + **Note:** This is early development software. Core HTTP execution features are still in progress. + + Full changelog: https://github.com/maniac-en/req/commits/${{ env.VERSION }} + files: ./binaries/**/* + draft: false + prerelease: ${{ contains(env.VERSION, '-') }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..25d8867 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,78 @@ +# Contributing to Req + +## Release Process + +To create a new release: + +1. Ensure changes are merged to `main` +2. Create and push a Git tag: + ```bash + git tag v0.1.0-alpha.2 + git push origin v0.1.0-alpha.2 + ``` +3. GitHub Actions automatically builds and creates the release + +For detailed release information, see [RELEASE.md](RELEASE.md). + +## GitHub Actions Workflows + +### CI/CD Pipeline (`.github/workflows/ci-cd.yml`) +Triggers: Push to `main`, Pull requests to `main` + +Jobs: +- build-test: Cross-platform testing (Ubuntu/macOS/Windows) + - Builds project and runs tests with coverage +- format: Auto-formats Go code with `gofmt` + - Commits formatting changes automatically + - Skips if author is `github-actions[bot]` to prevent cascading + +### Release Pipeline (`.github/workflows/release.yml`) +Triggers: Git tag push matching `v*` pattern + +Jobs: +- release: Builds binaries for Linux/macOS/Windows (amd64/arm64) +- create-release: Creates GitHub release with binaries and release notes + +## Development Workflow + +### Building and Testing +```bash +# Build for development +go build -o ./tmp/req . + +# Run tests with coverage +go test -coverprofile=coverage.out ./... +go tool cover -func=coverage.out + +# Format code (or let CI handle it) +go fmt ./... +``` + +### Database Changes +```bash +# Create new migration +goose -dir db/migrations create migration_name sql + +# Generate SQLC code after modifying queries +sqlc generate +``` + +### Installation Methods +After release, users can install via: +```bash +# Latest stable release +go install github.com/maniac-en/req@latest + +# Specific version +go install github.com/maniac-en/req@v0.1.0-alpha.2 +``` + +## Branch Strategy +- main: Primary development branch +- Feature branches: Create for new work, merge via PRs +- Releases: Use Git tags, not version branches + +## Troubleshooting +- CI formatting failures: Auto-fixed by format job +- Release not triggering: Ensure Git tag starts with `v` +- GitHub Pages builds: Expected to be cancelled (we use Git tags for distribution) \ No newline at end of file diff --git a/README.md b/README.md index 7daae7e..7329acc 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Req - Test APIs with Terminal Velocity -[![tests](https://github.com/maniac-en/req/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/maniac-en/req/actions/workflows/go.yml) +[![tests](https://github.com/maniac-en/req/actions/workflows/ci-cd.yml/badge.svg?branch=main)](https://github.com/maniac-en/req/actions/workflows/ci-cd.yml) ![GitHub repo](https://img.shields.io/badge/built%20at-Boot.dev%20Hackathon-blueviolet) ## About @@ -16,15 +16,15 @@ Read more about `req` over here - ## Installation -### You can install `req` using `go install`: +Install `req` using `go install`: -To install a specific release - -``` +```bash +# Install the latest stable release go install github.com/maniac-en/req@latest -``` -Replace `latest` with the specific version you want. +# Or install a specific version (e.g., v0.1.0) +go install github.com/maniac-en/req@v0.1.0 +``` ### Requirements diff --git a/RELEASE.md b/RELEASE.md new file mode 100644 index 0000000..463d033 --- /dev/null +++ b/RELEASE.md @@ -0,0 +1,164 @@ +# Release Process + +This document details the complete release process for the Req project. + +## Release Stages + +### Alpha (α) +- Very early development +- Core functionality incomplete +- For internal testing or early adopters +- Format: `v0.1.0-alpha.1`, `v0.1.0-alpha.2` + +### Beta (β) +- Core functionality mostly complete +- Feature-complete but may have bugs +- Ready for broader testing +- Format: `v0.1.0-beta.1`, `v0.1.0-beta.2` + +### Release Candidate (RC) +- Nearly ready for release +- All features complete, major bugs fixed +- Final testing phase +- Format: `v0.1.0-rc.1`, `v0.1.0-rc.2` + +### Stable Release +- Production ready +- All major features work +- Thoroughly tested +- Format: `v0.1.0`, `v0.2.0` + +## Current Project Stage + +**Status**: Alpha stage (`v0.1.0-alpha.x`) + +**Why Alpha**: Core HTTP execution features are still in development. The project has working TUI components and backend infrastructure, but is not feature-complete. + +**Move to Beta when**: Core HTTP execution works, request/response viewer is functional, all major features are implemented. + +## Release Workflow + +### 1. Development Phase +- Work on feature branches +- Create pull requests to `main` +- Ensure CI/CD passes (build, test, format) + +### 2. Pre-Release Checklist +Before creating a release, ensure: +- [ ] All intended features/fixes are merged to `main` +- [ ] CI/CD pipeline passes on `main` +- [ ] Manual testing completed +- [ ] Documentation updated if needed + +### 3. Creating a Release + +**Step 1**: Ensure you're on the latest `main` +```bash +git checkout main +git pull origin main +``` + +**Step 2**: Verify everything works +```bash +go build . +go test ./... +``` + +**Step 3**: Create and push the tag +```bash +# For next alpha release +git tag v0.1.0-alpha.2 +git push origin v0.1.0-alpha.2 +``` + +**Step 4**: GitHub Actions automatically: +- Builds binaries for Linux, macOS, Windows (amd64/arm64) +- Creates GitHub release with release notes +- Uploads all platform binaries + +### 4. Version Numbering + +**Alpha/Beta/RC increments:** +- `v0.1.0-alpha.1` → `v0.1.0-alpha.2` (bug fixes, small features) +- `v0.1.0-alpha.5` → `v0.1.0-beta.1` (feature complete) +- `v0.1.0-beta.3` → `v0.1.0-rc.1` (release candidate) +- `v0.1.0-rc.2` → `v0.1.0` (stable release) + +**Minor/Major version bumps:** +- `v0.1.0` → `v0.2.0` (new features, backward compatible) +- `v0.9.0` → `v1.0.0` (major release, breaking changes) + +## Automated Release Process + +### Multi-Platform Builds +The release workflow automatically builds: +- `req-v0.1.0-alpha.2-linux-amd64` +- `req-v0.1.0-alpha.2-linux-arm64` +- `req-v0.1.0-alpha.2-darwin-amd64` +- `req-v0.1.0-alpha.2-darwin-arm64` +- `req-v0.1.0-alpha.2-windows-amd64.exe` + +### Release Notes +Automatically generated with: +- Project description +- Installation instructions (`go install` and binary downloads) +- Usage information +- Development stage disclaimer +- Link to full changelog + +### Prerelease Detection +Versions containing hyphens (alpha, beta, rc) are automatically marked as prereleases on GitHub. + +## Manual Release Steps (if needed) + +If automation fails, manual release process: + +1. **Build binaries manually:** +```bash +# Linux amd64 +GOOS=linux GOARCH=amd64 go build -ldflags "-X main.Version=v0.1.0-alpha.2" -o req-v0.1.0-alpha.2-linux-amd64 + +# macOS arm64 +GOOS=darwin GOARCH=arm64 go build -ldflags "-X main.Version=v0.1.0-alpha.2" -o req-v0.1.0-alpha.2-darwin-arm64 + +# Windows amd64 +GOOS=windows GOARCH=amd64 go build -ldflags "-X main.Version=v0.1.0-alpha.2" -o req-v0.1.0-alpha.2-windows-amd64.exe +``` + +2. **Create GitHub release manually** via web interface + +## Release Schedule + +No fixed schedule. Releases are created when: +- Significant features are complete +- Important bug fixes are ready +- Milestone requirements are met + +For hackathon timeline, aim for `v0.1.0-alpha.x` releases as features are completed. + +## Rollback Process + +If a release has critical issues: + +1. **Do not delete the tag** (breaks `go install`) +2. **Create a new release** with fixes: `v0.1.0-alpha.3` +3. **Mark problematic release** as prerelease if not already +4. **Update documentation** to point to newer version + +## Testing Releases + +After creating a release: + +```bash +# Test go install works +go install github.com/maniac-en/req@v0.1.0-alpha.2 + +# Test binary works +req --version # Should show: req v0.1.0-alpha.2 +``` + +## Communication + +- Release announcements in project README +- Update docs/index.html with latest version +- Consider blog post for major releases \ No newline at end of file diff --git a/db/migrations/001_create_collections_table.sql b/db/migrations/20250729120000_create_collections_table.sql similarity index 100% rename from db/migrations/001_create_collections_table.sql rename to db/migrations/20250729120000_create_collections_table.sql diff --git a/db/migrations/002_create_endpoints_table.sql b/db/migrations/20250729120001_create_endpoints_table.sql similarity index 100% rename from db/migrations/002_create_endpoints_table.sql rename to db/migrations/20250729120001_create_endpoints_table.sql diff --git a/db/migrations/003_add_updated_at_trigger.sql b/db/migrations/20250729120002_add_updated_at_trigger.sql similarity index 100% rename from db/migrations/003_add_updated_at_trigger.sql rename to db/migrations/20250729120002_add_updated_at_trigger.sql diff --git a/db/migrations/004_add_collections_name_index.sql b/db/migrations/20250729120003_add_collections_name_index.sql similarity index 100% rename from db/migrations/004_add_collections_name_index.sql rename to db/migrations/20250729120003_add_collections_name_index.sql diff --git a/db/migrations/005_create_history_table.sql b/db/migrations/20250729120004_create_history_table.sql similarity index 100% rename from db/migrations/005_create_history_table.sql rename to db/migrations/20250729120004_create_history_table.sql diff --git a/docs/index.html b/docs/index.html index 7e8be99..9c439a2 100644 --- a/docs/index.html +++ b/docs/index.html @@ -34,8 +34,14 @@

Tech Stack

Installation

bash
-                go install github.com/maniac-en/req@latest
-                req
+# Install the latest stable release
+go install github.com/maniac-en/req@latest
+
+# Or install a specific version (e.g., v0.1.0)
+go install github.com/maniac-en/req@v0.1.0
+
+# Run the application
+req
             

What's Implemented

Try It Out

GitHub: https://github.com/maniac-en/req
- Installation: go install github.com/maniac-en/req@latest
+ Installation: go install github.com/maniac-en/req@latest or go install github.com/maniac-en/req@v0.1.0
Usage: Just run req in your terminal!

The app works completely offline with no external dependencies required.