| on: [push, pull_request] |
| name: Test |
| |
| permissions: |
| contents: read |
| |
| jobs: |
| go-test: |
| strategy: |
| matrix: |
| os: [ubuntu-latest, macos-latest, windows-latest] |
| runs-on: ${{ matrix.os }} |
| steps: |
| - name: Checkout code |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| with: |
| persist-credentials: false |
| - name: Install Go |
| uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 |
| with: |
| go-version-file: go.mod |
| - name: Build |
| run: go build |
| - name: Build in GOPATH |
| if: ${{ matrix.os != 'windows-latest' }} |
| run: go build -o $(go env GOPATH)/bin/docker-credential-gcr main.go |
| - name: Vet |
| run: go vet ./... |
| - name: Test mac/ubuntu |
| if: ${{ matrix.os != 'windows-latest' }} |
| run: | |
| go test -timeout 10s -v ./... |
| go test -race -timeout 10s -v ./... |
| env: |
| MallocNanoZone: 0 |
| - name: Test windows |
| if: ${{ matrix.os == 'windows-latest' }} |
| run: | |
| go test -timeout 10s -v -tags=windows ./... |
| go test -race -timeout 10s -v -tags=windows ./... |
| goreleaser-test: |
| runs-on: ubuntu-latest |
| steps: |
| - name: Checkout |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| with: |
| fetch-depth: 0 |
| persist-credentials: false |
| - name: Set up Go |
| uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 |
| with: |
| go-version-file: go.mod |
| cache: false |
| - name: Build GoReleaser |
| uses: goreleaser/goreleaser-action@f06c13b6b1a9625abc9e6e439d9c05a8f2190e94 # v7.2.3 |
| with: |
| distribution: goreleaser |
| version: '~> v2' |
| args: build --snapshot --clean |
| env: |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |