feat(workflows): Fail instantly on errors (#869) #21
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
name: Tests | |
on: | |
push: | |
branches: [staging] | |
pull_request: | |
types: [opened, synchronize, reopened] | |
branches: [staging] | |
paths: | |
- '**' | |
- '!.github/**' | |
- '.github/workflows/gotests.yaml' | |
jobs: | |
gounit: | |
name: Go unit tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: 1.20.6 | |
cache: false | |
- name: Set Go variables | |
id: goenv | |
run: | | |
{ | |
echo "cache=$(go env GOCACHE)" | |
echo "modcache=$(go env GOMODCACHE)" | |
echo "mod=$(go env GOMOD)" | |
} >>"$GITHUB_OUTPUT" | |
- name: Go caches | |
uses: actions/cache@v3 | |
with: | |
path: | | |
${{ steps.goenv.outputs.cache }} | |
${{ steps.goenv.outputs.modcache }} | |
key: ${{ github.job }}-${{ runner.os }}-go-${{ hashFiles(steps.goenv.outputs.mod) }} | |
restore-keys: | | |
${{ github.job }}-${{ runner.os }}-go- | |
- name: Run tests | |
run: make test-unit | |
e2e-cli: | |
name: kraft CLI end-to-end | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.20.6 | |
cache: false | |
- name: Set Go variables | |
id: goenv | |
run: | | |
{ | |
echo "cache=$(go env GOCACHE)" | |
echo "modcache=$(go env GOMODCACHE)" | |
echo "mod=$(go env GOMOD)" | |
} >>"$GITHUB_OUTPUT" | |
- name: Go caches | |
uses: actions/cache@v3 | |
with: | |
path: | | |
${{ steps.goenv.outputs.cache }} | |
${{ steps.goenv.outputs.modcache }} | |
key: ${{ github.job }}-${{ runner.os }}-go-${{ hashFiles(steps.goenv.outputs.mod) }} | |
restore-keys: | | |
${{ github.job }}-${{ runner.os }}-go- | |
- name: Run framework unit tests | |
run: go run github.com/onsi/ginkgo/v2/ginkgo -v -p -randomize-all ./test/e2e/framework/... | |
- name: Run e2e tests | |
env: | |
KRAFTKIT_NO_CHECK_UPDATES: true | |
DOCKER: '' | |
run: make test-e2e DISTDIR="$(go env GOPATH)"/bin |