From 3163442ce01c379b4f3cd83ef7177f5f1998f4fb Mon Sep 17 00:00:00 2001 From: Kiro Agent <244629292+kiro-agent@users.noreply.github.com> Date: Sat, 2 May 2026 23:36:48 +0000 Subject: [PATCH] Align CI/CD and release automation with pgxschema - Bump actions/checkout to v6 and actions/setup-go to v6 - Add separate Vet job to CI workflow - Update golangci-lint to v2.11.4 - Update codecov-action to v5 with env-based token - Rename coverage output to coverage.txt - Rework release workflow to extract notes from CHANGELOG.md - Add module verification step (go build + go vet) to release - Use stricter semver tag pattern for releases - Remove outdated run.go setting from .golangci.yml - Add CHANGELOG.md (converted from README version history) Co-authored-by: Aaron Longwell <27492+adlio@users.noreply.github.com> --- .github/workflows/ci.yml | 61 +++++++------ .github/workflows/release.yml | 73 +++++----------- .golangci.yml | 4 - CHANGELOG.md | 156 ++++++++++++++++++++++++++++++++++ 4 files changed, 214 insertions(+), 80 deletions(-) create mode 100644 CHANGELOG.md diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 75c83b9..567051b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,56 +6,65 @@ on: pull_request: branches: [main] -permissions: - contents: read - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - jobs: lint: name: Lint runs-on: ubuntu-latest - timeout-minutes: 10 steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 + - uses: actions/checkout@v6 + + - uses: actions/setup-go@v6 with: go-version-file: go.mod - cache-dependency-path: go.sum - - name: golangci-lint + + - name: Run golangci-lint uses: golangci/golangci-lint-action@v7 with: - version: v2.10.1 + version: v2.11.4 + args: --timeout 2m + + vet: + name: Vet + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + + - uses: actions/setup-go@v6 + with: + go-version-file: go.mod + + - name: Run go vet + run: go vet ./... build: name: Build runs-on: ubuntu-latest - timeout-minutes: 10 steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 + - uses: actions/checkout@v6 + + - uses: actions/setup-go@v6 with: go-version-file: go.mod - cache-dependency-path: go.sum - - name: Build package + + - name: Build run: go build ./... test: name: Test + Coverage runs-on: ubuntu-latest - timeout-minutes: 30 steps: - - uses: actions/checkout@v4 - - uses: actions/setup-go@v5 + - uses: actions/checkout@v6 + + - uses: actions/setup-go@v6 with: go-version-file: go.mod - cache-dependency-path: go.sum + - name: Run tests with coverage - run: go test -race -coverprofile=coverage.out -covermode=atomic ./... + run: go test -race -coverprofile=coverage.txt -covermode=atomic ./... + - name: Upload coverage to Codecov - uses: codecov/codecov-action@v4 + uses: codecov/codecov-action@v5 with: - files: coverage.out - token: ${{ secrets.CODECOV_TOKEN }} + files: coverage.txt + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3019d54..105ed9a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,79 +3,52 @@ name: Release on: push: tags: - - "v*.*.*" + - "v[0-9]+.[0-9]+.[0-9]+*" permissions: contents: write -concurrency: - group: release-${{ github.ref }} - cancel-in-progress: false - jobs: release: name: Release runs-on: ubuntu-latest - timeout-minutes: 10 steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 + - uses: actions/checkout@v6 - name: Extract version from tag id: version run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" - - name: Extract release notes from README version history - id: notes - env: - VERSION: ${{ steps.version.outputs.version }} + - name: Extract changelog + id: changelog run: | - notes=$(python3 <<'PY' - import re - from pathlib import Path - - version = __import__('os').environ['VERSION'] - readme = Path('README.md').read_text() - pattern = re.compile( - rf'^###\s+{re.escape(version)}\s+-.*?\n(.*?)(?=^###\s+|\Z)', - re.MULTILINE | re.DOTALL, - ) - match = pattern.search(readme) - if match: - print(match.group(1).strip()) - PY - ) - - if [ -n "$notes" ]; then - echo "Found release notes for v$VERSION in README.md" - else - prev_tag=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || true) - if [ -n "$prev_tag" ]; then - echo "No README entry found; generating notes from $prev_tag to $GITHUB_REF_NAME" - notes=$(git log --pretty=format:'- %s' "$prev_tag"..HEAD) - else - echo "No previous tag found; using all commits for notes" - notes=$(git log --pretty=format:'- %s') - fi - fi - + notes=$(awk '/^## \[${{ steps.version.outputs.version }}\]/{found=1; next} /^## \[/{if(found) exit} found{print}' CHANGELOG.md) { - echo "notes<> "$GITHUB_OUTPUT" - - name: Create or update GitHub release - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Create or update GitHub Release run: | - if gh release view "$GITHUB_REF_NAME" >/dev/null 2>&1; then + if gh release view "$GITHUB_REF_NAME" &>/dev/null; then + echo "Release $GITHUB_REF_NAME already exists, updating..." gh release edit "$GITHUB_REF_NAME" \ --title "$GITHUB_REF_NAME" \ - --notes "${{ steps.notes.outputs.notes }}" + --notes "${{ steps.changelog.outputs.notes }}" else gh release create "$GITHUB_REF_NAME" \ --title "$GITHUB_REF_NAME" \ - --notes "${{ steps.notes.outputs.notes }}" + --notes "${{ steps.changelog.outputs.notes }}" fi + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - uses: actions/setup-go@v6 + with: + go-version-file: go.mod + + - name: Verify module + run: | + go build ./... + go vet ./... diff --git a/.golangci.yml b/.golangci.yml index ec240b1..5277966 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,9 +1,5 @@ version: "2" -run: - go: '1.24' - timeout: 2m - linters: enable: - errcheck diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..888530d --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,156 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +## [1.5.0] - 2026-04-18 + +### Changed + +- **Breaking:** Go 1.25.5+ is now required because the Docker-based test stack now depends on `ory/dockertest/v4` +- Update Docker-based test dependencies to address security vulnerabilities by migrating to `ory/dockertest/v4` +- Finalize GitHub Actions CI/release automation and improve automated release notes extraction from README version history + +## [1.4.0] - 2026-02-21 + +### Changed + +- **Breaking:** Go 1.24+ now required (was 1.22) +- **Breaking:** MSSQL driver changed from `denisenkom/go-mssqldb` to `microsoft/go-mssqldb` +- Update all dependencies to latest versions +- Migrate CI from CircleCI to GitHub Actions +- Add automated release workflow + +### Fixed + +- Fix data race in MSSQL Unlock function + +## [1.3.9] - 2025-07-21 + +### Changed + +- Update Go version requirement to 1.21 to resolve CircleCI build issues with slices package dependency +- Update CircleCI configuration to use Go 1.21 + +## [1.3.8] - 2025-07-19 + +### Fixed + +- Update golang.org/x/crypto to v0.40.0 to address security vulnerabilities +- Update golang.org/x/net to v0.42.0 to address security vulnerabilities + +## [1.3.7] - 2025-07-19 + +### Added + +- SQL Server support for the Locker interface using sp_getapplock/sp_releaseapplock + +### Fixed + +- Fix SQL Server transaction handling for concurrent migrations + +## [1.3.4] - 2023-04-09 + +### Fixed + +- Update downstream dependencies to address vulnerabilities in test dependencies + +## [1.3.3] - 2022-06-19 + +### Fixed + +- Update downstream dependencies of ory/dockertest due to security issues + +## [1.3.0] - 2022-03-25 + +### Added + +- Basic SQL Server support (no locking, not recommended for use in clusters) + +### Changed + +- Improved support for running tests on ARM64 machines (M1 Macs) + +## [1.2.3] - 2021-12-10 + +### Fixed + +- Restore the ability to chain NewMigrator().Apply + +## [1.2.2] - 2021-12-09 + +### Added + +- Support for migrations in an embed.FS (`FSMigrations(filesystem fs.FS, glob string)`) +- MySQL/MariaDB support (experimental) +- SQLite support (experimental) + +### Changed + +- Update go.mod to `go 1.17` + +## [1.1.14] - 2021-11-18 + +### Fixed + +- Security patches in upstream dependencies + +## [1.1.13] - 2020-05-22 + +### Fixed + +- Bugfix for error with advisory lock being held open +- Improved test coverage for simultaneous execution + +## [1.1.11] - 2020-05-19 + +### Changed + +- Use a database-held lock for all migrations not just the initial table creation + +## [1.1.9] - 2020-05-17 + +### Added + +- Add the ability to attach a logger + +## [1.1.8] - 2019-11-24 + +### Changed + +- Switch to `filepath` package for improved cross-platform filesystem support + +## [1.1.7] - 2019-10-01 + +### Added + +- Use pg_advisory_lock() to prevent race conditions when multiple processes/machines try to simultaneously create the migrations table + +## [1.1.1] - 2019-09-28 + +### Added + +- First published version + +[Unreleased]: https://github.com/adlio/schema/compare/v1.5.0...HEAD +[1.5.0]: https://github.com/adlio/schema/compare/v1.4.0...v1.5.0 +[1.4.0]: https://github.com/adlio/schema/compare/v1.3.9...v1.4.0 +[1.3.9]: https://github.com/adlio/schema/compare/v1.3.8...v1.3.9 +[1.3.8]: https://github.com/adlio/schema/compare/v1.3.7...v1.3.8 +[1.3.7]: https://github.com/adlio/schema/compare/v1.3.4...v1.3.7 +[1.3.4]: https://github.com/adlio/schema/compare/v1.3.3...v1.3.4 +[1.3.3]: https://github.com/adlio/schema/compare/v1.3.0...v1.3.3 +[1.3.0]: https://github.com/adlio/schema/compare/v1.2.3...v1.3.0 +[1.2.3]: https://github.com/adlio/schema/compare/v1.2.2...v1.2.3 +[1.2.2]: https://github.com/adlio/schema/compare/v1.1.14...v1.2.2 +[1.1.14]: https://github.com/adlio/schema/compare/v1.1.13...v1.1.14 +[1.1.13]: https://github.com/adlio/schema/compare/v1.1.11...v1.1.13 +[1.1.11]: https://github.com/adlio/schema/compare/v1.1.9...v1.1.11 +[1.1.9]: https://github.com/adlio/schema/compare/v1.1.8...v1.1.9 +[1.1.8]: https://github.com/adlio/schema/compare/v1.1.7...v1.1.8 +[1.1.7]: https://github.com/adlio/schema/compare/v1.1.1...v1.1.7 +[1.1.1]: https://github.com/adlio/schema/releases/tag/v1.1.1