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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml → .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -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
96 changes: 78 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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 }}
78 changes: 78 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -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)
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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

Expand Down
Loading
Loading