test-chart.yml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. # This is a GitHub workflow defining a set of jobs with a set of steps.
  2. # ref: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
  3. #
  4. name: Test chart
  5. on:
  6. pull_request:
  7. paths:
  8. - "chart/**"
  9. - "!**.md"
  10. - ".github/workflows/test-chart.yml"
  11. push:
  12. paths:
  13. - "chart/**"
  14. - "!**.md"
  15. - ".github/workflows/test-chart.yml"
  16. branches-ignore:
  17. - "dependabot/**"
  18. workflow_dispatch:
  19. permissions:
  20. contents: read
  21. defaults:
  22. run:
  23. working-directory: chart
  24. jobs:
  25. lint-templates:
  26. runs-on: ubuntu-22.04
  27. steps:
  28. - uses: actions/checkout@v3
  29. - uses: actions/setup-python@v4
  30. with:
  31. python-version: "3.x"
  32. - name: Install dependencies (yamllint)
  33. run: pip install yamllint
  34. - run: helm dependency update
  35. - name: helm lint
  36. run: |
  37. helm lint . \
  38. --values dev-values.yaml
  39. - name: helm template
  40. run: |
  41. helm template . \
  42. --values dev-values.yaml \
  43. --output-dir rendered-templates
  44. - name: yamllint (only on templates we manage)
  45. run: |
  46. rm -rf rendered-templates/mastodon/charts
  47. yamllint rendered-templates \
  48. --config-data "{rules: {indentation: {spaces: 2}, line-length: disable}}"
  49. # This job helps us validate that rendered templates are valid k8s resources
  50. # against a k8s api-server, via "helm template --validate", but also that a
  51. # basic configuration can be used to successfully startup mastodon.
  52. #
  53. test-install:
  54. runs-on: ubuntu-22.04
  55. timeout-minutes: 15
  56. strategy:
  57. fail-fast: false
  58. matrix:
  59. include:
  60. # k3s-channel reference: https://update.k3s.io/v1-release/channels
  61. - k3s-channel: latest
  62. - k3s-channel: stable
  63. # This represents the oldest configuration we test against.
  64. #
  65. # The k8s version chosen is based on the oldest still supported k8s
  66. # version among two managed k8s services, GKE, EKS.
  67. # - GKE: https://endoflife.date/google-kubernetes-engine
  68. # - EKS: https://endoflife.date/amazon-eks
  69. #
  70. # The helm client's version can influence what helper functions is
  71. # available for use in the templates, currently we need v3.6.0 or
  72. # higher.
  73. #
  74. - k3s-channel: v1.21
  75. helm-version: v3.6.0
  76. steps:
  77. - uses: actions/checkout@v3
  78. # This action starts a k8s cluster with NetworkPolicy enforcement and
  79. # installs both kubectl and helm.
  80. #
  81. # ref: https://github.com/jupyterhub/action-k3s-helm#readme
  82. #
  83. - uses: jupyterhub/action-k3s-helm@v3
  84. with:
  85. k3s-channel: ${{ matrix.k3s-channel }}
  86. helm-version: ${{ matrix.helm-version }}
  87. metrics-enabled: false
  88. traefik-enabled: false
  89. docker-enabled: false
  90. - run: helm dependency update
  91. # Validate rendered helm templates against the k8s api-server
  92. - name: helm template --validate
  93. run: |
  94. helm template --validate mastodon . \
  95. --values dev-values.yaml
  96. - name: helm install
  97. run: |
  98. helm install mastodon . \
  99. --values dev-values.yaml \
  100. --timeout 10m
  101. # This actions provides a report about the state of the k8s cluster,
  102. # providing logs etc on anything that has failed and workloads marked as
  103. # important.
  104. #
  105. # ref: https://github.com/jupyterhub/action-k8s-namespace-report#readme
  106. #
  107. - name: Kubernetes namespace report
  108. uses: jupyterhub/action-k8s-namespace-report@v1
  109. if: always()
  110. with:
  111. important-workloads: >-
  112. deploy/mastodon-sidekiq
  113. deploy/mastodon-streaming
  114. deploy/mastodon-web
  115. job/mastodon-assets-precompile
  116. job/mastodon-chewy-upgrade
  117. job/mastodon-create-admin
  118. job/mastodon-db-migrate