feat: handle occasional long instance boot times #865
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: ci | |
on: | |
push: {} | |
pull_request: {} | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: "1.20.5" | |
check-latest: true | |
cache: true | |
- name: Verify dependencies | |
run: | | |
go mod verify | |
go mod download | |
- name: Check formatting | |
run: | | |
STATUS=0 | |
assert-nothing-changed() { | |
local diff | |
"$@" >/dev/null || return 1 | |
if ! diff="$(git diff -U1 --color --exit-code)"; then | |
printf '\e[31mError: running `\e[1m%s\e[22m` results in modifications that you must check into version control:\e[0m\n%s\n\n' "$*" "$diff" >&2 | |
git checkout -- . | |
STATUS=1 | |
fi | |
} | |
assert-nothing-changed go fmt ./... | |
assert-nothing-changed go mod tidy | |
exit $STATUS | |
- uses: golangci/golangci-lint-action@v3 | |
with: | |
version: v1.53.3 | |
only-new-issues: false | |
skip-cache: false | |
skip-build-cache: true | |
skip-pkg-cache: true | |
args: --timeout 5m | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
build: | |
runs-on: ubuntu-latest-16-cores | |
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: "1.20.5" | |
check-latest: true | |
cache: true | |
- uses: goreleaser/goreleaser-action@v4 | |
with: | |
version: 1.19.0 | |
args: build --clean --snapshot | |
package: | |
runs-on: ubuntu-latest | |
if: github.event_name != 'pull_request' | |
permissions: | |
contents: read | |
packages: write | |
id-token: write | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: depot/setup-action@v1 | |
- uses: docker/metadata-action@v4 | |
id: meta | |
with: | |
images: ghcr.io/depot/cli | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
- id: build-info | |
name: Set build information | |
run: | | |
echo "::set-output name=version::${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}" | |
echo "::set-output name=date::$(date +'%Y-%m-%d')" | |
echo "::set-output name=sentry-environment::${{ fromJSON('{"true":"release","false":"development"}')[startsWith(github.ref, 'refs/tags/v')] }}" | |
- uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- uses: depot/build-push-action@v1 | |
with: | |
push: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: linux/amd64,linux/arm64 | |
build-args: | | |
LDFLAGS=-s -w -X github.com/depot/cli/internal/build.Version=${{ steps.build-info.outputs.version }} -X github.com/depot/cli/internal/build.Date=${{ steps.build-info.outputs.date }} -X github.com/depot/cli/internal/build.SentryEnvironment=${{ steps.build-info.outputs.sentry-environment }} |