Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
194 changes: 132 additions & 62 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ name: CI
on:
push:
branches: [ main, develop ]
paths-ignore:
- '**.md'
pull_request:
branches: [ main, develop ]
paths-ignore:
- '**.md'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -21,142 +25,208 @@ permissions:

jobs:
# ========================================
# Quality Gate
# Core: test on a Go version matrix, lint once
# ========================================
quality:
name: 🛡️ Quality Gate / ${{ matrix.module }}
core:
name: 🧪 Core / Go ${{ matrix.go-version }}
runs-on: ubuntu-latest
timeout-minutes: 10
timeout-minutes: 15

strategy:
fail-fast: false
matrix:
module:
- .
- adapter/chiopenapi
- adapter/echoopenapi
- adapter/echov5openapi
- adapter/fiberopenapi
- adapter/fiberv3openapi
- adapter/ginopenapi
- adapter/httpopenapi
- adapter/irisopenapi
- adapter/muxopenapi
go-version: ['1.22', '1.23', '1.24', '1.25', '1.26']

env:
# Test the core module on its own so the matrix Go version is really used
# (the root go.work requires the newest Go and would switch the toolchain).
GOWORK: 'off'
GOTOOLCHAIN: local

steps:
- name: 📥 Checkout
uses: actions/checkout@v4
uses: actions/checkout@v7

- name: 🐹 Setup Go
uses: actions/setup-go@v5
uses: actions/setup-go@v7
with:
go-version: '1.25.x'
go-version: ${{ matrix.go-version }}
check-latest: true
cache: true

- name: ✅ Sync & Tidy
run: make sync tidy

- name: 🔍 Lint
if: matrix.go-version == '1.26'
uses: golangci/golangci-lint-action@v9
with:
version: v2.12.2
working-directory: ${{ matrix.module }}
version: v2.15.0

- name: 🧪 Run Tests
if: matrix.go-version != '1.26'
run: go test ./...

- name: 📊 Run Tests With Coverage
if: matrix.go-version == '1.26'
run: |
mkdir -p coverage
go test -coverprofile=coverage/core.out ./...

- name: 📈 Upload Coverage Report
if: matrix.go-version == '1.26'
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage/core.out
flags: core
fail_ci_if_error: false
verbose: true

# ========================================
# Test Matrix
# Adapters: test + lint on the Go version declared in each go.mod
# ========================================
test:
name: 🧪 Test Matrix
runs-on: ${{ matrix.os }}
adapter:
name: 🔌 Adapter / ${{ matrix.adapter }}
runs-on: ubuntu-latest
timeout-minutes: 15
needs: quality

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
go-version: ['1.23', '1.24', '1.25']
adapter:
- chiopenapi
- echoopenapi
- echov5openapi
- fiberopenapi
- fiberv3openapi
- ginopenapi
- httpopenapi
- irisopenapi
- muxopenapi

env:
GOTOOLCHAIN: local

steps:
- name: 📥 Checkout
uses: actions/checkout@v4
uses: actions/checkout@v7

- name: 🐹 Setup Go
uses: actions/setup-go@v5
- name: 🐹 Setup Go (version from adapter go.mod)
uses: actions/setup-go@v7
with:
go-version: ${{ matrix.go-version }}
go-version-file: adapter/${{ matrix.adapter }}/go.mod
check-latest: true
cache: true # Handles module/build cache
cache: true
cache-dependency-path: |
go.sum
adapter/${{ matrix.adapter }}/go.sum

# The root go.work targets the newest Go, which would override the toolchain
# chosen above. Use a throwaway workspace with only the core and this adapter
# so the adapter is built against the local core at its own Go version.
- name: 🔗 Create workspace
run: |
export GOWORK="$RUNNER_TEMP/go.work"
go work init . ./adapter/${{ matrix.adapter }}
echo "GOWORK=$GOWORK" >> "$GITHUB_ENV"

- name: 🧪 Run Tests
if: matrix.go-version != '1.25'
run: make test
- name: 🔍 Lint
uses: golangci/golangci-lint-action@v9
with:
version: v2.15.0
working-directory: adapter/${{ matrix.adapter }}

- name: 📊 Run Tests With Coverage
if: matrix.go-version == '1.25'
run: make testcov
- name: 🧪 Run Tests
working-directory: adapter/${{ matrix.adapter }}
run: |
mkdir -p "$GITHUB_WORKSPACE/coverage"
go test -coverprofile="$GITHUB_WORKSPACE/coverage/${{ matrix.adapter }}.out" ./...

- name: 📈 Upload Coverage Report
if: matrix.go-version == '1.25'
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage/coverage.out
files: coverage/${{ matrix.adapter }}.out
flags: ${{ matrix.adapter }}
fail_ci_if_error: false
verbose: true

