Skip to content

Icon handling in dark and light modes (#93) #247

Icon handling in dark and light modes (#93)

Icon handling in dark and light modes (#93) #247

Workflow file for this run

# webapi — CI/CD
#
# Triggers:
# push to main → lint ─┬─ test ──────────────────────┐
# └─ build (amd64 ‖ arm64) ──┤→ docker → manifest
# pull_request → same gates → multi-arch push (:<branch>) → PR comment
# workflow_dispatch → same as push to main
#
# Images are pushed to quay.io/nebari/nebari-webapi
# For semver-tagged releases see .github/workflows/release.yml
name: webapi
on:
push:
branches: [main]
paths:
- cmd/**
- internal/**
- test/**
- deploy/**
- go.mod
- go.sum
- Dockerfile
- Makefile
- .github/workflows/webapi.yml
- .github/workflows/docker-image.yml
pull_request:
branches: [main]
paths:
- cmd/**
- internal/**
- test/**
- deploy/**
- go.mod
- go.sum
- Dockerfile
- Makefile
- .github/workflows/webapi.yml
- .github/workflows/docker-image.yml
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
packages: write
pull-requests: write
jobs:
# ── Lint ─────────────────────────────────────────────────────────────────
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
cache-dependency-path: go.sum
- name: Check formatting
run: |
make fmt
git diff --exit-code || (echo "Code is not formatted. Run 'make fmt'" && exit 1)
- name: Run linter
uses: golangci/golangci-lint-action@v8
with:
version: v2.5.0
# ── Unit tests ─────────────────────────────────────────────────────────────
test:
name: Test
runs-on: ubuntu-latest
needs: lint
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
cache-dependency-path: go.sum
- name: go vet
run: go vet ./...
- name: Unit tests
# -race is on so concurrency bugs (e.g. unsynchronised shared state in
# tests that spawn goroutines) fail CI instead of someone's laptop.
run: go test ./internal/... -race -count=1 -coverprofile=coverage.out
- name: Coverage summary
run: go tool cover -func=coverage.out | tail -1
- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: coverage
path: coverage.out
# ── Build binary — amd64 and arm64 in parallel ─────────────────────────────
#
# Runs in parallel with `test` (both depend only on `lint`), cutting wall-clock
# time. Each arch runs on its native runner so cross-compilation isn't needed.
build:
name: Build (${{ matrix.arch }})
runs-on: ${{ matrix.runner }}
needs: lint
strategy:
fail-fast: false
matrix:
include:
- arch: amd64
runner: ubuntu-latest
goarch: amd64
- arch: arm64
runner: ubuntu-24.04-arm
goarch: arm64
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
cache-dependency-path: go.sum
- name: Build binary (linux/${{ matrix.arch }})
run: CGO_ENABLED=0 GOOS=linux GOARCH=${{ matrix.goarch }} go build -o /tmp/webapi-${{ matrix.arch }} ./cmd
# ── Container image ───────────────────────────────────────────────────────
docker:
name: Docker image
needs: [test, build]
uses: ./.github/workflows/docker-image.yml
with:
component: webapi
registry: quay.io
image_name: nebari/nebari-webapi
context: .
dockerfile: Dockerfile
cache_scope: webapi
artifact_prefix: webapi
is_pull_request: ${{ github.event_name == 'pull_request' }}
secrets: inherit