name: ci-pipeline on: push: branches: [ "*" ] pull_request: branches: [ "*" ] jobs: ci: runs-on: ubuntu-latest strategy: matrix: go: [ '', '1.x' ] # '' uses go.mod, 1.x uses latest go steps: - uses: actions/checkout@v2 with: path: src/sigs.k8s.io/json/ - name: Set up Go uses: actions/setup-go@v3 with: go-version-file: 'src/sigs.k8s.io/json/go.mod' go-version: ${{ matrix.go }} check-latest: true - name: Test run: | cd ${GITHUB_WORKSPACE}/src/sigs.k8s.io/json/ make test - name: Benchmark run: | cd ${GITHUB_WORKSPACE}/src/sigs.k8s.io/json/ make benchmark - name: Vet run: | cd ${GITHUB_WORKSPACE}/src/sigs.k8s.io/json/ make vet - name: fmt run: | cd ${GITHUB_WORKSPACE}/src/sigs.k8s.io/json/ make fmt git diff --exit-code apidiff: runs-on: ubuntu-latest if: github.base_ref steps: - name: Checkout old code uses: actions/checkout@v2 with: ref: ${{ github.base_ref }} path: "old" - name: Checkout new code uses: actions/checkout@v2 with: path: "new" - name: Install Go uses: actions/setup-go@v3 with: go-version-file: 'new/go.mod' - name: Add GOBIN to PATH run: echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - name: Install dependencies run: go install golang.org/x/exp/cmd/apidiff@latest - name: APIDiff run: ./hack/verify-apidiff.sh -d ../old working-directory: "new"