diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e441f7f..6caacb1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,39 +8,39 @@ on: - '.github/workflows/ci.yml' workflow_dispatch: +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + defaults: run: working-directory: cli env: - GO_VERSION: '1.26.0' + GO_VERSION: '1.26.1' jobs: preflight: name: Preflight Checks runs-on: ubuntu-latest + timeout-minutes: 30 steps: - name: Checkout code uses: actions/checkout@v4 - - name: Set up Go (bootstrap) + - name: Set up Go uses: actions/setup-go@v5 with: - go-version: 'stable' - cache: false - - - name: Install Go ${{ env.GO_VERSION }} - run: | - go install golang.org/dl/go${{ env.GO_VERSION }}@latest - go${{ env.GO_VERSION }} download - echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - echo "GOROOT=$(go${{ env.GO_VERSION }} env GOROOT)" >> $GITHUB_ENV + go-version: '${{ env.GO_VERSION }}' + cache: true + cache-dependency-path: cli/go.sum - - name: Use Go ${{ env.GO_VERSION }} - run: | - ln -sf $(which go${{ env.GO_VERSION }}) $(go env GOPATH)/bin/go - go version + - name: Cache Go tools + uses: actions/cache@v4 + with: + path: ~/go/bin + key: go-tools-${{ runner.os }}-${{ env.GO_VERSION }} - name: Install Mage run: go install github.com/magefile/mage@latest @@ -66,6 +66,7 @@ jobs: test: name: Test runs-on: ${{ matrix.os }} + timeout-minutes: 30 strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] @@ -74,35 +75,12 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Set up Go (bootstrap) + - name: Set up Go uses: actions/setup-go@v5 with: - go-version: 'stable' - cache: false - - - name: Install Go ${{ env.GO_VERSION }} (Unix) - if: runner.os != 'Windows' - run: | - go install golang.org/dl/go${{ env.GO_VERSION }}@latest - go${{ env.GO_VERSION }} download - echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - ln -sf $(which go${{ env.GO_VERSION }}) $(go env GOPATH)/bin/go - - - name: Install Go ${{ env.GO_VERSION }} (Windows) - if: runner.os == 'Windows' - shell: pwsh - run: | - go install golang.org/dl/go${{ env.GO_VERSION }}@latest - & go${{ env.GO_VERSION }} download - $gopath = go env GOPATH - "$gopath\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - Copy-Item "$gopath\bin\go${{ env.GO_VERSION }}.exe" "$gopath\bin\go.exe" -Force - - - name: Verify Go version - run: go version - - - name: Download dependencies - run: go mod download + go-version: '${{ env.GO_VERSION }}' + cache: true + cache-dependency-path: cli/go.sum - name: Run tests shell: bash @@ -141,40 +119,11 @@ jobs: COVERAGE=$(go tool cover -func=../coverage/coverage.out | grep total | awk '{print $3}') echo "**Total Coverage: $COVERAGE**" >> $GITHUB_STEP_SUMMARY - lint: - name: Lint - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up Go (bootstrap) - uses: actions/setup-go@v5 - with: - go-version: 'stable' - cache: false - - - name: Install Go ${{ env.GO_VERSION }} - run: | - go install golang.org/dl/go${{ env.GO_VERSION }}@latest - go${{ env.GO_VERSION }} download - echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - ln -sf $(which go${{ env.GO_VERSION }}) $(go env GOPATH)/bin/go - - - name: Verify Go version - run: go version - - - name: Install golangci-lint - run: go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest - - - name: Run golangci-lint - run: golangci-lint run --timeout=5m - build: name: Build runs-on: ubuntu-latest - needs: [preflight, test, lint] + needs: [preflight, test] + timeout-minutes: 30 defaults: run: @@ -184,21 +133,12 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Set up Go (bootstrap) + - name: Set up Go uses: actions/setup-go@v5 with: - go-version: 'stable' - cache: false - - - name: Install Go ${{ env.GO_VERSION }} - run: | - go install golang.org/dl/go${{ env.GO_VERSION }}@latest - go${{ env.GO_VERSION }} download - echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - ln -sf $(which go${{ env.GO_VERSION }}) $(go env GOPATH)/bin/go - - - name: Verify Go version - run: go version + go-version: '${{ env.GO_VERSION }}' + cache: true + cache-dependency-path: cli/go.sum - name: Build for multiple platforms run: | @@ -217,6 +157,7 @@ jobs: integration: name: Integration Tests runs-on: ${{ matrix.os }} + timeout-minutes: 30 needs: [preflight, test] strategy: fail-fast: false @@ -227,32 +168,12 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Set up Go (bootstrap) + - name: Set up Go uses: actions/setup-go@v5 with: - go-version: 'stable' - cache: false - - - name: Install Go ${{ env.GO_VERSION }} (Unix) - if: runner.os != 'Windows' - run: | - go install golang.org/dl/go${{ env.GO_VERSION }}@latest - go${{ env.GO_VERSION }} download - echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - ln -sf $(which go${{ env.GO_VERSION }}) $(go env GOPATH)/bin/go - - - name: Install Go ${{ env.GO_VERSION }} (Windows) - if: runner.os == 'Windows' - shell: pwsh - run: | - go install golang.org/dl/go${{ env.GO_VERSION }}@latest - & go${{ env.GO_VERSION }} download - $gopath = go env GOPATH - "$gopath\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - Copy-Item "$gopath\bin\go${{ env.GO_VERSION }}.exe" "$gopath\bin\go.exe" -Force - - - name: Verify Go version - run: go version + go-version: '${{ env.GO_VERSION }}' + cache: true + cache-dependency-path: cli/go.sum - name: Set up Python uses: actions/setup-python@v5 diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 68f693f..26549c3 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -16,6 +16,7 @@ jobs: analyze: name: Analyze runs-on: ubuntu-latest + timeout-minutes: 45 permissions: actions: read contents: read diff --git a/.github/workflows/pr-build.yml b/.github/workflows/pr-build.yml index 4eee6c1..5e7e31b 100644 --- a/.github/workflows/pr-build.yml +++ b/.github/workflows/pr-build.yml @@ -21,12 +21,16 @@ on: required: false type: number +concurrency: + group: pr-build-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + defaults: run: working-directory: cli env: - GO_VERSION: '1.26.0' + GO_VERSION: '1.26.1' jobs: # Check if build should run @@ -154,6 +158,7 @@ jobs: build-pr: name: Build PR Preview runs-on: ubuntu-latest + timeout-minutes: 20 needs: check-permission if: needs.check-permission.outputs.allowed == 'true' permissions: @@ -183,21 +188,12 @@ jobs: with: ref: ${{ steps.pr.outputs.sha }} - - name: Set up Go (bootstrap) + - name: Set up Go uses: actions/setup-go@v5 with: - go-version: 'stable' - cache: false - - - name: Install Go ${{ env.GO_VERSION }} - run: | - go install golang.org/dl/go${{ env.GO_VERSION }}@latest - go${{ env.GO_VERSION }} download - echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - ln -sf $(which go${{ env.GO_VERSION }}) $(go env GOPATH)/bin/go - - - name: Verify Go version - run: go version + go-version: '${{ env.GO_VERSION }}' + cache: true + cache-dependency-path: cli/go.sum - name: Calculate PR version id: version diff --git a/.github/workflows/release-test.yml b/.github/workflows/release-test.yml index b20b2e1..975af0d 100644 --- a/.github/workflows/release-test.yml +++ b/.github/workflows/release-test.yml @@ -18,12 +18,13 @@ defaults: working-directory: cli env: - GO_VERSION: '1.26.0' + GO_VERSION: '1.26.1' jobs: release: name: Release runs-on: ubuntu-latest + timeout-minutes: 15 permissions: contents: write pull-requests: write @@ -37,7 +38,9 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: ${{ env.GO_VERSION }} + go-version: '${{ env.GO_VERSION }}' + cache: true + cache-dependency-path: cli/go.sum - name: Calculate next version id: version diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a7c94ac..8a9b024 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,38 +13,40 @@ on: - minor - major +concurrency: + group: release + cancel-in-progress: false + defaults: run: shell: bash working-directory: cli env: - GO_VERSION: '1.26.0' + GO_VERSION: '1.26.1' jobs: preflight: name: Preflight Checks runs-on: ubuntu-latest + timeout-minutes: 30 steps: - name: Checkout code uses: actions/checkout@v4 - - name: Set up Go (bootstrap) + - name: Set up Go uses: actions/setup-go@v5 with: - go-version: 'stable' - cache: false - - - name: Install Go ${{ env.GO_VERSION }} - run: | - go install golang.org/dl/go${{ env.GO_VERSION }}@latest - go${{ env.GO_VERSION }} download - echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - ln -sf $(which go${{ env.GO_VERSION }}) $(go env GOPATH)/bin/go + go-version: '${{ env.GO_VERSION }}' + cache: true + cache-dependency-path: cli/go.sum - - name: Verify Go version - run: go version + - name: Cache Go tools + uses: actions/cache@v4 + with: + path: ~/go/bin + key: go-tools-${{ runner.os }}-${{ env.GO_VERSION }} - name: Install Mage run: go install github.com/magefile/mage@latest @@ -76,6 +78,7 @@ jobs: test: name: Test runs-on: ${{ matrix.os }} + timeout-minutes: 30 strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] @@ -84,35 +87,12 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Set up Go (bootstrap) + - name: Set up Go uses: actions/setup-go@v5 with: - go-version: 'stable' - cache: false - - - name: Install Go ${{ env.GO_VERSION }} (Unix) - if: runner.os != 'Windows' - run: | - go install golang.org/dl/go${{ env.GO_VERSION }}@latest - go${{ env.GO_VERSION }} download - echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - ln -sf $(which go${{ env.GO_VERSION }}) $(go env GOPATH)/bin/go - - - name: Install Go ${{ env.GO_VERSION }} (Windows) - if: runner.os == 'Windows' - shell: pwsh - run: | - go install golang.org/dl/go${{ env.GO_VERSION }}@latest - & go${{ env.GO_VERSION }} download - $gopath = go env GOPATH - "$gopath\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - Copy-Item "$gopath\bin\go${{ env.GO_VERSION }}.exe" "$gopath\bin\go.exe" -Force - - - name: Verify Go version - run: go version - - - name: Download dependencies - run: go mod download + go-version: '${{ env.GO_VERSION }}' + cache: true + cache-dependency-path: cli/go.sum - name: Run tests shell: bash @@ -138,40 +118,11 @@ jobs: fail_ci_if_error: false verbose: true - lint: - name: Lint - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up Go (bootstrap) - uses: actions/setup-go@v5 - with: - go-version: 'stable' - cache: false - - - name: Install Go ${{ env.GO_VERSION }} - run: | - go install golang.org/dl/go${{ env.GO_VERSION }}@latest - go${{ env.GO_VERSION }} download - echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - ln -sf $(which go${{ env.GO_VERSION }}) $(go env GOPATH)/bin/go - - - name: Verify Go version - run: go version - - - name: Install golangci-lint - run: go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest - - - name: Run golangci-lint - run: golangci-lint run --timeout=5m - build: name: Build runs-on: ubuntu-latest - needs: [preflight, test, lint] + needs: [preflight, test] + timeout-minutes: 30 defaults: run: @@ -181,21 +132,12 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Set up Go (bootstrap) + - name: Set up Go uses: actions/setup-go@v5 with: - go-version: 'stable' - cache: false - - - name: Install Go ${{ env.GO_VERSION }} - run: | - go install golang.org/dl/go${{ env.GO_VERSION }}@latest - go${{ env.GO_VERSION }} download - echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - ln -sf $(which go${{ env.GO_VERSION }}) $(go env GOPATH)/bin/go - - - name: Verify Go version - run: go version + go-version: '${{ env.GO_VERSION }}' + cache: true + cache-dependency-path: cli/go.sum - name: Build for multiple platforms run: | @@ -214,7 +156,8 @@ jobs: release: name: Release runs-on: ubuntu-latest - needs: [preflight, test, lint, build] + needs: [preflight, test, build] + timeout-minutes: 30 permissions: contents: write pull-requests: write @@ -228,7 +171,9 @@ jobs: - name: Set up Go uses: actions/setup-go@v5 with: - go-version: ${{ env.GO_VERSION }} + go-version: '${{ env.GO_VERSION }}' + cache: true + cache-dependency-path: cli/go.sum - name: Calculate next version id: version diff --git a/.github/workflows/update-azd-core.yml b/.github/workflows/update-azd-core.yml index a74aca3..e3f0398 100644 --- a/.github/workflows/update-azd-core.yml +++ b/.github/workflows/update-azd-core.yml @@ -14,17 +14,22 @@ on: repository_dispatch: types: [azd-core-released] +concurrency: + group: update-azd-core + cancel-in-progress: true + defaults: run: working-directory: cli env: - GO_VERSION: '1.26.0' + GO_VERSION: '1.26.1' jobs: update: name: Update azd-core dependency runs-on: ubuntu-latest + timeout-minutes: 10 permissions: contents: write pull-requests: write @@ -77,18 +82,12 @@ jobs: echo "BRANCH=${{ steps.inputs.outputs.branch }}" >> $GITHUB_ENV working-directory: . - - name: Set up Go (bootstrap) + - name: Set up Go uses: actions/setup-go@v5 with: - go-version: 'stable' - cache: false - - - name: Install Go ${{ env.GO_VERSION }} - run: | - go install golang.org/dl/go${{ env.GO_VERSION }}@latest - go${{ env.GO_VERSION }} download - echo "$(go env GOPATH)/bin" >> $GITHUB_PATH - ln -sf $(which go${{ env.GO_VERSION }}) $(go env GOPATH)/bin/go + go-version: '${{ env.GO_VERSION }}' + cache: true + cache-dependency-path: cli/go.sum - name: Update azd-core run: | diff --git a/cli/go.mod b/cli/go.mod index 07171fd..4ebd683 100644 --- a/cli/go.mod +++ b/cli/go.mod @@ -1,6 +1,6 @@ module github.com/jongio/azd-exec/cli -go 1.26.0 +go 1.26.1 require ( github.com/azure/azure-dev/cli/azd v0.0.0-20260228002641-8f080b39d69b