cde18639c7
- Fix traefik Portal Button - Touchup Security Policies - Update Support Policies - Re-Add Deluge as incubator App - Add Canary to Security Policies - Add all-contributors basic config
302 lines
8.7 KiB
YAML
302 lines
8.7 KiB
YAML
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"
|
|
|
|
common-lint:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
changed: ${{ steps.list-changed.outputs.changed }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- 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 (list-changed)
|
|
id: list-changed
|
|
run: |
|
|
changed=$(ct list-changed --config .github/ct-lint.yaml --chart-dirs 'library')
|
|
if [[ -n "$changed" ]]; then
|
|
echo "::set-output name=changed::true"
|
|
fi
|
|
|
|
- name: Run chart-testing (lint)
|
|
id: lint
|
|
if: steps.list-changed.outputs.changed == 'true'
|
|
run: ct lint --config .github/ct-lint.yaml --chart-dirs 'library'
|
|
|
|
|
|
common-test:
|
|
runs-on: ubuntu-latest
|
|
needs: common-lint
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
if: needs.common-lint.outputs.changed == 'true'
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: prep
|
|
if: needs.common-lint.outputs.changed == 'true'
|
|
run: |
|
|
rm -Rf library/common-test/values.yaml
|
|
touch library/common-test/values.yaml
|
|
|
|
- name: Install Helm
|
|
uses: azure/setup-helm@v1
|
|
if: needs.common-lint.outputs.changed == 'true'
|
|
with:
|
|
version: v3.5.3
|
|
|
|
- uses: actions/setup-python@v2
|
|
if: needs.common-lint.outputs.changed == 'true'
|
|
with:
|
|
python-version: 3.7
|
|
|
|
- name: Set up chart-testing
|
|
uses: helm/chart-testing-action@v2.0.1
|
|
if: needs.common-lint.outputs.changed == 'true'
|
|
|
|
- name: Create k3d cluster
|
|
uses: nolar/setup-k3d-k3s@v1
|
|
if: needs.common-lint.outputs.changed == 'true'
|
|
with:
|
|
version: v1.19
|
|
|
|
- name: Run chart-testing (install)
|
|
if: needs.common-lint.outputs.changed == 'true'
|
|
run: ct install --config .github/ct-install.yaml --charts 'library/common-test'
|
|
|
|
common-unittest:
|
|
runs-on: ubuntu-latest
|
|
needs: common-lint
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Install Dev tools
|
|
run: sudo apt-get update && sudo apt-get install -y jq libjq-dev
|
|
|
|
- name: Install Helm
|
|
uses: azure/setup-helm@v1
|
|
with:
|
|
version: v3.5.3
|
|
|
|
- name: Install Ruby
|
|
uses: ruby/setup-ruby@v1
|
|
with:
|
|
ruby-version: 2.7
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
export RUBYJQ_USE_SYSTEM_LIBRARIES=1
|
|
bundle install
|
|
- name: Run tests
|
|
run: |
|
|
bundle exec m -r .tools/tests/charts
|
|
|
|
pre-release:
|
|
if: needs.common-lint.outputs.changed == 'true'
|
|
needs: [common-test, common-unittest, catalog-test]
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
release: ${{ steps.prep.outputs.release }}
|
|
timeout-minutes: 5
|
|
steps:
|
|
- name: Prepare
|
|
id: prep
|
|
run: |
|
|
if [ "${{github.event_name}}" == "pull_request" ]; then
|
|
echo ::set-output name=release::false
|
|
else
|
|
echo ::set-output name=release::true
|
|
fi
|
|
- name: Block concurrent jobs
|
|
uses: softprops/turnstyle@v1
|
|
if: steps.prep.outputs.release == 'true'
|
|
with:
|
|
continue-after-seconds: 180
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
|
|
|
|
common-release:
|
|
needs: pre-release
|
|
runs-on: ubuntu-latest
|
|
if: needs.pre-release.outputs.release == 'true'
|
|
steps:
|
|
- name: Block concurrent jobs
|
|
uses: softprops/turnstyle@v1
|
|
with:
|
|
continue-after-seconds: 180
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
token: ${{ secrets.BOT_TOKEN }}
|
|
|
|
- name: Configure Git
|
|
run: |
|
|
git config user.name "TrueCharts-Bot"
|
|
git config user.email "bot@truecharts.org"
|
|
|
|
- name: Install Helm
|
|
uses: azure/setup-helm@v1
|
|
with:
|
|
version: v3.5.3
|
|
|
|
- name: Run chart-releaser
|
|
uses: helm/chart-releaser-action@v1.2.0
|
|
with:
|
|
charts_dir: library
|
|
charts_repo_url: ""
|
|
config: .github/cr.yaml
|
|
env:
|
|
CR_TOKEN: "${{ secrets.BOT_TOKEN }}"
|
|
|
|
- name: Commit and Push new index
|
|
run: |
|
|
git config user.name "TrueCharts-Bot"
|
|
git config user.email "bot@truecharts.org"
|
|
git add --all
|
|
git commit -sm "Commit chart-index updates" || exit 0
|
|
git push
|
|
|
|
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("(?<filepath>(?<first_directory>(?<root1>[\/]?)[^\/]+\/)(?<second_directory>(?<root2>[\/]?)[^\/]+)(?<extra_paths>.+))"; "\(.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, common-unittest, common-test]
|
|
name: Apps Test Complete
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: complete message
|
|
run: echo "App Tests Completed Successfully"
|