port most recent changes from KAH (#478)

* port most recent changes from KAH

* add general shizzle

* add rests of go tests

* whoops

* hmm

* make pre-release wait more

* try another synthaxis

* okey...

* test-> tests

* Make unittests a bit more usefull
This commit is contained in:
Kjeld Schouten-Lebbing
2021-05-19 20:51:35 +02:00
committed by GitHub
parent fd43d79929
commit d3033f71fb
59 changed files with 2792 additions and 3956 deletions
+76 -23
View File
@@ -59,6 +59,80 @@ jobs:
echo "::set-output name=empty_matrix::false"
fi
app-unit-tests:
needs: [changes]
if: ${{ needs.changes.outputs.empty_matrix == 'false' }}
name: App Unit Tests
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJson(needs.changes.outputs.matrix) }}
fail-fast: false
steps:
- name: Checkout
if: ${{ matrix.app != '.gitkee' }}
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Prepare-Lint
if: ${{ matrix.app != '.gitkee' }}
id: prep-lint
run: |
if test -f "./charts/stable/${{ matrix.app }}/Chart.yaml"; then
train="stable"
elif test -f "./charts/incubator/${{ matrix.app }}/Chart.yaml"; then
train="incubator"
elif test -f "./charts/deprecated/${{ matrix.app }}/Chart.yaml"; then
train="deprecated"
elif test -f "./charts/non-free/${{ matrix.app }}/Chart.yaml"; then
train="non-free"
elif test -f "./charts/library/${{ matrix.app }}/Chart.yaml"; then
train="library"
else
train="develop"
fi
echo ::set-output name=train::${train}
if test -d "./charts/${train}/${{ matrix.app }}/tests/"; then
unittests='true'
echo "::set-output name=unittests::true"
else
unittests="false"
echo "::set-output name=unittests::false"
fi
- uses: actions/setup-go@v2
if: ${{ steps.prep-lint.outputs.unittests == 'true' }}
with:
go-version: '^1.16'
# Get values for cache paths to be used in later steps
- id: go-cache-paths
if: ${{ steps.prep-lint.outputs.unittests == 'true' }}
run: |
echo "::set-output name=go-build::$(go env GOCACHE)"
echo "::set-output name=go-mod::$(go env GOMODCACHE)"
# Cache go build cache, used to speedup go test
- name: Go Build Cache
if: ${{ steps.prep-lint.outputs.unittests == 'true' }}
uses: actions/cache@v2
with:
path: ${{ steps.go-cache-paths.outputs.go-build }}
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
- name: Download modules
if: ${{ steps.prep-lint.outputs.unittests == 'true' }}
run: |
go mod download
- name: Run tests
if: ${{ steps.prep-lint.outputs.unittests == 'true' }}
run: |
go test ./charts/.../tests -json | tee test.json
- name: Annotate tests
if: ${{ steps.prep-lint.outputs.unittests == 'true' }}
uses: guyarb/golang-test-annotations@v0.3.0
with:
test-results: test.json
app-tests:
needs: [changes]
if: ${{ needs.changes.outputs.empty_matrix == 'false' }}
@@ -104,16 +178,6 @@ jobs:
with:
python-version: 3.7
- name: Install Dev tools for unittests
if: ${{ matrix.app == 'common' && matrix.app != '.gitkee' }}
run: sudo apt-get update && sudo apt-get install -y jq libjq-dev
- name: Install Ruby for unittests
if: ${{ matrix.app == 'common' && matrix.app != '.gitkee' }}
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
- name: Set up chart-testing
if: ${{ matrix.app != '.gitkee' }}
uses: helm/chart-testing-action@v2.0.1
@@ -123,17 +187,6 @@ jobs:
id: lint
run: ct lint --config .github/ct-lint.yaml --charts 'charts/${{ steps.prep-lint.outputs.train }}/${{ matrix.app }}'
- name: Install dependencies
if: ${{ matrix.app == 'common' && matrix.app != '.gitkee' }}
run: |
export RUBYJQ_USE_SYSTEM_LIBRARIES=1
bundle install
- name: Run common unit tests
if: ${{ matrix.app == 'common' && matrix.app != '.gitkee' }}
run: |
bundle exec m -r tests
- name: Create k3d cluster
if: ${{ matrix.app != 'common' && matrix.app != '.gitkee' }}
uses: nolar/setup-k3d-k3s@v1
@@ -146,7 +199,7 @@ jobs:
run: ct install --config .github/ct-install.yaml --charts 'charts/${{ steps.prep-lint.outputs.train }}/${{ matrix.app }}'
app-tests-complete:
needs: [app-tests]
needs: [app-tests, app-unit-tests]
name: Apps Test Complete
runs-on: ubuntu-latest
steps:
@@ -154,7 +207,7 @@ jobs:
run: echo "App Tests Completed Successfully"
pre-release:
needs: [app-tests]
needs: [app-tests, app-unit-tests]
runs-on: ubuntu-latest
outputs:
release: ${{ steps.prep.outputs.release }}