Skip to content

Commit

Permalink
Merge branch 'main' into DEV-2859
Browse files Browse the repository at this point in the history
  • Loading branch information
osterman authored Dec 26, 2024
2 parents 7e2f054 + 02bbeb9 commit f4a81b3
Show file tree
Hide file tree
Showing 56 changed files with 867 additions and 426 deletions.
37 changes: 37 additions & 0 deletions .github/mergify.yml
Original file line number Diff line number Diff line change
@@ -1 +1,38 @@
extends: .github

shared:
# Automated pull requests from bot users
is_a_bot: &is_a_bot
- or:
- "author=github-actions[bot]"

# Default branches
is_default_branch: &is_default_branch
- or:
- "base=main"
- "base=master"

# It's not closed or merged
is_open: &is_open
- and:
- -merged
- -closed

pull_request_rules:
- name: Trigger workflow dispatch on PR synchronized by github-actions[bot]
conditions:
- and: *is_a_bot
- and: *is_open
- and: *is_default_branch

actions:
comment:
message: |
Triggering the workflow dispatch for preview build...
github_actions:
workflow:
dispatch:
- workflow: website-preview-build.yml
ref: "{{ pull_request.head.ref }}"
- workflow: test.yml
ref: "{{ pull_request.head.ref }}"
148 changes: 126 additions & 22 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,26 @@ 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: Add GNU tar to PATH (significantly faster than windows tar)
if: matrix.target == 'windows'
run: echo "C:\Program Files\Git\usr\bin" >> $Env:GITHUB_PATH

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

Expand All @@ -42,29 +59,77 @@ 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:
flavor:
- { os: ubuntu-latest, target: linux }
- { os: windows-latest, target: windows }
- { os: macos-latest, target: macos }
timeout-minutes: 15
runs-on: ${{ matrix.flavor.os }}
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4

- name: Add GNU tar to PATH (significantly faster than windows tar)
if: matrix.flavor.target == 'windows'
run: echo "C:\Program Files\Git\usr\bin" >> $Env:GITHUB_PATH

- name: Download build artifacts for ${{ matrix.flavor.target }}
uses: actions/download-artifact@v4
with:
name: build-artifacts-${{ matrix.flavor.target }}
path: ${{ github.workspace }}

- name: Add build artifacts directory to PATH for linux or macos
if: matrix.flavor.target == 'linux' || matrix.flavor.target == 'macos'
run: |
echo "${{ github.workspace }}" >> $GITHUB_PATH
chmod +x "${{ github.workspace }}/atmos"
- name: Add build artifacts directory to PATH for windows
if: matrix.flavor.target == 'windows'
shell: pwsh
run: |
$atmosPath = Join-Path ${{ github.workspace }} "atmos.exe"
if (-not (Test-Path $atmosPath)) {
throw "atmos.exe not found at: $atmosPath"
}
echo "${{ github.workspace }}" >> $Env:GITHUB_PATH
- uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ env.TERRAFORM_VERSION }}
terraform_wrapper: false

- name: Check atmos.exe integrity
if: matrix.flavor.target == 'windows'
shell: pwsh
run: |
Write-Output "PATH=$Env:PATH"
Write-Output "PATHEXT=$Env:PATHEXT"
Get-ChildItem "${{ github.workspace }}"
Get-Command "${{ github.workspace }}\atmos.exe"
atmos version
- name: Set up Go
uses: actions/setup-go@v5
with:
Expand All @@ -77,8 +142,7 @@ jobs:
- name: Acceptance tests
timeout-minutes: 10
run: |
make testacc
run: make testacc

docker:
name: "Docker Lint"
Expand Down Expand Up @@ -133,6 +197,7 @@ jobs:
- /var/run/docker.sock:/var/run/docker.sock

strategy:
fail-fast: false
matrix:
demo-folder:
- demo-localstack
Expand All @@ -142,7 +207,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 +260,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 +287,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 @@ -250,26 +320,56 @@ jobs:

timeout-minutes: 20
steps:
- name: Download build artifacts
- name: Check out code into the Go module directory
uses: actions/checkout@v4

- name: Add GNU tar to PATH (significantly faster than windows tar)
if: matrix.flavor.target == 'windows'
run: echo "C:\Program Files\Git\usr\bin" >> $Env:GITHUB_PATH

- name: Download build artifacts for ${{ matrix.flavor.target }}
uses: actions/download-artifact@v4
with:
name: build-artifacts
path: /usr/local/bin
name: build-artifacts-${{ matrix.flavor.target }}
path: ${{ github.workspace }}

- name: Set execute permissions on atmos
run: chmod +x /usr/local/bin/atmos
- name: Add build artifacts directory to PATH for linux or macos
if: matrix.flavor.target == 'linux' || matrix.flavor.target == 'macos'
run: |
echo "${{ github.workspace }}" >> $GITHUB_PATH
chmod +x "${{ github.workspace }}/atmos"
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Add build artifacts directory to PATH for windows
if: matrix.flavor.target == 'windows'
run: |
echo "${{ github.workspace }}" >> $Env:GITHUB_PATH
- uses: hashicorp/setup-terraform@v3
with:
terraform_version: ${{ env.TERRAFORM_VERSION }}
terraform_wrapper: false

- name: Run tests for ${{ matrix.demo-folder }}
- name: Run tests in ${{ matrix.demo-folder }} for ${{ matrix.flavor.target }}
working-directory: examples/${{ matrix.demo-folder }}
if: matrix.flavor.target == 'linux' || matrix.flavor.target == 'macos'
run: |
atmos test
- name: Check atmos.exe integrity
if: matrix.flavor.target == 'windows'
shell: pwsh
run: |
Write-Output "PATH=$Env:PATH"
Write-Output "PATHEXT=$Env:PATHEXT"
Get-ChildItem "${{ github.workspace }}"
Get-Command "${{ github.workspace }}\atmos.exe"
atmos version
- name: Run tests in ${{ matrix.demo-folder }} for ${{ matrix.flavor.target }}
working-directory: examples/${{ matrix.demo-folder }}
if: matrix.flavor.target == 'windows'
shell: pwsh
run: |
cd examples/${{ matrix.demo-folder }}
atmos test
# run other demo tests
Expand All @@ -278,6 +378,7 @@ jobs:
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
demo-folder:
# - demo-component-manifest
Expand All @@ -297,6 +398,8 @@ jobs:
# - demo-mock-architecture
# - demo-stack-templating
# - demo-multi-cloud
- quick-start-advanced
#- quick-start-simple

timeout-minutes: 20
steps:
Expand All @@ -320,14 +423,15 @@ jobs:
--minimum-failure-severity=warning
--recursive
--config=${{ github.workspace }}/examples/.tflint.hcl
fail_on_error: true
fail_level: error

# run other demo tests
validate:
name: "[validate] ${{ matrix.demo-folder }}"
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

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
3 changes: 3 additions & 0 deletions cmd/atlantis_generate_repo_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ var atlantisGenerateRepoConfigCmd = &cobra.Command{
Long: "This command generates repository configuration for Atlantis",
FParseErrWhitelist: struct{ UnknownFlags bool }{UnknownFlags: false},
Run: func(cmd *cobra.Command, args []string) {
// Check Atmos configuration
checkAtmosConfig()

err := e.ExecuteAtlantisGenerateRepoConfigCmd(cmd, args)
if err != nil {
u.LogErrorAndExit(schema.AtmosConfiguration{}, err)
Expand Down
Loading

0 comments on commit f4a81b3

Please sign in to comment.