Skip to content

release: v0.14.0

release: v0.14.0 #322

Workflow file for this run

name: CI
on:
push:
pull_request:
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: stable
- 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:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: stable
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v9
with:
version: latest
args: --timeout=5m
security:
name: Security
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: stable
- 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:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: stable
- 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@v6
with:
name: stackaroo-${{ matrix.goos }}-${{ matrix.goarch }}
path: stackaroo-*
retention-days: 30
integration-test:
name: Integration Tests
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/checkout@v6
- uses: actions/setup-go@v6
with:
go-version: stable
- name: Download Linux build
uses: actions/download-artifact@v7
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:
- uses: actions/checkout@v6
- 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-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