Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Windows & macOS Acceptance Tests #875

Merged
merged 19 commits into from
Dec 20, 2024
Merged
55 changes: 44 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,22 @@ jobs:
# ensure the code builds...
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 5
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: linux
- os: windows-latest
target: windows
- os: macos-latest
target: macos
runs-on: ${{ matrix.os }}
steps:
- name: Build
run: echo "Building on ${{ matrix.os }}"

- name: Check out code into the Go module directory
uses: actions/checkout@v4

Expand All @@ -42,25 +55,35 @@ jobs:

- name: Build
run: |
make build
make build-${{ matrix.target }}

- name: Version
run: |
make version
make version-${{ matrix.target }}

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
name: build-artifacts-${{ matrix.target }}
path: |
./build/

# run acceptance tests
test:
name: Acceptance Tests
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: linux
- os: windows-latest
target: windows
- os: macos-latest
target: macos
timeout-minutes: 15
runs-on: ${{ matrix.os }}
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
Expand Down Expand Up @@ -133,6 +156,7 @@ jobs:
- /var/run/docker.sock:/var/run/docker.sock

strategy:
fail-fast: false
matrix:
demo-folder:
- demo-localstack
Expand All @@ -142,7 +166,7 @@ jobs:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts
name: build-artifacts-linux
path: /usr/local/bin

- name: Set execute permissions on atmos
Expand Down Expand Up @@ -195,7 +219,7 @@ jobs:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts
name: build-artifacts-linux
path: /usr/local/bin

- name: Set execute permissions on atmos
Expand All @@ -222,11 +246,16 @@ jobs:

# run other demo tests
mock:
name: "[mock] ${{ matrix.demo-folder }}"
name: "[mock-${{ matrix.flavor.target}}] ${{ matrix.demo-folder }}"
needs: build
runs-on: ubuntu-latest
runs-on: ${{ matrix.flavor.os }}
strategy:
fail-fast: false
matrix:
flavor:
- { os: ubuntu-latest, target: linux }
- { os: windows-latest, target: windows }
- { os: macos-latest, target: macos }
demo-folder:
- demo-atlantis
# - demo-component-manifest
Expand All @@ -253,7 +282,7 @@ jobs:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts
name: build-artifacts-${{ matrix.flavor.target }}
path: /usr/local/bin

- name: Set execute permissions on atmos
Expand All @@ -278,6 +307,7 @@ jobs:
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
demo-folder:
# - demo-component-manifest
Expand All @@ -297,6 +327,8 @@ jobs:
# - demo-mock-architecture
# - demo-stack-templating
# - demo-multi-cloud
- quick-start-advanced
#- quick-start-simple

timeout-minutes: 20
steps:
Expand Down Expand Up @@ -328,6 +360,7 @@ jobs:
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
demo-folder:
- demo-context
Expand Down
35 changes: 30 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
TEST ?= $$(go list ./... | grep -v 'vendor')
# This works because `go list ./...` excludes vendor directories by default in modern versions of Go (1.11+).
# No need for grep or additional filtering.
TEST ?= $$(go list ./...)
SHELL := /bin/bash
#GOOS=darwin
#GOOS=linux
Expand All @@ -17,18 +19,41 @@ lint:
get:
go get

build: get
env $(if $(GOOS),GOOS=$(GOOS)) $(if $(GOARCH),GOARCH=$(GOARCH)) go build -o build/atmos -v -ldflags "-X 'github.com/cloudposse/atmos/pkg/version.Version=${VERSION}'"
build: build-default

version: build
version: version-default

build-linux: GOOS=linux
build-linux: build-default

build-default: get
@echo "Building atmos $(if $(GOOS),GOOS=$(GOOS)) $(if $(GOARCH),GOARCH=$(GOARCH))"
env $(if $(GOOS),GOOS=$(GOOS)) $(if $(GOARCH),GOARCH=$(GOARCH)) go build -o build/atmos -v -ldflags "-X 'github.com/cloudposse/atmos/pkg/version.Version=$(VERSION)'"

build-windows: GOOS=windows
build-windows: get
@echo "Building atmos for $(GOOS) ($(GOARCH))"
go build -o build/atmos.exe -v -ldflags "-X github.com/cloudposse/atmos/pkg/version.Version=$(VERSION)"

build-macos: GOOS=darwin
build-macos: build-default

version-linux: version-default
aknysh marked this conversation as resolved.
Show resolved Hide resolved

version-macos: version-default

version-default:
chmod +x ./build/atmos
./build/atmos version

version-windows: build-windows
./build/atmos.exe version

deps:
go mod download

# Run acceptance tests
testacc: get
go test $(TEST) -v $(TESTARGS) -timeout 2m

.PHONY: lint get build deps version testacc
.PHONY: lint get build version build-linux build-windows build-macos deps version-linux version-windows version-macos testacc
Loading