From 0a783a27b001fa36789d6d41b007094e3b809537 Mon Sep 17 00:00:00 2001 From: Louis Parkin Date: Fri, 10 Jul 2026 09:43:08 +0200 Subject: [PATCH] STAC-25142 Port CI to GitHub Actions (lint + test) Migrate the .gitlab-ci.yml lint+test pipeline to GitHub Actions as part of the GitLab -> GitHub migration. Public Go library with no secrets/registry needs, so it runs on GitHub-hosted ubuntu-latest with actions/setup-go (Go from go.mod): - lint: gofmt check (fails on unformatted files) + revive (pinned v1.15.0) with the existing revive-recommended.toml - test: go test -v ./... SHA-pinned actions, minimal permissions, persist-credentials: false. Zizmor clean. Co-Authored-By: Claude Opus 4.8 --- .github/workflows/ci.yml | 57 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..471dc6c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,57 @@ +name: CI + +# Ported from .gitlab-ci.yml (lint + test) as part of the GitLab -> GitHub +# migration (STAC-25142). Public Go library, no secrets/registry needed, so it +# runs on GitHub-hosted runners with actions/setup-go (Go version from go.mod). + +on: + pull_request: + push: + branches: [master] + +permissions: + contents: read + +jobs: + lint: + name: Lint (gofmt + revive) + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + + - name: Set up Go + uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 + with: + go-version-file: go.mod + + - name: Check gofmt + run: | + unformatted="$(gofmt -l .)" + if [ -n "$unformatted" ]; then + echo "The following files are not gofmt-formatted:" + echo "$unformatted" + exit 1 + fi + + - name: revive + run: go run github.com/mgechev/revive@v1.15.0 -formatter stylish -config revive-recommended.toml ./... + + test: + name: Test (go test) + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + + - name: Set up Go + uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 + with: + go-version-file: go.mod + + - name: go test + run: go test -v ./...