# ========================================
# Security Scan
# Security: gosec + govulncheck for core and every adapter
# ========================================
security:
name: 🔐 Security Scan
name: 🔐 Security / ${{ matrix.name }}
runs-on: ubuntu-latest
timeout-minutes: 10
needs: quality

strategy:
fail-fast: false
matrix:
include:
- { name: core, dir: . }
- { name: chiopenapi, dir: adapter/chiopenapi }
- { name: echoopenapi, dir: adapter/echoopenapi }
- { name: echov5openapi, dir: adapter/echov5openapi }
- { name: fiberopenapi, dir: adapter/fiberopenapi }
- { name: fiberv3openapi, dir: adapter/fiberv3openapi }
- { name: ginopenapi, dir: adapter/ginopenapi }
- { name: httpopenapi, dir: adapter/httpopenapi }
- { name: irisopenapi, dir: adapter/irisopenapi }
- { name: muxopenapi, dir: adapter/muxopenapi }

env:
GO111MODULE: on
# Scan each module as published (against the core version in its go.mod).
GOWORK: 'off'

steps:
- name: 📥 Checkout
uses: actions/checkout@v4
uses: actions/checkout@v7

- name: 🐹 Setup Go
uses: actions/setup-go@v5
uses: actions/setup-go@v7
with:
go-version: '1.25.x'
go-version: '1.26.x'
check-latest: true
cache: true

- name: Run Gosec Security Scanner
uses: securego/gosec@v2.26.1
with:
args: '-no-fail -fmt sarif -out results.sarif ./...'

- name: Upload SARIF to GitHub
cache-dependency-path: ${{ matrix.dir }}/go.sum

# Some advisories have no upstream fix yet (e.g. echo v4), so this reports
# without blocking; Dependabot tracks the fixes.
- name: 🛡️ Run Govulncheck
continue-on-error: true
working-directory: ${{ matrix.dir }}
run: go run golang.org/x/vuln/cmd/govulncheck@v1.10.0 ./...

- name: 🔐 Run Gosec Security Scanner
working-directory: ${{ matrix.dir }}
run: >
go run github.com/securego/gosec/v2/cmd/gosec@v2.26.1
-no-fail -fmt sarif -out "$GITHUB_WORKSPACE/results-${{ matrix.name }}.sarif" ./...

- name: 📤 Upload SARIF to GitHub
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
uses: github/codeql-action/upload-sarif@v4
with:
sarif_file: results.sarif
sarif_file: results-${{ matrix.name }}.sarif
category: gosec-${{ matrix.name }}

# ========================================
# Final Status Check
# ========================================
ci-success:
name: ✅ CI Success
runs-on: ubuntu-latest
needs: [quality, test, security]
needs: [core, adapter, security]
if: always()

steps:
- name: Check all jobs status
run: |
if [[ "${{ needs.quality.result }}" != "success" ]]; then
echo "Quality gate failed"
if [[ "${{ needs.core.result }}" != "success" ]]; then
echo "Core tests or lint failed"
exit 1
fi
if [[ "${{ needs.test.result }}" != "success" ]]; then
echo "Tests failed"
if [[ "${{ needs.adapter.result }}" != "success" ]]; then
echo "Adapter tests or lint failed"
exit 1
fi
if [[ "${{ needs.security.result }}" != "success" ]]; then
Expand Down
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ linters:
# Default: [ switch ]
check:
- switch
- map
- mapliteral

exhaustruct:
# List of regular expressions to match type names that should be excluded from processing.
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Security
- Updated adapter framework dependencies to patched versions for open Dependabot alerts: `go-chi/chi/v5` v5.5.0, `labstack/echo/v4` v4.16.6, `labstack/echo/v5` v5.4.7.

### Changed
- `echoopenapi`, `fiberv3openapi` and `irisopenapi` now require Go 1.26 (echo v4 >= 4.16.1 for the security fix; fiber v3 >= 3.6 and iris >= 12.2.12); `chiopenapi` now requires Go 1.24. The workspace `go.work` and CI use Go 1.26.
- Updated `gofiber/fiber/v2` to v2.52.16.
- Updated `golang.org/x/net` to v0.60.0 in `ginopenapi` (now requires Go 1.26) and `brotli` v1.2.7 / `klauspost/compress` v1.20.2 in `fiberopenapi` to fix `govulncheck` findings.
- Updated `gofiber/fiber/v3` to v3.7.0 and `kataras/iris/v12` to v12.2.12 (both now require Go 1.26). `gin` and `gorilla/mux` were already on the latest release.
- Updated golangci-lint to v2.15.0 (v2.12.2 cannot analyze Go 1.26 code).
- CI: added per-module `govulncheck` (non-blocking) and `gosec` scans for core and every adapter, and a `codecov.yml` that waits for all coverage uploads. Core tests now also run on Go 1.22 (the `go.mod` minimum).
- CI: core tests run on a Go version matrix; each adapter job runs tests and lint together on the Go version declared in its `go.mod` (using a throwaway workspace of the core and that adapter), and uploads per-module coverage.
- CI: updated `actions/checkout` and `actions/setup-go` to v7 (Node 24) to resolve the Node.js 20 deprecation warning.
- Updated `spec-ui` to `v0.2.2` (Swagger UI 5.34.1, Stoplight Elements 9.0.29, Scalar 1.76.4, ReDoc 3.0.1, RapiDoc 12.0.0).

