-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add e2e tests for windows and linux
- add COLLIE_VERSION env var support to install scripts - fix a typo in collie compliance tree warning
- Loading branch information
1 parent
701bf57
commit 38e953d
Showing
9 changed files
with
224 additions
and
15 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Force LF file endings for all text files | ||
* text eol=lf | ||
|
||
# Denote all files that are truly binary and should not be modified. | ||
*.png binary | ||
*.jpg binary |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
name: e2e | ||
on: | ||
# temporary, just for testing the workflow | ||
push: | ||
branches: [ feature/e2e-tests ] | ||
# run after the "release" workflow https://stackoverflow.com/a/64733705/125407 | ||
workflow_run: | ||
workflows: ["release"] | ||
branches: [main] | ||
types: | ||
- completed | ||
|
||
# TODO: replace "feature/e2e-tests" with "main" before merging to main branch! | ||
|
||
jobs: | ||
# this test is super basic and just checks whether collie blows up | ||
e2e-windows: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: install dependencies | ||
uses: crazy-max/ghaction-chocolatey@v3 | ||
# note: all other dependencies are installed in the image already | ||
with: | ||
args: install --force terraform terragrunt terraform-docs | ||
- name: install collie | ||
shell: pwsh | ||
env: | ||
COLLIE_VERSION: ${{ github.event.release.tag_name }} | ||
run: | | ||
irm https://raw.githubusercontent.com/meshcloud/collie-cli/feature/e2e-tests/install.ps1 | iex | ||
# github doesn't allow adding to PATH any other way, see https://stackoverflow.com/a/71579543/125407 | ||
Add-Content $env:GITHUB_PATH "C:\Users\runneradmin\collie-cli" | ||
- name: collie info | ||
shell: pwsh | ||
run: | | ||
collie info | ||
- name: test | ||
shell: pwsh | ||
run: .\test\e2e.ps1 | ||
e2e-linux: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: install dependencies | ||
# note: we forego default.nix and to be as close to a realistic user experience as possible | ||
# all the other dependencies are already present on the runner images, so we use those | ||
# and just install the missing ones via nix | ||
uses: cachix/install-nix-action@v18 | ||
with: | ||
nix_path: nixpkgs=channel:nixos-unstable | ||
extra_nix_config: | | ||
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} | ||
- uses: rrbutani/use-nix-shell-action@v1 | ||
with: | ||
packages: terragrunt terraform-docs | ||
- name: install collie | ||
env: | ||
COLLIE_VERSION: ${{ github.event.release.tag_name }} | ||
run: | | ||
curl -sf -L https://raw.githubusercontent.com/meshcloud/collie-cli/main/install.sh | sudo bash | ||
- name: collie info | ||
run: | | ||
collie info | ||
- name: test | ||
run: | | ||
./test/e2e.sh |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ name: release | |
|
||
on: | ||
release: | ||
types: [published] | ||
types: [prereleased] | ||
|
||
jobs: | ||
create-release: | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
$tmpdir=New-TemporaryFile | %{ rm $_; mkdir $_ } | ||
echo "Running test in $tmpdir - please remember to cleanup" | ||
|
||
cd $tmpdir | ||
|
||
# don't ask..., if you must - https://stackoverflow.com/questions/5596982/using-powershell-to-write-a-file-in-utf-8-without-the-bom#comment79966549_5596984 | ||
[System.Environment]::CurrentDirectory = (Get-Location).Path | ||
|
||
collie init . | ||
|
||
echo "Testing foundation features" | ||
collie foundation new f | ||
|
||
# fake a platform config file | ||
|
||
# equivalent of mkdir -p | ||
md foundations/f/platforms/az/ -ea 0 | ||
|
||
# powershell needs some convicing to write files at UTF8 without BOM... this is the only thing that works | ||
$platform_md=@" | ||
--- | ||
id: az | ||
name: Likvid Bank Azure | ||
azure: | ||
aadTenantId: 1234-1234 | ||
subscriptionId: 1234-1234 | ||
cli: | ||
az: {} | ||
--- | ||
# Likvid Bank Azure | ||
Test test | ||
"@ | ||
[System.IO.File]::WriteAllLines("foundations/f/platforms/az/README.md", $platform_md) | ||
|
||
|
||
echo "Testing kit features" | ||
collie kit import foundation/docs | ||
collie kit import azure/bootstrap | ||
collie kit apply azure/bootstrap --foundation f --platform az | ||
|
||
collie kit new azure/dummy dummy | ||
|
||
$variables_tf=@" | ||
variable "my_input_var" {} | ||
"@ | ||
[IO.File]::WriteAllLines("kit/azure/dummy/variables.tf", $variables_tf) | ||
|
||
collie kit apply azure/dummy --foundation f --platform az | ||
|
||
collie foundation deploy --auto-approve | ||
|
||
echo "Testing compliance features" | ||
collie compliance import cfmm | ||
|
||
echo "Testing outputs" | ||
collie foundation tree | ||
collie kit tree | ||
collie compliance tree | ||
|
||
echo "Testing documentation" | ||
collie foundation docs --build |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/usr/bin/env bash | ||
set -o errexit # exit on error | ||
set -o errtrace # enables ERR traps so we can run cleanup | ||
set -o pipefail # exit on error in a pipe, without this only the status of the last command in a pipe is considered | ||
set -o nounset # exit on undefined variables | ||
|
||
tmpdir=$(mktemp -d) | ||
echo "Running test in $tmpdir - please remember to cleanup" | ||
|
||
cd "$tmpdir" | ||
|
||
collie init . | ||
|
||
echo "Testing foundation features" | ||
collie foundation new f > /dev/null | ||
|
||
# fake a platform config file | ||
mkdir -p ./foundations/f/platforms/az/ | ||
cat > ./foundations/f/platforms/az/README.md <<-EOF | ||
--- | ||
id: az | ||
name: Likvid Bank Azure | ||
azure: | ||
aadTenantId: 1234-1234 | ||
subscriptionId: 1234-1234 | ||
cli: | ||
az: {} | ||
--- | ||
# Likvid Bank Azure | ||
Test test | ||
EOF | ||
|
||
echo "Testing kit features" | ||
collie kit import foundation/docs | ||
collie kit import azure/bootstrap | ||
collie kit apply azure/bootstrap --foundation f --platform az | ||
|
||
collie kit new azure/dummy dummy | ||
cat > ./kit/azure/dummy/variables.tf <<-EOF | ||
variable "my_input_var" {} | ||
EOF | ||
|
||
collie kit apply azure/dummy --foundation f --platform az | ||
|
||
collie foundation deploy --auto-approve | ||
|
||
echo "Testing compliance features" | ||
collie compliance import cfmm | ||
|
||
echo "Testing outputs" | ||
collie foundation tree | ||
collie kit tree | ||
collie compliance tree | ||
|
||
echo "Testing documentation" | ||
collie foundation docs --build |