Skip to content

[Test] Feat/add host aliases #323

[Test] Feat/add host aliases

[Test] Feat/add host aliases #323

Workflow file for this run

name: Continuous Integration
on:
pull_request:
types: [opened, synchronize, labeled]
concurrency:
group: ${{ github.head_ref }}
cancel-in-progress: true
jobs:
# JOB to run change detection
changes:
runs-on: ubuntu-22.04
outputs:
# Expose matched filters as job 'charts' output variable
charts: ${{ steps.changes.outputs.charts }}
# flag of file changes
changed: ${{ steps.changes.outputs.changed }}
steps:
- name: Checkout
uses: actions/checkout@v2
# For pull requests it's not necessary to checkout the code
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
# Match all, excluding README.md and README.md.gotmpl (micromatch syntax)
rasa:
- '!(charts/rasa/README*)charts/rasa/**'
rasa-action-server:
- '!(charts/rasa-action-server/README*)charts/rasa-action-server/**'
duckling:
- '!(charts/duckling/README*)charts/duckling/**'
rasa-common:
- '!(charts/rasa-common/README*)charts/rasa-common/**'
- name: Print output
id: changes
run: |
CHANGED=${{ fromJSON(steps.filter.outputs.changes)[0] != null }}
echo "::set-output name=changed::${CHANGED}"
if [[ "${CHANGED}" == "true" ]]; then
echo "::set-output name=charts::${{ toJSON(steps.filter.outputs.changes) }}"
else
echo "::set-output name=charts::[\"rasa\"]"
fi
lint-chart:
runs-on: ubuntu-22.04
needs: changes
steps:
- name: Checkout
if: needs.changes.outputs.changed == 'true'
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Helm
if: needs.changes.outputs.changed == 'true'
uses: azure/setup-helm@v3
with:
version: v3.11.2
# helm/chart-testing-action requires python version >= 3.7
# see: https://github.com/helm/chart-testing-action/issues/65
- uses: actions/setup-python@v2
if: needs.changes.outputs.changed == 'true'
with:
python-version: 3.7
- name: Set up chart-testing
if: needs.changes.outputs.changed == 'true'
uses: helm/chart-testing-action@v2.1.0
- name: Run chart-testing (lint)
if: needs.changes.outputs.changed == 'true'
run: ct lint --config .github/.ct.yaml
unit-tests:
runs-on: ubuntu-22.04
needs: changes
strategy:
matrix:
test:
- ./test/common
- ./charts/rasa/test
- ./charts/rasa-action-server/test
- ./charts/duckling/test
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '^1.20.2'
- name: Download dependencies
working-directory: ${{ matrix.test }}
run: go mod download -x all
- name: Helm dependency update
run: |
cd ./charts
for x in `ls`; do helm dependency update ./${x}; done
- name: Run tests
working-directory: ${{ matrix.test }}
run: |
helm repo add rasa https://helm.rasa.com
go mod tidy
go test -v
kubeval-chart:
runs-on: ubuntu-22.04
needs: changes
strategy:
matrix:
# When changing versions here, check that the version exists at: https://github.com/instrumenta/kubernetes-json-schema
k8s:
- v1.14.10
- v1.16.4
- v1.18.1
chart: ${{ fromJSON(needs.changes.outputs.charts) }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: v3.11.2
- name: Render template
run: |
helm dep up charts/${{ matrix.chart }}
helm template -f .github/kubeval.values.yaml charts/${{ matrix.chart }} > ${{ matrix.chart }}.yaml
- name: Run kubeval
uses: instrumenta/kubeval-action@5915e4adba5adccac07cb156b82e54c3fed74921
env:
KUBEVAL_SCHEMA_LOCATION: https://kubernetesjsonschema.dev/
with:
files: ${{ matrix.chart }}.yaml
ignore_missing_schemas: true
install-chart:
name: Install chart
runs-on: ubuntu-20.04
needs:
- lint-chart
- kubeval-chart
- changes
strategy:
matrix:
k8s:
- v1.14.10
- v1.16.9
- v1.18.4
chart: ${{ fromJSON(needs.changes.outputs.charts) }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Create kind ${{ matrix.k8s }} cluster
uses: helm/kind-action@94729529f85113b88f4f819c17ce61382e6d8478 # v1.2.0
with:
node_image: kindest/node:${{ matrix.k8s }}
- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: v3.11.2
- name: Install chart
run: |
helm dep up charts/${{ matrix.chart }}
helm install ${{ matrix.chart }} charts/${{ matrix.chart }}
- name: Test Rasa
timeout-minutes: 10
if: matrix.chart == 'rasa'
run: |
until kubectl wait --timeout=10s --for=condition=Ready --selector app.kubernetes.io/name=rasa pod; do
kubectl get pods
sleep 1
done
kubectl logs -c rasa-oss -l app.kubernetes.io/name=rasa
kubectl get svc
export SERVICE_PORT=$(kubectl get -o jsonpath="{.spec.ports[0].port}" services rasa)
kubectl port-forward svc/rasa ${SERVICE_PORT}:${SERVICE_PORT} &
until `nc -w 2 -z 127.0.0.1 ${SERVICE_PORT}`; do
echo "Waiting for ${SERVICE_PORT} port to be available."
sleep 1
done
curl -s http://127.0.0.1:${SERVICE_PORT}/
validate:
name: Validate the PR
runs-on: ubuntu-22.04
needs:
- unit-tests
- kubeval-chart
- install-chart
steps:
- name: Validate the PR
run: echo "All good!"