|
| 1 | +name: Unit and Integration Test - Helm |
| 2 | + |
| 3 | +on: |
| 4 | + - push |
| 5 | + - pull_request |
| 6 | + |
| 7 | +jobs: |
| 8 | + test-helm-chart: |
| 9 | + name: Test Helm Chart |
| 10 | + |
| 11 | + runs-on: ubuntu-latest |
| 12 | + |
| 13 | + steps: |
| 14 | + - name: Determine branch name |
| 15 | + id: get_branch |
| 16 | + run: | |
| 17 | + BRANCH="" |
| 18 | + if [ "${{ github.event_name }}" == "push" ]; then |
| 19 | + BRANCH=${{ github.ref_name }} |
| 20 | + elif [ "${{ github.event_name }}" == "pull_request" ]; then |
| 21 | + BRANCH=${{ github.base_ref }} |
| 22 | + fi |
| 23 | + echo "Branch name: $BRANCH" |
| 24 | + echo "BRANCH=$BRANCH" >> "$GITHUB_OUTPUT" |
| 25 | +
|
| 26 | + - name: Checkout Code |
| 27 | + uses: actions/checkout@v4 |
| 28 | + with: |
| 29 | + fetch-depth: 0 |
| 30 | + |
| 31 | + - name: Set up chart-testing |
| 32 | + |
| 33 | + |
| 34 | + - name: Run chart-testing (list-changed) |
| 35 | + id: list-changed |
| 36 | + env: |
| 37 | + BRANCH: ${{ steps.get_branch.outputs.BRANCH }} |
| 38 | + run: | |
| 39 | + changed=$(ct list-changed --target-branch $BRANCH) |
| 40 | + if [[ -n "$changed" ]]; then |
| 41 | + echo "changed=true" >> "$GITHUB_OUTPUT" |
| 42 | + fi |
| 43 | +
|
| 44 | + - name: Run chart-testing (lint) |
| 45 | + if: steps.list-changed.outputs.changed == 'true' |
| 46 | + env: |
| 47 | + BRANCH: ${{ steps.get_branch.outputs.BRANCH }} |
| 48 | + run: | |
| 49 | + ct lint --check-version-increment=false --target-branch $BRANCH |
| 50 | +
|
| 51 | + - name: Run Helm unittest |
| 52 | + if: steps.list-changed.outputs.changed == 'true' |
| 53 | + run: | |
| 54 | + make helm-unittest |
| 55 | +
|
| 56 | + - name: Produce the Helm documentation |
| 57 | + if: steps.list-changed.outputs.changed == 'true' |
| 58 | + run: | |
| 59 | + make helm-docs |
| 60 | + if ! git diff --quiet -- charts/kubeflow-trainer/README.md; then |
| 61 | + echo "Need to re-run 'make helm-docs' and commit the changes." |
| 62 | + false |
| 63 | + fi |
| 64 | +
|
| 65 | + - name: Create kind cluster |
| 66 | + if: steps.list-changed.outputs.changed == 'true' |
| 67 | + |
| 68 | + |
| 69 | + - name: Run chart-testing (install) |
| 70 | + if: steps.list-changed.outputs.changed == 'true' |
| 71 | + env: |
| 72 | + BRANCH: ${{ steps.get_branch.outputs.BRANCH }} |
| 73 | + run: | |
| 74 | + ct install --target-branch $BRANCH |
0 commit comments