Skip to content

Commit

Permalink
chore: add basic CLI smoke-test to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
smlx committed May 10, 2022
1 parent 8285d33 commit add68d3
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 6 deletions.
26 changes: 20 additions & 6 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
name: Build
name: CLI build and test
on: pull_request
jobs:
build:
strategy:
matrix:
os:
- ubuntu-latest
runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -21,3 +17,21 @@ jobs:
with:
version: latest
args: build --snapshot --rm-dist
- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: lagoon-linter
path: dist/*
cli_test:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Download lagoon-linter binaries
uses: actions/download-artifact@v2
with:
name: lagoon-linter
path: ./dist
- name: Run CLI test
run: ./cli-test.sh
39 changes: 39 additions & 0 deletions cli-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env sh
set -eu

LINTER=./dist/lagoon-linter_linux_amd64_v1/lagoon-linter
chmod +x "$LINTER"

# profile: required
for lagoonyml in ./internal/lagoonyml/required/testdata/valid.*.yml; do
echo "$lagoonyml"
rm -f .lagoon.yml
$LINTER validate --lagoon-yaml="$lagoonyml" # explicitly validate $lagoonyml
ln -fs "$lagoonyml" .lagoon.yml
$LINTER # implicitly validate .lagoon.yml
done
for lagoonyml in ./internal/lagoonyml/required/testdata/invalid.*.yml; do
echo "$lagoonyml"
rm -f .lagoon.yml
$LINTER validate --lagoon-yaml="$lagoonyml" && exit 1
ln -fs "$lagoonyml" .lagoon.yml
$LINTER && exit 1
done

# profile: deprecated
for lagoonyml in ./internal/lagoonyml/deprecated/testdata/valid.*.yml; do
echo "$lagoonyml"
rm -f .lagoon.yml
$LINTER validate --profile=deprecated --lagoon-yaml="$lagoonyml"
ln -fs "$lagoonyml" .lagoon.yml
$LINTER validate --profile=deprecated
done
for lagoonyml in ./internal/lagoonyml/deprecated/testdata/invalid.*.yml; do
echo "$lagoonyml"
rm -f .lagoon.yml
$LINTER validate --profile=deprecated --lagoon-yaml="$lagoonyml" && exit 1
ln -fs "$lagoonyml" .lagoon.yml
$LINTER validate --profile=deprecated && exit 1
done

exit 0

0 comments on commit add68d3

Please sign in to comment.