ci(Dockerfile): add Go SDK to resulting image #3950
Workflow file for this run
This file contains 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
name: Lint | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
golangci-lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "oldstable" | |
cache: false | |
- name: Get Go environment | |
id: go-env | |
run: | | |
echo "cache=$(go env GOCACHE)" >> $GITHUB_ENV | |
echo "modcache=$(go env GOMODCACHE)" >> $GITHUB_ENV | |
# Notice: we're using read-only cache. | |
# | |
# See https://github.com/actions/setup-go/issues/357#issuecomment-1486486358 | |
- name: Restore cache | |
uses: actions/cache/restore@v4 | |
with: | |
path: | | |
${{ env.cache }} | |
${{ env.modcache }} | |
key: ${{ runner.os }}-${{ runner.arch }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-${{ runner.arch }}-go- | |
- name: Lint | |
uses: golangci/golangci-lint-action@v6 | |
with: | |
version: latest | |
args: --timeout 5m | |
# Package/build cache already provided above. | |
# | |
# Disable module cache. | |
skip-pkg-cache: true | |
# Disable build cache. | |
skip-build-cache: true | |
# Check if there are any dirty changes after go mod tidy | |
check-mod: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "oldstable" | |
cache: false | |
- name: Get Go environment | |
id: go-env | |
run: | | |
echo "cache=$(go env GOCACHE)" >> $GITHUB_ENV | |
echo "modcache=$(go env GOMODCACHE)" >> $GITHUB_ENV | |
# Notice: we're using read-only cache. | |
# | |
# See https://github.com/actions/setup-go/issues/357#issuecomment-1486486358 | |
- name: Restore cache | |
uses: actions/cache/restore@v4 | |
with: | |
path: | | |
${{ env.cache }} | |
${{ env.modcache }} | |
key: ${{ runner.os }}-${{ runner.arch }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-${{ runner.arch }}-go- | |
- name: Run `go mod tidy` | |
run: make tidy_all | |
- name: Check git diff | |
id: git-diff | |
run: git diff --exit-code | |
go-mod-tidy: | |
if: ${{ always() && github.event.pull_request.user.login == 'dependabot[bot]' && needs.check-mod.result == 'failure' && needs.check-mod.git-diff.outcome != 'success' }} | |
uses: ./.github/workflows/tidy-autocommit.yml | |
needs: [check-mod] | |
secrets: | |
APP_ID: ${{ secrets.APP_ID }} | |
APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }} | |
with: | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
ref: ${{ github.event.pull_request.head.ref }} | |
# Check if there are any dirty changes after go generate | |
check-generate: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "oldstable" | |
cache: false | |
- name: Get Go environment | |
id: go-env | |
run: | | |
echo "cache=$(go env GOCACHE)" >> $GITHUB_ENV | |
echo "modcache=$(go env GOMODCACHE)" >> $GITHUB_ENV | |
# Notice: we're using read-only cache. | |
# | |
# See https://github.com/actions/setup-go/issues/357#issuecomment-1486486358 | |
- name: Restore cache | |
uses: actions/cache/restore@v4 | |
with: | |
path: | | |
${{ env.cache }} | |
${{ env.modcache }} | |
key: ${{ runner.os }}-${{ runner.arch }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-${{ runner.arch }}-go- | |
- name: Download dependencies | |
run: go mod download && go mod tidy | |
- name: Generate files | |
run: make generate examples | |
- name: Check git diff | |
run: git diff --exit-code |