Skip to content

feat: add cross-platform installers with shell integration (#32) #191

feat: add cross-platform installers with shell integration (#32)

feat: add cross-platform installers with shell integration (#32) #191

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
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: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
cache: true
- name: Verify dependencies
run: go mod verify
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v4
with:
version: latest
test:
name: Unit Tests
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: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
cache: true
- name: Run unit tests
run: go test -short -v -race -coverprofile=coverage.out ./...
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: timvw/wt
files: ./coverage.out
fail_ci_if_error: false
build:
name: Build and Cross-Compile
runs-on: ubuntu-latest
needs: [lint, test]
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: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
cache: true
- 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
# Unified E2E tests using YAML scenarios
e2e:
name: E2E (${{ matrix.os }}, ${{ matrix.shell }})
runs-on: ${{ matrix.runner }}
needs: build
strategy:
fail-fast: false
matrix:
include:
# Linux
- os: linux
runner: ubuntu-latest
shell: bash
binary: wt-linux-amd64
- os: linux
runner: ubuntu-latest
shell: zsh
binary: wt-linux-amd64
# macOS
- os: macos
runner: macos-latest
shell: bash
binary: wt-darwin-arm64
- os: macos
runner: macos-latest
shell: zsh
binary: wt-darwin-arm64
# Windows
- os: windows
runner: windows-latest
shell: powershell
binary: wt-windows-amd64
- os: windows
runner: windows-latest
shell: pwsh
binary: wt-windows-amd64
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: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
cache: true
- name: Install zsh (Linux)
if: matrix.os == 'linux' && matrix.shell == 'zsh'
run: |
sudo apt-get update
sudo apt-get install -y zsh
- name: Download binary
uses: actions/download-artifact@v4
with:
name: ${{ matrix.binary }}
path: bin
- name: Prepare binary (Unix)
if: matrix.os != 'windows'
run: |
mv bin/${{ matrix.binary }} bin/wt
chmod +x bin/wt
./bin/wt --help
- name: Prepare binary (Windows)
if: matrix.os == 'windows'
run: |
mv bin/${{ matrix.binary }}.exe bin/wt.exe
./bin/wt.exe --help
- name: Run E2E tests
if: matrix.os != 'windows'
run: |
go run e2e/run.go --wt=bin/wt --shells=${{ matrix.shell }}
- name: Run E2E tests (Windows)
if: matrix.os == 'windows'
shell: pwsh
run: |
go run e2e/run.go --wt=bin/wt.exe --shells=${{ matrix.shell }}