charts_tests.yaml 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. name: Charts Tests
  2. on:
  3. pull_request:
  4. paths:
  5. - library/**
  6. - '!library/common'
  7. - '!library/common-test'
  8. - .github/ct-install-config/**
  9. - '!.github/ct-install-config/common*'
  10. - .github/workflows/charts_test.yaml
  11. jobs:
  12. lint:
  13. name: Lint Charts
  14. runs-on: ubuntu-22.04
  15. strategy:
  16. fail-fast: false
  17. matrix:
  18. helm-version:
  19. - v3.9.4
  20. - v3.10.3
  21. - v3.12.1
  22. steps:
  23. - name: Checkout
  24. uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # tag=v4.1.1
  25. with:
  26. # Depth 0 is required for chart-testing to work properly
  27. fetch-depth: 0
  28. - name: Install Helm
  29. uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # tag=v3
  30. with:
  31. version: ${{ matrix.helm-version }}
  32. - uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # tag=v4
  33. with:
  34. python-version: "3.10"
  35. - name: Set up chart-testing
  36. uses: helm/chart-testing-action@b43128a8b25298e1e7b043b78ea6613844e079b1 # tag=v2.6.0
  37. - name: Run chart-testing (lint)
  38. id: lint
  39. run: |
  40. ct lint --config .github/ct-install-config/charts-ct-lint.yaml
  41. list-changed:
  42. needs:
  43. - lint
  44. name: List Changed Charts
  45. runs-on: ubuntu-22.04
  46. outputs:
  47. changed_json: ${{ steps.list-changed.outputs.changed_json }}
  48. steps:
  49. - name: Checkout
  50. uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # tag=v4.1.1
  51. with:
  52. # Depth 0 is required for chart-testing to work properly
  53. fetch-depth: 0
  54. - name: Set up chart-testing
  55. uses: helm/chart-testing-action@b43128a8b25298e1e7b043b78ea6613844e079b1 # tag=v2.6.0
  56. - name: List Changed Charts
  57. id: list-changed
  58. shell: bash
  59. run: |
  60. changed_json=$(ct list-changed \
  61. --config .github/ct-install-config/charts-ct-install.yaml | \
  62. jq --raw-input '.' | jq --compact-output --slurp '.')
  63. echo "changed_json=$changed_json" >> $GITHUB_OUTPUT
  64. echo 'Detected changes in the following charts:'
  65. echo "$changed_json" | jq --raw-output '.[]'
  66. install:
  67. needs:
  68. - lint
  69. - list-changed
  70. name: Install Chart
  71. runs-on: ubuntu-22.04
  72. strategy:
  73. fail-fast: false
  74. matrix:
  75. chart: ${{ fromJson(needs.list-changed.outputs.changed_json) }}
  76. # We run tests on Helm version of latest SCALE release, SCALE nightly and manually defined "latest"
  77. helm-version:
  78. - v3.9.4
  79. - v3.12.1
  80. # We run tests on k3s version of latest SCALE release
  81. k3s-version:
  82. - v1.26.6+k3s1
  83. steps:
  84. - name: Checkout
  85. uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # tag=v4.1.1
  86. with:
  87. # Depth 0 is required for chart-testing to work properly
  88. fetch-depth: 0
  89. - name: Install Helm
  90. uses: azure/setup-helm@f382f75448129b3be48f8121b9857be18d815a82 # tag=v3
  91. with:
  92. version: ${{ matrix.helm-version }}
  93. - uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # tag=v4
  94. with:
  95. python-version: "3.10"
  96. - name: Set up chart-testing
  97. uses: helm/chart-testing-action@b43128a8b25298e1e7b043b78ea6613844e079b1 # tag=v2.6.0
  98. - name: Create k3d cluster - Attempt 1/3
  99. continue-on-error: true
  100. id: createc1
  101. uses: nolar/setup-k3d-k3s@293b8e5822a20bc0d5bcdd4826f1a665e72aba96 # tag=v1.0.9
  102. with:
  103. github-token: ${{ secrets.GITHUB_TOKEN }}
  104. version: ${{ matrix.k3s-version }}
  105. # Flags found here https://github.com/k3d-io/k3d
  106. k3d-args: --k3s-arg --disable=metrics-server@server:*
  107. - name: Wait 10 second to retry
  108. if: steps.createc1.outcome=='failure'
  109. run: |
  110. sleep 10
  111. - name: Create k3d cluster - Attempt 2/3
  112. continue-on-error: true
  113. if: steps.createc1.outcome=='failure'
  114. id: createc2
  115. uses: nolar/setup-k3d-k3s@293b8e5822a20bc0d5bcdd4826f1a665e72aba96 # tag=v1.0.9
  116. with:
  117. github-token: ${{ secrets.GITHUB_TOKEN }}
  118. version: ${{ matrix.k3s-version }}
  119. # Flags found here https://github.com/k3d-io/k3d
  120. k3d-args: --k3s-arg --disable=metrics-server@server:*
  121. - name: Wait 10 second to retry
  122. if: steps.createc2.outcome=='failure'
  123. run: |
  124. sleep 10
  125. - name: Create k3d cluster - Attempt 3/3
  126. id: createc3
  127. if: steps.createc2.outcome=='failure'
  128. uses: nolar/setup-k3d-k3s@293b8e5822a20bc0d5bcdd4826f1a665e72aba96 # tag=v1.0.9
  129. with:
  130. github-token: ${{ secrets.GITHUB_TOKEN }}
  131. version: ${{ matrix.k3s-version }}
  132. # Flags found here https://github.com/k3d-io/k3d
  133. k3d-args: --k3s-arg --disable=metrics-server@server:*
  134. - name: Run chart-testing (install)
  135. shell: bash
  136. run: |
  137. ct install --config .github/ct-install-config/charts-ct-install.yaml --charts ${{ matrix.chart }}