Repository navigation
Release sdk-go #255
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This workflow runs basic CI checks for the repository: | |
| # - Unit tests | |
| # - Linting | |
| # - Formatting | |
| # | |
| # It is not responsible for running integration tests or other tests that are | |
| # more complex to run in a CI environment. | |
| name: ci | |
| on: | |
| pull_request: | |
| types: [opened, synchronize] | |
| merge_group: | |
| types: [checks_requested] | |
| push: | |
| # Always run on push to main. The build cache can only be reused | |
| # if it was saved by a run from the repository's default branch. | |
| # The run result will be identical to that from the merge queue | |
| # because the commit is identical, yet we need to perform it to | |
| # seed the build cache. | |
| branches: | |
| - main | |
| jobs: | |
| discover: | |
| runs-on: | |
| group: databricks-protected-runner-group | |
| labels: linux-ubuntu-latest | |
| outputs: | |
| modules: ${{ steps.find.outputs.modules }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| - name: Find modules | |
| id: find | |
| run: | | |
| modules=$(find . -name 'go.mod' -exec dirname {} \; | sed 's|^\./||' | sort | jq -Rnc '[inputs]') | |
| echo "modules=$modules" >> $GITHUB_OUTPUT | |
| tests: | |
| needs: discover | |
| runs-on: | |
| group: databricks-protected-runner-group | |
| labels: linux-ubuntu-latest | |
| permissions: | |
| id-token: write | |
| contents: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| go-version: | |
| - "1.26" | |
| module: ${{ fromJson(needs.discover.outputs.modules) }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| - name: Setup build environment | |
| uses: ./.github/actions/setup-build-environment | |
| with: | |
| go-version: ${{ matrix.go-version }} | |
| - name: Run tests | |
| working-directory: ${{ matrix.module }} | |
| # The examples module intentionally has no packages without its build tag. | |
| run: go list -tags=examples ./... | xargs -r go test -tags=examples -v -race | |
| lint: | |
| needs: discover | |
| runs-on: | |
| group: databricks-protected-runner-group | |
| labels: linux-ubuntu-latest | |
| permissions: | |
| id-token: write | |
| contents: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| module: ${{ fromJson(needs.discover.outputs.modules) }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| - name: Setup build environment | |
| uses: ./.github/actions/setup-build-environment | |
| with: | |
| go-version: "1.26" | |
| - name: Install golangci-lint | |
| working-directory: ${{ matrix.module }} | |
| env: | |
| GOWORK: "off" | |
| run: jf go install github.com/golangci/golangci-lint/cmd/golangci-lint@8b37f14162043f908949f1b363d061dc9ba713c0 # v1.64.8 | |
| - name: Run golangci-lint | |
| uses: golangci/golangci-lint-action@55c2c1448f86e01eaae002a5a3a9624417608d84 # v6.5.2 | |
| with: | |
| install-mode: none | |
| working-directory: ${{ matrix.module }} | |
| args: --timeout=5m --build-tags=examples ./... | |
| fmt: | |
| runs-on: | |
| group: databricks-protected-runner-group | |
| labels: linux-ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 | |
| - name: Setup Go | |
| uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0 | |
| env: | |
| GOTOOLCHAIN: local | |
| with: | |
| go-version: "1.26" | |
| cache: false | |
| - name: Run gofmt | |
| run: gofmt -l -w . | |
| - name: Fail on differences | |
| run: git diff --exit-code |