From 848522f44a305a1853654e83e35be631b9cb8048 Mon Sep 17 00:00:00 2001 From: Dominic Evans Date: Mon, 17 Jul 2023 19:44:00 +0100 Subject: [PATCH] chore(ci): add simple apidiff workflow In order to try and prevent breaking changes to the API going forward, add a simple call to the cmd wrapper of https://pkg.go.dev/golang.org/x/exp/apidiff Signed-off-by: Dominic Evans --- .github/workflows/apidiff.yml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/apidiff.yml diff --git a/.github/workflows/apidiff.yml b/.github/workflows/apidiff.yml new file mode 100644 index 000000000..44b7bedbc --- /dev/null +++ b/.github/workflows/apidiff.yml @@ -0,0 +1,30 @@ +name: API Compatibility +on: [push, pull_request] +jobs: + apidiff: + runs-on: ubuntu-latest + if: github.base_ref + steps: + - name: Setup Go + uses: actions/setup-go@v3 + with: + go-version: 1.20.x + - name: Add GOBIN to PATH + run: echo "$(go env GOPATH)/bin" >>$GITHUB_PATH + - name: Install apidiff cmd + run: go install golang.org/x/exp/cmd/apidiff@latest + - name: Checkout base code + uses: actions/checkout@v3 + with: + ref: ${{ github.base_ref }} + path: "base" + - name: Capture apidiff baseline + run: apidiff -m -w ../baseline.bin . + working-directory: "base" + - name: Checkout updated code + uses: actions/checkout@v3 + with: + path: "updated" + - name: Run apidiff check + run: apidiff -m -incompatible ../baseline.bin . + working-directory: "updated"