Skip to content

CI

CI #282

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
permissions:
contents: read
packages: write
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.26"
- name: Run tests and enforce 100% coverage
run: make coverage-check
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.26"
- run: go generate ./internal/readme/
- uses: golangci/golangci-lint-action@v9
build:
runs-on: ubuntu-latest
strategy:
matrix:
goos: [linux, darwin, windows]
goarch: [amd64, arm64]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.26"
- name: Build
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: 0
run: |
go generate ./internal/readme/
go build -o loop-${{ matrix.goos }}-${{ matrix.goarch }} ./cmd/loop
test-windows:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.26"
- name: Run Windows terminal tests
run: go test -race -count=1 -v ./internal/terminal/
ensure-test-runner:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull or build test-runner image
run: |
IMAGE=ghcr.io/radutopala/loop/test-runner
HASH=$(sha256sum scripts/test-runner.Dockerfile | cut -c1-12)
TAG="df-${HASH}"
if docker pull "${IMAGE}:${TAG}" 2>/dev/null; then
echo "Image up-to-date (${TAG})"
else
echo "Dockerfile changed or image missing, building..."
docker build -t "${IMAGE}:${TAG}" -t "${IMAGE}:latest" \
-f scripts/test-runner.Dockerfile scripts/
docker push "${IMAGE}:${TAG}"
docker push "${IMAGE}:latest"
fi
component-bdd:
needs: ensure-test-runner
runs-on: ubuntu-latest
container:
image: ghcr.io/radutopala/loop/test-runner:latest
steps:
- uses: actions/checkout@v4
- name: Run BDD component tests
run: make test-component-bdd
component-perf:
needs: ensure-test-runner
runs-on: ubuntu-latest
container:
image: ghcr.io/radutopala/loop/test-runner:latest
steps:
- uses: actions/checkout@v4
- name: Run API performance tests
run: make test-component-perf
electron-typecheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "22"
cache: npm
cache-dependency-path: app/package-lock.json
- run: cd app && npm ci
- run: cd app && npx tsc --noEmit