release: v0.4.0 #103
Workflow file for this run
This file contains hidden or 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: | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| cache: true | |
| cache-dependency-path: go.sum | |
| - name: Verify dependencies | |
| run: | | |
| go mod verify | |
| go mod tidy | |
| git diff --exit-code | |
| - name: Run tests | |
| run: go test -v ./... | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| cache: true | |
| cache-dependency-path: go.sum | |
| - name: Run golangci-lint | |
| uses: golangci/golangci-lint-action@v8 | |
| with: | |
| version: latest | |
| args: --timeout=5m | |
| security: | |
| name: Security | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| cache: true | |
| cache-dependency-path: go.sum | |
| - name: Run govulncheck | |
| run: | | |
| go install golang.org/x/vuln/cmd/govulncheck@latest | |
| govulncheck ./... | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| needs: [test, lint, security] | |
| strategy: | |
| matrix: | |
| include: | |
| - goos: linux | |
| goarch: amd64 | |
| - goos: linux | |
| goarch: arm64 | |
| - goos: darwin | |
| goarch: amd64 | |
| - goos: darwin | |
| goarch: arm64 | |
| - goos: windows | |
| goarch: amd64 | |
| - goos: windows | |
| goarch: arm64 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| cache: true | |
| cache-dependency-path: go.sum | |
| - name: Build binary | |
| env: | |
| GOOS: ${{ matrix.goos }} | |
| GOARCH: ${{ matrix.goarch }} | |
| run: | | |
| # Calculate version information | |
| BASE_VERSION=$(cat VERSION 2>/dev/null || echo "0.0.0") | |
| GIT_COMMIT=$(git rev-parse --short HEAD 2>/dev/null || echo 'unknown') | |
| BUILD_DATE=$(date -u '+%Y-%m-%d %H:%M:%S UTC') | |
| GIT_TAG=$(git describe --exact-match --tags 2>/dev/null || echo "") | |
| GIT_DIRTY=$(test -z "$(git status --porcelain 2>/dev/null)" || echo "-dirty") | |
| # Determine version string | |
| if [ -n "$GIT_TAG" ] && [ "$GIT_TAG" = "v$BASE_VERSION" ]; then | |
| VERSION="v$BASE_VERSION" | |
| else | |
| VERSION="${BASE_VERSION}+${GIT_COMMIT}${GIT_DIRTY}" | |
| fi | |
| echo "Building version: $VERSION" | |
| # Build with version information | |
| LDFLAGS="-w -s -X 'github.com/orien/stackaroo/internal/version.Version=$VERSION' -X 'github.com/orien/stackaroo/internal/version.GitCommit=$GIT_COMMIT' -X 'github.com/orien/stackaroo/internal/version.BuildDate=$BUILD_DATE'" | |
| if [ "${{ matrix.goos }}" = "windows" ]; then | |
| go build -v -ldflags="$LDFLAGS" -o stackaroo-${{ matrix.goos }}-${{ matrix.goarch }}.exe . | |
| else | |
| go build -v -ldflags="$LDFLAGS" -o stackaroo-${{ matrix.goos }}-${{ matrix.goarch }} . | |
| fi | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: stackaroo-${{ matrix.goos }}-${{ matrix.goarch }} | |
| path: stackaroo-* | |
| retention-days: 30 | |
| integration-test: | |
| name: Integration Tests | |
| runs-on: ubuntu-latest | |
| needs: [build] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| cache: true | |
| - name: Download Linux build | |
| uses: actions/download-artifact@v5 | |
| with: | |
| name: stackaroo-linux-amd64 | |
| - name: Make binary executable | |
| run: chmod +x stackaroo-linux-amd64 | |
| - name: Test CLI basics | |
| run: | | |
| ./stackaroo-linux-amd64 --help | |
| ./stackaroo-linux-amd64 --version | |
| ./stackaroo-linux-amd64 deploy --help | |
| docker-test: | |
| name: Docker Build Test | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'pull_request' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v5 | |
| - name: Test Docker build | |
| run: | | |
| # Test that our Go binary can build in a minimal container | |
| docker run --rm -v "$PWD":/usr/src/app -w /usr/src/app golang:1.25-alpine go build -v . | |
| notify: | |
| name: Notify | |
| runs-on: ubuntu-latest | |
| needs: [test, lint, security, build, integration-test] | |
| if: always() | |
| steps: | |
| - name: Workflow Status | |
| run: | | |
| if [ "${{ needs.test.result }}" = "success" ] && \ | |
| [ "${{ needs.lint.result }}" = "success" ] && \ | |
| [ "${{ needs.security.result }}" = "success" ] && \ | |
| [ "${{ needs.build.result }}" = "success" ] && \ | |
| [ "${{ needs.integration-test.result }}" = "success" ]; then | |
| echo "✅ All CI checks passed!" | |
| else | |
| echo "❌ Some CI checks failed" | |
| exit 1 | |
| fi |