Merge pull request #477 from Ornias1993/4rework

Change Apps for Common 4.*
This commit is contained in:
Kjeld Schouten-Lebbing
2021-05-23 20:53:39 +02:00
committed by GitHub
181 changed files with 7954 additions and 9226 deletions

View File

@@ -59,15 +59,18 @@ jobs:
echo "::set-output name=empty_matrix::false"
fi
app-unit-tests:
app-tests:
needs: [changes]
if: ${{ needs.changes.outputs.empty_matrix == 'false' }}
name: App Unit Tests
name: App Tests
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJson(needs.changes.outputs.matrix) }}
fail-fast: false
steps:
##
# GENERAL SECTION
##
- name: Checkout
if: ${{ matrix.app != '.gitkee' }}
uses: actions/checkout@v2
@@ -93,80 +96,13 @@ jobs:
fi
echo ::set-output name=train::${train}
if test -d "./charts/${train}/${{ matrix.app }}/tests/"; then
unittests='true'
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' }}
name: App 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}
- name: Install Helm
if: ${{ matrix.app != '.gitkee' }}
uses: azure/setup-helm@v1
@@ -182,6 +118,61 @@ jobs:
if: ${{ matrix.app != '.gitkee' }}
uses: helm/chart-testing-action@v2.0.1
- uses: actions/setup-go@v2
if: ${{ steps.prep-lint.outputs.unittests == 'true' }}
with:
go-version: '^1.16'
##
# Unit-Test section
##
# 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 unit tests
if: ${{ steps.prep-lint.outputs.unittests == 'true' }}
run: |
go test ./charts/.../tests -json | tee test.json
- name: Annotate unit tests
if: ${{ steps.prep-lint.outputs.unittests == 'true' }}
uses: guyarb/golang-test-annotations@v0.3.0
with:
test-results: test.json
- name: Parse Unit Tests
if: ${{ steps.prep-lint.outputs.unittests == 'true' }}
run: |
if grep -q "FAIL" test.json
then
echo "Unit Test reported FAILED";
exit 1
else
echo "Unit Test reported OK";
exit 0
fi
##
# Chart-Testing Section
##
- name: Run chart-testing (lint)
if: ${{ matrix.app != '.gitkee' }}
id: lint
@@ -199,7 +190,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, app-unit-tests]
needs: [app-tests]
name: Apps Test Complete
runs-on: ubuntu-latest
steps:
@@ -207,7 +198,7 @@ jobs:
run: echo "App Tests Completed Successfully"
pre-release:
needs: [app-tests, app-unit-tests]
needs: [app-tests]
runs-on: ubuntu-latest
outputs:
release: ${{ steps.prep.outputs.release }}
@@ -233,10 +224,8 @@ jobs:
catalog-release:
runs-on: ubuntu-latest
needs: pre-release
if: needs.pre-release.outputs.release == 'true'
container:
image: ixsystems/catalog_validation:latest
steps:
- uses: actions/checkout@v2
name: Checkout
@@ -245,18 +234,33 @@ jobs:
with:
version: v3.5.3
- name: Checkout
if: ${{ needs.pre-release.outputs.release == 'true' }}
uses: actions/checkout@v2
with:
fetch-depth: 0
token: ${{ secrets.BOT_TOKEN }}
path: master
- name: Checkout
if: ${{ needs.pre-release.outputs.release == 'true' }}
uses: actions/checkout@v2
with:
fetch-depth: 0
repository: truecharts/catalog
token: ${{ secrets.BOT_TOKEN }}
path: catalog
- name: Checkout
if: ${{ needs.pre-release.outputs.release == 'false' }}
uses: actions/checkout@v2
with:
fetch-depth: 0
path: master
- name: Checkout
if: ${{ needs.pre-release.outputs.release == 'false' }}
uses: actions/checkout@v2
with:
fetch-depth: 0
repository: truecharts/catalog
path: catalog
- name: Remove if release already exists
run: |
for train in stable incubator develop non-free deprecated
@@ -323,6 +327,7 @@ jobs:
cd catalog
/bin/bash -c "PWD=${pwd}; /usr/local/bin/catalog_validate validate --path $PWD"
- name: Commit and Push new App releases
if: ${{ needs.pre-release.outputs.release == 'true' }}
run: |
cd catalog
git config user.name "TrueCharts-Bot"