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:
|
|
|
|
- '**'
|
2021-12-05 11:03:37 +00:00
|
|
|
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
|
2021-12-10 15:32:28 +00:00
|
|
|
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # renovate: tag=v2
|
2021-05-09 16:11:00 +00:00
|
|
|
- uses: dorny/paths-filter@v2
|
|
|
|
id: filter
|
|
|
|
with:
|
|
|
|
list-files: json
|
|
|
|
filters: |
|
|
|
|
changed:
|
2021-10-15 09:39:41 +00:00
|
|
|
- 'charts/dev/**'
|
2021-05-09 16:27:07 +00:00
|
|
|
- 'charts/stable/**'
|
|
|
|
- 'charts/incubator/**'
|
2021-11-08 13:55:20 +00:00
|
|
|
- 'charts/dependency/**'
|
2021-05-09 16:27:07 +00:00
|
|
|
- 'charts/library/**'
|
2021-11-14 10:43:45 +00:00
|
|
|
- 'charts/core/**'
|
2022-02-04 20:06:27 +00:00
|
|
|
- 'charts/enterprise/**'
|
|
|
|
- 'charts/games/**'
|
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' }}
|
2021-12-10 15:32:28 +00:00
|
|
|
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # renovate: tag=v2
|
2021-05-19 18:51:35 +00:00
|
|
|
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-12-10 15:32:28 +00:00
|
|
|
uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed # renovate: tag=v2
|
2021-08-17 10:58:53 +00:00
|
|
|
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"
|
2021-10-15 09:39:41 +00:00
|
|
|
elif test -f "./charts/dev/${{ matrix.app }}/Chart.yaml"; then
|
|
|
|
train="dev"
|
2021-11-08 13:55:20 +00:00
|
|
|
elif test -f "./charts/dependency/${{ matrix.app }}/Chart.yaml"; then
|
|
|
|
train="dependency"
|
2021-11-14 10:43:45 +00:00
|
|
|
elif test -f "./charts/core/${{ matrix.app }}/Chart.yaml"; then
|
|
|
|
train="core"
|
2022-02-04 20:06:27 +00:00
|
|
|
elif test -f "./charts/games/${{ matrix.app }}/Chart.yaml"; then
|
|
|
|
train="games"
|
|
|
|
elif test -f "./charts/enterprise/${{ matrix.app }}/Chart.yaml"; then
|
|
|
|
train="enterprise"
|
2021-05-19 18:51:35 +00:00
|
|
|
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}
|
2021-10-10 13:06:42 +00:00
|
|
|
if test -f "./charts/${train}/${{ matrix.app }}/SKIPINSTALL"; then
|
|
|
|
install='false'
|
|
|
|
echo "::set-output name=install::false"
|
2021-05-19 18:51:35 +00:00
|
|
|
else
|
2021-10-10 13:06:42 +00:00
|
|
|
install="true"
|
|
|
|
echo "::set-output name=install::true"
|
2021-05-19 18:51:35 +00:00
|
|
|
fi
|
2021-10-13 09:50:58 +00:00
|
|
|
sudo groupadd apps -g 568
|
|
|
|
sudo useradd apps -u 568 -g 568 -d /home/apps -s /bin/bash
|
2021-05-19 18:51:35 +00:00
|
|
|
|
2021-09-28 22:11:52 +00:00
|
|
|
- name: Install Helm
|
|
|
|
if: ${{ matrix.app != '.gitkee' }}
|
2021-12-10 15:32:28 +00:00
|
|
|
uses: azure/setup-helm@18bc76811624f360dbd7f18c2d4ecb32c7b87bab # renovate: tag=v1
|
2021-09-28 22:11:52 +00:00
|
|
|
with:
|
2021-12-05 11:08:10 +00:00
|
|
|
version: v3.7.1
|
2021-09-28 22:11:52 +00:00
|
|
|
|
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
|
2021-11-10 16:35:49 +00:00
|
|
|
helm repo add metallb https://metallb.github.io/metallb
|
2021-11-21 20:52:23 +00:00
|
|
|
helm repo add grafana https://grafana.github.io/helm-charts
|
2021-11-21 21:37:45 +00:00
|
|
|
helm repo add prometheus https://prometheus-community.github.io/helm-charts
|
2022-01-12 20:29:12 +00:00
|
|
|
helm repo add amd-gpu-helm https://radeonopencompute.github.io/k8s-device-plugin/
|
2021-08-17 12:16:30 +00:00
|
|
|
helm repo update
|
|
|
|
|
2022-02-28 15:10:22 +00:00
|
|
|
- uses: actions/setup-python@0ebf233433c08fb9061af664d501c3f3ff0e9e20 # tag=v3
|
2021-09-28 22:11:52 +00:00
|
|
|
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' }}
|
2022-01-08 10:39:00 +00:00
|
|
|
uses: helm/chart-testing-action@6b64532d456fa490a3da177fbd181ac4c8192b58 # renovate: tag=v2.2.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
|
2021-10-10 13:06:42 +00:00
|
|
|
if: ${{ matrix.app != 'common' && matrix.app != '.gitkee' && steps.prep-lint.outputs.install != 'false' }}
|
2021-05-09 16:11:00 +00:00
|
|
|
uses: nolar/setup-k3d-k3s@v1
|
|
|
|
with:
|
2021-12-05 10:55:41 +00:00
|
|
|
version: v1.22.4+k3s1
|
2021-05-09 16:11:00 +00:00
|
|
|
|
|
|
|
## TODO: Fix common-test
|
|
|
|
- name: Run chart-testing (install)
|
2021-10-10 13:06:42 +00:00
|
|
|
if: ${{ matrix.app != 'common' && matrix.app != '.gitkee' && steps.prep-lint.outputs.install != 'false' }}
|
2021-12-05 10:55:41 +00:00
|
|
|
run: find ./ -type f -name *.yaml -exec sed -i 's/tccr.io/ghcr.io/gI' {} \; && ct install --config .github/ct-install.yaml --charts 'charts/${{ steps.prep-lint.outputs.train }}/${{ matrix.app }}'
|
2021-05-09 16:11:00 +00:00
|
|
|
|
|
|
|
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-12-04 17:35:37 +00:00
|
|
|
image: ghcr.io/truecharts/devcontainer:v2.2.1
|
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-12-10 15:32:28 +00:00
|
|
|
uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed # renovate: tag=v2
|
2021-08-17 12:04:31 +00:00
|
|
|
with:
|
|
|
|
key: helmrepocache-${{ github.sha }}
|
|
|
|
path: |
|
|
|
|
~/.cache/helm/repository
|
|
|
|
~/.config/helm/repositories.yaml
|
|
|
|
|
2021-12-10 15:32:28 +00:00
|
|
|
- uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # renovate: tag=v2
|
2021-05-09 16:11:00 +00:00
|
|
|
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
|
2021-12-10 15:32:28 +00:00
|
|
|
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # renovate: tag=v2
|
2021-05-23 11:14:54 +00:00
|
|
|
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-12-04 14:20:01 +00:00
|
|
|
tools/build-release.sh --config .github/cr.yaml
|