Skip to content
12 changes: 8 additions & 4 deletions .github/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,15 @@ branches:
required_status_checks:
strict: true
contexts:
- "Test (1.24)"
- "Test (1.25)"
- "Build"
- "Lint"
- "Cross Compile"
- "Unit Tests"
- "Build and Cross-Compile"
- "E2E Tests (macOS) (bash)"
- "E2E Tests (macOS) (zsh)"
- "E2E Tests (Linux) (bash)"
- "E2E Tests (Linux) (zsh)"
- "E2E Tests (Windows) (powershell)"
- "E2E Tests (Windows) (pwsh)"

enforce_admins: false

Expand Down
172 changes: 78 additions & 94 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,9 @@ on:
workflow_dispatch:

jobs:
test:
name: Test
lint:
name: Lint
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ['1.24', '1.25']

steps:
- name: Generate GitHub App token
Expand All @@ -32,36 +29,19 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}

- name: Download dependencies
run: go mod download
go-version: '1.25'
cache: true

- name: Verify dependencies
run: go mod verify

- name: Install shells for PTY tests
run: |
sudo apt-get update
sudo apt-get install -y bash zsh
# Fix zsh permissions to avoid compinit security warnings
sudo chmod -R 755 /usr/share/zsh
sudo chown -R root:root /usr/share/zsh

- name: Run tests
run: go test -v -race -coverprofile=coverage.out ./...

- name: Upload coverage to Codecov
if: matrix.go-version == '1.25'
uses: codecov/codecov-action@v5
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: timvw/wt
files: ./coverage.out
fail_ci_if_error: false
version: latest

build:
name: Build
test:
name: Unit Tests
runs-on: ubuntu-latest

steps:
Expand All @@ -82,51 +62,23 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: '1.25'
cache: true

- name: Build
run: go build -v ./...

- name: Build binary
run: |
mkdir -p bin
go build -o bin/wt .

- name: Verify binary
run: |
./bin/wt --help
file bin/wt

lint:
name: Lint
runs-on: ubuntu-latest

steps:
- name: Generate GitHub App token
id: generate-token
continue-on-error: true
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.BOT_APP_ID }}
private-key: ${{ secrets.BOT_PRIVATE_KEY }}

- name: Checkout code
uses: actions/checkout@v4
with:
token: ${{ steps.generate-token.outputs.token || github.token }}
- name: Run unit tests
run: go test -short -v -race -coverprofile=coverage.out ./...

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'

- name: Run golangci-lint
uses: golangci/golangci-lint-action@v4
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
version: latest
token: ${{ secrets.CODECOV_TOKEN }}
slug: timvw/wt
files: ./coverage.out
fail_ci_if_error: false

cross-compile:
name: Cross Compile
build:
name: Build and Cross-Compile
runs-on: ubuntu-latest
needs: [lint, test]

steps:
- name: Generate GitHub App token
Expand All @@ -146,23 +98,51 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: '1.25'
cache: true

- name: Cross compile
- name: Build for all platforms
run: |
mkdir -p bin
# Native build
go build -o bin/wt .
# Cross-compile for all supported platforms
GOOS=linux GOARCH=amd64 go build -o bin/wt-linux-amd64 .
GOOS=linux GOARCH=arm64 go build -o bin/wt-linux-arm64 .
GOOS=darwin GOARCH=amd64 go build -o bin/wt-darwin-amd64 .
GOOS=darwin GOARCH=arm64 go build -o bin/wt-darwin-arm64 .
GOOS=windows GOARCH=amd64 go build -o bin/wt-windows-amd64.exe .

- name: Verify binaries
run: |
./bin/wt --help
ls -lh bin/
file bin/*

- name: Upload Linux binary
uses: actions/upload-artifact@v4
with:
name: wt-linux-amd64
path: bin/wt-linux-amd64
retention-days: 1

- name: Upload macOS ARM64 binary
uses: actions/upload-artifact@v4
with:
name: wt-darwin-arm64
path: bin/wt-darwin-arm64
retention-days: 1

- name: Upload Windows binary
uses: actions/upload-artifact@v4
with:
name: wt-windows-amd64
path: bin/wt-windows-amd64.exe
retention-days: 1

e2e-macos:
name: E2E Tests (macOS)
runs-on: macos-latest
needs: build
strategy:
matrix:
shell: ['bash', 'zsh']
Expand All @@ -185,17 +165,18 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: '1.25'
cache: true

- name: Download dependencies
run: go mod download

- name: Build wt binary
run: |
mkdir -p bin
go build -o bin/wt .
- name: Download macOS binary
uses: actions/download-artifact@v4
with:
name: wt-darwin-arm64
path: bin

- name: Verify binary
- name: Prepare binary
run: |
mv bin/wt-darwin-arm64 bin/wt
chmod +x bin/wt
./bin/wt --help
file bin/wt

Expand Down Expand Up @@ -366,6 +347,7 @@ jobs:
e2e-linux:
name: E2E Tests (Linux)
runs-on: ubuntu-latest
needs: build
strategy:
fail-fast: false
matrix:
Expand All @@ -390,23 +372,24 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: '1.25'
cache: true

- name: Install zsh
if: matrix.shell == 'zsh'
run: |
sudo apt-get update
sudo apt-get install -y zsh

- name: Download dependencies
run: go mod download

- name: Build wt binary
run: |
mkdir -p bin
go build -o bin/wt .
- name: Download Linux binary
uses: actions/download-artifact@v4
with:
name: wt-linux-amd64
path: bin

- name: Verify binary
- name: Prepare binary
run: |
mv bin/wt-linux-amd64 bin/wt
chmod +x bin/wt
./bin/wt --help
file bin/wt

Expand Down Expand Up @@ -562,6 +545,7 @@ jobs:
e2e-windows:
name: E2E Tests (Windows)
runs-on: windows-latest
needs: build
strategy:
matrix:
shell: ['powershell', 'pwsh']
Expand All @@ -584,17 +568,17 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: '1.25'
cache: true

- name: Download dependencies
run: go mod download

- name: Build wt binary
run: |
mkdir -p bin
go build -o bin/wt.exe .
- name: Download Windows binary
uses: actions/download-artifact@v4
with:
name: wt-windows-amd64
path: bin

- name: Verify binary
- name: Prepare binary
run: |
mv bin/wt-windows-amd64.exe bin/wt.exe
./bin/wt.exe --help
file bin/wt.exe

Expand Down
Loading
Loading