diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1e8ae79..39b9ef9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -96,11 +96,36 @@ jobs: run: | if grep -n "Disabling" test.log; then exit 1; fi + apidiff: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v7 + with: + fetch-depth: 0 + - uses: actions/setup-go@v7 + with: + go-version: stable + - name: Export the v1.4.0 API under the fork's module path + # The export is written and read in this same job, with one toolchain, + # because export data is bound to the Go version that produced it. + run: | + git worktree add "${{ runner.temp }}/v1.4.0" v1.4.0 + cd "${{ runner.temp }}/v1.4.0" + sed -i 's#github.com/jmoiron/sqlx#github.com/secondwindoss/sqlx#g' go.mod $(git ls-files '*.go') + go run golang.org/x/exp/cmd/apidiff@v0.0.0-20261009195045-ca0d7ba23607 -m -w "${{ runner.temp }}/v1.4.0.export" github.com/secondwindoss/sqlx + - name: Fail on any incompatible change since v1.4.0 + run: | + out="$(go run golang.org/x/exp/cmd/apidiff@v0.0.0-20261009195045-ca0d7ba23607 -m -incompatible "${{ runner.temp }}/v1.4.0.export" github.com/secondwindoss/sqlx)" + if [ -n "$out" ]; then echo "$out"; exit 1; fi + go run golang.org/x/exp/cmd/apidiff@v0.0.0-20261009195045-ca0d7ba23607 -m "${{ runner.temp }}/v1.4.0.export" github.com/secondwindoss/sqlx + ci-ok: if: always() needs: - lint - test + - apidiff runs-on: ubuntu-latest steps: - name: Check required jobs