2021-08-17 11:21:13 +00:00
|
|
|
name: "Apps: Tests"
|
2021-05-09 16:11:00 +00:00
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- '**'
|
|
|
|
tags-ignore:
|
|
|
|
- '**'
|
|
|
|
paths:
|
2021-05-09 16:25:25 +00:00
|
|
|
- 'charts/**'
|
2021-07-01 09:17:31 +00:00
|
|
|
- '.github/workflows/apps.test.yaml'
|
2021-05-09 16:11:00 +00:00
|
|
|
- '.github/ct-install.yaml'
|
|
|
|
- '.github/ct-lint.yaml'
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
changes:
|
|
|
|
name: Get changed Apps
|
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
outputs:
|
|
|
|
matrix: "{\"app\": ${{ steps.reduce.outputs.apps }} }"
|
|
|
|
empty_matrix: ${{ steps.reduce.outputs.empty_matrix }}
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- uses: dorny/paths-filter@v2
|
|
|
|
id: filter
|
|
|
|
with:
|
|
|
|
list-files: json
|
|
|
|
filters: |
|
|
|
|
changed:
|
2021-05-09 16:27:07 +00:00
|
|
|
- 'charts/stable/**'
|
|
|
|
- 'charts/incubator/**'
|
|
|
|
- 'charts/library/**'
|
2021-05-09 16:11:00 +00:00
|
|
|
- run: echo '${{ toJson(steps.filter.outputs) }}' > changes.json
|
|
|
|
- id: reduce
|
|
|
|
run: |
|
2021-05-09 16:48:14 +00:00
|
|
|
APPS=$(jq --raw-output '.changed_files | fromjson | .[] |= sub("(?<filepath>(?<first_directory>(?<root1>[\/]?)[^\/]+\/)(?<second_directory>(?<root2>[\/]?)[^\/]+\/)(?<third_directory>(?<root3>[\/]?)[^\/]+)(?<extra_paths>.+))"; "\(.third_directory)") | unique' changes.json)
|
2021-05-09 16:11:00 +00:00
|
|
|
echo ::set-output name=apps::${APPS}
|
2021-05-09 16:52:26 +00:00
|
|
|
if [ -z "${APPS[0]}" ]; then
|
|
|
|
echo "No Changed Apps"
|
|
|
|
echo "::set-output name=empty_matrix::true"
|
2021-05-09 16:11:00 +00:00
|
|
|
else
|
2021-05-09 16:47:43 +00:00
|
|
|
echo "Changed Apps: ${APPS[*]}"
|
2021-05-09 16:11:00 +00:00
|
|
|
echo "::set-output name=empty_matrix::false"
|
|
|
|
fi
|
|
|
|
|
2021-05-19 13:12:45 +00:00
|
|
|
app-tests:
|
2021-09-07 18:37:52 +00:00
|
|
|
needs: [changes]
|
2021-05-19 18:51:35 +00:00
|
|
|
if: ${{ needs.changes.outputs.empty_matrix == 'false' }}
|
2021-05-19 13:12:45 +00:00
|
|
|
name: App Tests
|
2021-09-28 22:11:52 +00:00
|
|
|
runs-on: ubuntu-20.04
|
2021-05-19 18:51:35 +00:00
|
|
|
strategy:
|
|
|
|
matrix: ${{ fromJson(needs.changes.outputs.matrix) }}
|
|
|
|
fail-fast: false
|
|
|
|
steps:
|
2021-05-19 13:12:45 +00:00
|
|
|
##
|
|
|
|
# GENERAL SECTION
|
|
|
|
##
|
2021-05-19 18:51:35 +00:00
|
|
|
- name: Checkout
|
|
|
|
if: ${{ matrix.app != '.gitkee' }}
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
2021-08-17 10:58:53 +00:00
|
|
|
- name: Cache helm repo cache
|
2021-08-17 12:10:04 +00:00
|
|
|
id: cache
|
2021-08-17 10:58:53 +00:00
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
2021-08-17 11:46:19 +00:00
|
|
|
key: helmrepocache-${{ github.sha }}
|
2021-08-17 10:58:53 +00:00
|
|
|
path: |
|
|
|
|
~/.cache/helm/repository
|
|
|
|
~/.config/helm/repositories.yaml
|
|
|
|
|
2021-05-19 18:51:35 +00:00
|
|
|
- name: Prepare-Lint
|
|
|
|
if: ${{ matrix.app != '.gitkee' }}
|
|
|
|
id: prep-lint
|
|
|
|
run: |
|
2021-09-03 10:07:03 +00:00
|
|
|
if test -f "./charts/incubator/${{ matrix.app }}/Chart.yaml"; then
|
2021-05-19 18:51:35 +00:00
|
|
|
train="incubator"
|
2021-09-03 10:16:39 +00:00
|
|
|
elif test -f "./charts/stable/${{ matrix.app }}/Chart.yaml"; then
|
2021-09-03 10:07:03 +00:00
|
|
|
train="stable"
|
2021-05-19 18:51:35 +00:00
|
|
|
elif test -f "./charts/library/${{ matrix.app }}/Chart.yaml"; then
|
|
|
|
train="library"
|
|
|
|
else
|
2021-08-23 19:32:52 +00:00
|
|
|
train="incubator"
|
2021-05-19 18:51:35 +00:00
|
|
|
fi
|
|
|
|
echo ::set-output name=train::${train}
|
|
|
|
if test -d "./charts/${train}/${{ matrix.app }}/tests/"; then
|
2021-05-19 13:12:45 +00:00
|
|
|
unittests='true'
|
2021-05-19 18:51:35 +00:00
|
|
|
echo "::set-output name=unittests::true"
|
|
|
|
else
|
|
|
|
unittests="false"
|
|
|
|
echo "::set-output name=unittests::false"
|
|
|
|
fi
|
|
|
|
|
2021-09-28 22:11:52 +00:00
|
|
|
- name: Install Helm
|
|
|
|
if: ${{ matrix.app != '.gitkee' }}
|
|
|
|
uses: azure/setup-helm@v1
|
|
|
|
with:
|
|
|
|
version: v3.5.3
|
|
|
|
|
2021-09-07 18:37:52 +00:00
|
|
|
- name: update helm repo cache
|
2021-08-17 12:16:30 +00:00
|
|
|
run: |
|
|
|
|
helm repo add truecharts https://truecharts.org
|
|
|
|
helm repo add bitnami https://charts.bitnami.com/bitnami
|
|
|
|
helm repo update
|
|
|
|
|
2021-09-28 22:11:52 +00:00
|
|
|
- uses: actions/setup-python@v2
|
|
|
|
if: ${{ matrix.app != '.gitkee' }}
|
|
|
|
with:
|
|
|
|
python-version: 3.7
|
|
|
|
|
2021-05-19 13:12:45 +00:00
|
|
|
- name: Set up chart-testing
|
|
|
|
if: ${{ matrix.app != '.gitkee' }}
|
2021-05-25 21:20:09 +00:00
|
|
|
uses: helm/chart-testing-action@v2.1.0
|
2021-05-19 13:12:45 +00:00
|
|
|
|
|
|
|
##
|
|
|
|
# Chart-Testing Section
|
|
|
|
##
|
2021-05-09 16:11:00 +00:00
|
|
|
|
|
|
|
- name: Run chart-testing (lint)
|
2021-09-28 22:11:52 +00:00
|
|
|
if: ${{ matrix.app != 'common' && matrix.app != '.gitkee' }}
|
2021-05-09 16:11:00 +00:00
|
|
|
id: lint
|
|
|
|
run: ct lint --config .github/ct-lint.yaml --charts 'charts/${{ steps.prep-lint.outputs.train }}/${{ matrix.app }}'
|
|
|
|
|
|
|
|
- name: Create k3d cluster
|
|
|
|
if: ${{ matrix.app != 'common' && matrix.app != '.gitkee' }}
|
|
|
|
uses: nolar/setup-k3d-k3s@v1
|
|
|
|
with:
|
|
|
|
version: v1.19
|
|
|
|
|
|
|
|
## TODO: Fix common-test
|
|
|
|
- name: Run chart-testing (install)
|
2021-05-10 12:13:17 +00:00
|
|
|
if: ${{ matrix.app != 'common' && matrix.app != '.gitkee' }}
|
2021-05-09 16:11:00 +00:00
|
|
|
run: ct install --config .github/ct-install.yaml --charts 'charts/${{ steps.prep-lint.outputs.train }}/${{ matrix.app }}'
|
|
|
|
|
|
|
|
app-tests-complete:
|
2021-05-19 13:12:45 +00:00
|
|
|
needs: [app-tests]
|
2021-05-09 16:11:00 +00:00
|
|
|
name: Apps Test Complete
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: complete message
|
|
|
|
run: echo "App Tests Completed Successfully"
|
|
|
|
|
2021-09-07 18:37:52 +00:00
|
|
|
release-test:
|
2021-05-09 16:11:00 +00:00
|
|
|
runs-on: ubuntu-latest
|
2021-07-01 09:14:51 +00:00
|
|
|
container:
|
2021-09-28 14:00:20 +00:00
|
|
|
image: ghcr.io/truecharts/devcontainer:v2.0.0
|
2021-05-09 16:11:00 +00:00
|
|
|
steps:
|
2021-08-17 12:04:31 +00:00
|
|
|
- name: Cache helm repo cache
|
2021-08-17 12:10:04 +00:00
|
|
|
id: cache
|
2021-08-17 12:04:31 +00:00
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
key: helmrepocache-${{ github.sha }}
|
|
|
|
path: |
|
|
|
|
~/.cache/helm/repository
|
|
|
|
~/.config/helm/repositories.yaml
|
|
|
|
|
2021-05-09 16:11:00 +00:00
|
|
|
- uses: actions/checkout@v2
|
|
|
|
name: Checkout
|
2021-05-23 11:14:54 +00:00
|
|
|
with:
|
2021-09-07 18:37:52 +00:00
|
|
|
fetch-depth: 100
|
|
|
|
|
2021-05-23 11:14:54 +00:00
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
repository: truecharts/catalog
|
|
|
|
path: catalog
|
2021-08-17 10:23:52 +00:00
|
|
|
|
2021-09-07 18:37:52 +00:00
|
|
|
- name: build-and-run
|
2021-05-09 16:11:00 +00:00
|
|
|
run: |
|
2021-09-07 18:37:52 +00:00
|
|
|
tools/build-release.sh --config .github/cr.yaml
|