Add to allow for supporting dynamic module versions and source (#181) #325
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 is a collection of "quick checks" that should be reasonable | |
| # to run for any new commit to this repository in principle. | |
| # | |
| # The main purpose of this workflow is to represent checks that we want to | |
| # run prior to reviewing and merging a pull request. We should therefore aim | |
| # for these checks to complete in no more than a few minutes in the common | |
| # case. | |
| name: Quick Checks | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| - "v[0-9]+.[0-9]+" | |
| tags: | |
| - "v[0-9]+.[0-9]+.[0-9]+*" | |
| # This workflow runs for not-yet-reviewed external contributions and so it | |
| # intentionally has no write access and only limited read access to the | |
| # repository. | |
| permissions: | |
| contents: read | |
| jobs: | |
| consistency-checks: | |
| name: "Code Consistency Checks" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: "Fetch source code" | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| fetch-depth: 0 # We need to do comparisons against the main branch. | |
| - name: Determine Go version | |
| id: go | |
| uses: ./.github/actions/go-version | |
| - name: Install Go toolchain | |
| uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0 | |
| with: | |
| go-version: ${{ steps.go.outputs.version }} | |
| - name: Cache Go modules | |
| uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 | |
| with: | |
| path: "~/go/pkg" | |
| key: go-mod-${{ hashFiles('go.sum') }} | |
| restore-keys: | | |
| go-mod- | |
| - name: "go.mod and go.sum consistency check" | |
| run: | | |
| go mod tidy | |
| if [[ -n "$(git status --porcelain)" ]]; then | |
| echo >&2 "ERROR: go.mod/go.sum are not up-to-date. Run 'go mod tidy' and then commit the updated files." | |
| exit 1 | |
| fi | |
| - name: "Copyright headers" | |
| run: | | |
| go tool github.com/hashicorp/copywrite headers --plan | |
| if [[ $? != 0 ]]; then | |
| echo >&2 "ERROR: some files are missing required copyright headers. Run `scripts/add-copyright-headers.sh` locally and then commit the updated files." | |
| exit 1 | |
| fi |