name: "Apps: test" on: pull_request: branches: - '**' tags-ignore: - '**' paths: - 'stable/**' - '!stable/**/*.md' - '!stable/**/README.md' - '!stable/**/README.md.gotmpl' - '!stable/**/app-readme.md' - '!stable/**/app-readme.md.gotmpl' - '!stable/**/docs/*' - 'incubator/**' - '!incubator/**/*.md' - '!incubator/**/README.md' - '!incubator/**/README.md.gotmpl' - '!incubator/**/app-readme.md' - '!incubator/**/app-readme.md.gotmpl' - '!incubator/**/docs/*' - '.github/workflows/apps.test.yaml' jobs: catalog-test: runs-on: ubuntu-latest container: image: ixsystems/catalog_validation:latest steps: - uses: actions/checkout@v2 name: Checkout - name: Validate catalog format run: | /bin/bash -c "PWD=${pwd}; /usr/local/bin/catalog_validate validate --path $PWD" changes: name: Get changed Apps runs-on: ubuntu-20.04 outputs: matrix: "{\"app\": ${{ steps.reduce.outputs.apps }} }" steps: - name: Checkout uses: actions/checkout@v2 - uses: dorny/paths-filter@v2 id: filter with: list-files: json filters: | changed: - 'stable/**' - 'incubator/**' - run: echo '${{ toJson(steps.filter.outputs) }}' > changes.json - id: reduce run: | APPS=$(jq --raw-output '.changed_files | fromjson | .[] |= sub("(?(?(?[\/]?)[^\/]+\/)(?(?[\/]?)[^\/]+)(?.+))"; "\(.second_directory)") | unique' changes.json) echo ::set-output name=apps::${APPS} app-tests: needs: [catalog-test, changes] name: App Tests runs-on: ubuntu-latest strategy: matrix: ${{ fromJson(needs.changes.outputs.matrix) }} fail-fast: false steps: - name: Checkout uses: actions/checkout@v2 with: fetch-depth: 0 - name: Prepare-Lint id: prep-lint run: | if test -f "./stable/${{ matrix.app }}/item.yaml"; then train="stable" else train="incubator" fi echo ::set-output name=train::${train} maxfolderversion=$(ls -l ${train}/${{ matrix.app }} | grep ^d | awk '{print $9}' | tail -n 1) echo "Detected folder version: ${maxfolderversion}" mkdir ${train}/${{ matrix.app }}/${maxfolderversion}/ci || exit 0 cp ${train}/${{ matrix.app }}/${maxfolderversion}/test_values.yaml ${train}/${{ matrix.app }}/${maxfolderversion}/ci/test-values.yaml echo ::set-output name=maxfolderversion::${maxfolderversion} - name: Install Helm uses: azure/setup-helm@v1 with: version: v3.5.3 - uses: actions/setup-python@v2 with: python-version: 3.7 - name: Set up chart-testing uses: helm/chart-testing-action@v2.0.1 - name: Run chart-testing (lint) id: lint run: ct lint --config .github/ct-lint.yaml --charts '${{ steps.prep-lint.outputs.train }}/${{ matrix.app }}/${{ steps.prep-lint.outputs.maxfolderversion }}' - name: Prepare-Test run: | mv -f ${{ steps.prep-lint.outputs.train }}/${{ matrix.app }}/${{ steps.prep-lint.outputs.maxfolderversion }}/* ${{ steps.prep-lint.outputs.train }}/${{ matrix.app }}/ rm -Rf ${{ steps.prep-lint.outputs.train }}/${{ matrix.app }}/${{ steps.prep-lint.outputs.maxfolderversion }} - name: Create k3d cluster uses: nolar/setup-k3d-k3s@v1 with: version: v1.19 - name: Run chart-testing (install) run: ct install --config .github/ct-install.yaml --charts '${{ steps.prep-lint.outputs.train }}/${{ matrix.app }}' app-tests-complete: needs: [app-tests] name: Apps Test Complete runs-on: ubuntu-latest steps: - name: complete message run: echo "App Tests Completed Successfully"