|
| 1 | +name: Lint and Test Helm Charts |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: read |
| 10 | + |
| 11 | +jobs: |
| 12 | + build-and-test: |
| 13 | + name: Test Helm charts |
| 14 | + runs-on: ubuntu-latest |
| 15 | + strategy: |
| 16 | + matrix: |
| 17 | + test-strategy: [chart_test, chart_test_parallel_autoscaling] |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v4 |
| 20 | + - name: Output Docker info |
| 21 | + run: docker info |
| 22 | + - name: Set up Python |
| 23 | + |
| 24 | + with: |
| 25 | + python-version: '3.11' |
| 26 | + check-latest: true |
| 27 | + - name: Get branch name (only for push to branch) |
| 28 | + if: github.event_name == 'push' |
| 29 | + run: echo "BRANCH=$(echo ${PUSH_BRANCH##*/})" >> $GITHUB_ENV |
| 30 | + env: |
| 31 | + PUSH_BRANCH: ${{ github.ref }} |
| 32 | + - name: Get target branch name (only for PRs) |
| 33 | + if: github.event_name == 'pull_request' |
| 34 | + run: echo "BRANCH=$(echo ${TARGET_BRANCH##*/})" >> $GITHUB_ENV |
| 35 | + env: |
| 36 | + TARGET_BRANCH: ${{ github.head_ref }} |
| 37 | + - name: Output branch name |
| 38 | + run: echo ${BRANCH} |
| 39 | + - name: Sets build date |
| 40 | + run: | |
| 41 | + echo "BUILD_DATE=$(date '+%Y%m%d')" >> $GITHUB_ENV |
| 42 | + echo "IMAGE_REGISTRY=artifactory/selenium" >> $GITHUB_ENV |
| 43 | + - name: Setup Kubernetes environment |
| 44 | + run: make chart_setup_env |
| 45 | + - name: Build Docker images |
| 46 | + run: NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make build |
| 47 | + - name: Build and lint charts |
| 48 | + run: | |
| 49 | + BUILD_DATE=${BUILD_DATE} make chart_build |
| 50 | + echo "CHART_PACKAGE_PATH=$(cat /tmp/selenium_chart_version)" >> $GITHUB_ENV |
| 51 | + echo "CHART_FILE_NAME=$(basename $(cat /tmp/selenium_chart_version))" >> $GITHUB_ENV |
| 52 | + - name: Setup Kubernetes cluster |
| 53 | + run: NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make chart_cluster_setup |
| 54 | + - name: Test Selenium Grid on Kubernetes |
| 55 | + uses: nick-invision/[email protected] |
| 56 | + with: |
| 57 | + timeout_minutes: 30 |
| 58 | + max_attempts: 3 |
| 59 | + command: | |
| 60 | + NAME=${IMAGE_REGISTRY} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} make ${{ matrix.test-strategy }} |
| 61 | + - name: Cleanup Kubernetes cluster |
| 62 | + if: always() |
| 63 | + run: make chart_cluster_cleanup |
| 64 | + - name: Upload Helm chart package |
| 65 | + if: always() |
| 66 | + uses: actions/upload-artifact@v3 |
| 67 | + with: |
| 68 | + name: ${{ env.CHART_FILE_NAME }} |
| 69 | + path: ${{ env.CHART_PACKAGE_PATH }} |
| 70 | + - name: Upload Helm chart template rendered |
| 71 | + if: always() |
| 72 | + uses: actions/upload-artifact@v3 |
| 73 | + with: |
| 74 | + name: chart_template_rendered.yaml |
| 75 | + path: ./tests/tests/output_deployment.yaml |
| 76 | + if-no-files-found: ignore |
0 commit comments