Skip to content

Merge pull request #2 from paologallinaharbur/pr #5

Merge pull request #2 from paologallinaharbur/pr

Merge pull request #2 from paologallinaharbur/pr #5

Workflow file for this run

name: Push/PR pipeline
on:
pull_request:
paths:
# We triggers charts tests merely if charts files have been touched.
# E2e tests should be run anyway.
- 'deployment/charts/**'
push:
branches:
- main
paths:
- 'deployment/charts/**'
jobs:
chart-lint:
name: Helm chart Lint
runs-on: ubuntu-20.04
timeout-minutes: 10
strategy:
matrix:
kubernetes-version: [ "v1.16.15", "v1.22.0" ]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: helm/[email protected]
- uses: azure/setup-helm@v3
with:
version: 'v3.0.0'
- name: Lint charts
run: ct --config .github/ct.yaml lint --debug
- name: Check for changed installable charts
id: list-changed
run: |
changed=$(ct --config .github/ct.yaml list-changed)
if [[ -n "$changed" ]]; then
echo "::set-output name=changed::true"
fi
- name: Run helm unit tests
if: steps.list-changed.outputs.changed == 'true'
run: |
helm plugin install https://github.com/helm-unittest/helm-unittest
for chart in $(ct --config .github/ct.yaml list-changed); do
if [ -d "$chart/tests/" ]; then
helm unittest $chart
else
echo "No unit tests found for $chart"
fi
done
- name: Setup Minikube
uses: manusa/[email protected]
if: steps.list-changed.outputs.changed == 'true'
with:
minikube version: v1.32.0
kubernetes version: ${{ matrix.kubernetes-version }}
github token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-go@v5
if: steps.list-changed.outputs.changed == 'true'
with:
go-version-file: 'go.mod'
- name: Create image for chart testing
if: steps.list-changed.outputs.changed == 'true'
run: |
GOOS=linux GOARCH=amd64 make compile
DOCKER_BUILDKIT=1 docker build -t e2e/nri-kubernetes:test .
minikube image load e2e/nri-kubernetes:test
kubectl create ns ct
- name: Test install charts
if: steps.list-changed.outputs.changed == 'true'
run: ct install --namespace ct --config .github/ct.yaml --debug
- name: Test upgrade charts
if: steps.list-changed.outputs.changed == 'true'
run: ct install --namespace ct --config .github/ct.yaml --debug --upgrade