### Added
Expand Down
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ go test -run TestGolden ./...
# Update golden YAML fixtures after intentional output changes
make test-update

# Lint (golangci-lint v2.12.2)
# Lint (golangci-lint v2.15.0)
make lint
make lint-fix # auto-fix

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ The pre-commit hook (via [lefthook](https://github.com/evilmartians/lefthook)) r
5. **Run the full check** locally: `make check`.
6. **Open a PR** against `main` with a clear description of what changed and why.

PRs must pass CI (quality gate + test matrix on Go 1.23–1.25) before merging.
PRs must pass CI before merging: core tests on Go 1.22–1.26 plus lint, each adapter's lint and tests on the Go version declared in its `go.mod`, and `govulncheck`/`gosec` scans.

---

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ BLUE := \033[0;34m
NC := \033[0m # No Color

# Tool versions
GOLANGCI_LINT_VERSION := v2.12.2
GOLANGCI_LINT_VERSION := v2.15.0

# Normalize VERSION input so targets accept both 1.2.3 and v1.2.3.
# Pre-release versions are also supported, e.g. 0.4.0-rc.1 or v0.4.0-rc.1.
Expand Down
4 changes: 2 additions & 2 deletions adapter/chiopenapi/example/go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module github.com/oaswrap/spec/adapter/chiopenapi/example

go 1.23
go 1.24

require (
github.com/go-chi/chi/v5 v5.3.1
github.com/go-chi/chi/v5 v5.5.0
github.com/oaswrap/spec v0.5.2
github.com/oaswrap/spec/adapter/chiopenapi v0.0.0
)
Expand Down
4 changes: 2 additions & 2 deletions adapter/chiopenapi/example/go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/go-chi/chi/v5 v5.3.1 h1:3j4HZLGZQ3JpMCrPJF/Jl3mYJfWLKBfNJ6quurUGCf8=
github.com/go-chi/chi/v5 v5.3.1/go.mod h1:R+tYY2hNuVUUjxoPtqUdgBqevM9s9njzkTLutVsOCto=
github.com/go-chi/chi/v5 v5.5.0 h1:xdKQ1dJmVJsmgahrXSKhUx8NyVPzpwdlyrrQFpMPJgg=
github.com/go-chi/chi/v5 v5.5.0/go.mod h1:d1IG7GtKPSjPyBP365PH8sAGVHk3qfB/IhjFNRH1wWM=
github.com/goccy/go-yaml v1.19.2 h1:PmFC1S6h8ljIz6gMRBopkjP1TVT7xuwrButHID66PoM=
github.com/goccy/go-yaml v1.19.2/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
Expand Down
4 changes: 2 additions & 2 deletions adapter/chiopenapi/go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module github.com/oaswrap/spec/adapter/chiopenapi

go 1.23
go 1.24

require (
github.com/go-chi/chi/v5 v5.3.1
github.com/go-chi/chi/v5 v5.5.0
github.com/oaswrap/spec v0.5.2
github.com/oaswrap/spec-ui v0.2.2
github.com/stretchr/testify v1.11.1
Expand Down
4 changes: 2 additions & 2 deletions adapter/chiopenapi/go.sum
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/go-chi/chi/v5 v5.3.1 h1:3j4HZLGZQ3JpMCrPJF/Jl3mYJfWLKBfNJ6quurUGCf8=
github.com/go-chi/chi/v5 v5.3.1/go.mod h1:R+tYY2hNuVUUjxoPtqUdgBqevM9s9njzkTLutVsOCto=
github.com/go-chi/chi/v5 v5.5.0 h1:xdKQ1dJmVJsmgahrXSKhUx8NyVPzpwdlyrrQFpMPJgg=
github.com/go-chi/chi/v5 v5.5.0/go.mod h1:d1IG7GtKPSjPyBP365PH8sAGVHk3qfB/IhjFNRH1wWM=
github.com/goccy/go-yaml v1.19.2 h1:PmFC1S6h8ljIz6gMRBopkjP1TVT7xuwrButHID66PoM=
github.com/goccy/go-yaml v1.19.2/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
Expand Down
Loading
Loading