Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
141 changes: 31 additions & 110 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -66,6 +66,7 @@ jobs:
test:
name: Test
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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: |
Expand All @@ -217,6 +157,7 @@ jobs:
integration:
name: Integration Tests
runs-on: ${{ matrix.os }}
timeout-minutes: 30
needs: [preflight, test]
strategy:
fail-fast: false
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
timeout-minutes: 45
permissions:
actions: read
contents: read
Expand Down
24 changes: 10 additions & 14 deletions .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/release-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Loading
Loading