From 4c0055ddf04bf01be1878e7403834a547a6c677d Mon Sep 17 00:00:00 2001 From: Kostas Kyrimis Date: Tue, 6 Feb 2024 10:27:10 +0200 Subject: [PATCH] feat: move lint test chart to seperate action and trigger it on reg tests (#2536) * move lint test chart to a separate action * use it in regression tests --- .github/actions/lint-test-chart/action.yml | 61 ++++++++++++++++++++++ .github/workflows/ci.yml | 54 +------------------ .github/workflows/regression-tests.yml | 6 +++ 3 files changed, 69 insertions(+), 52 deletions(-) create mode 100644 .github/actions/lint-test-chart/action.yml diff --git a/.github/actions/lint-test-chart/action.yml b/.github/actions/lint-test-chart/action.yml new file mode 100644 index 000000000..45393a895 --- /dev/null +++ b/.github/actions/lint-test-chart/action.yml @@ -0,0 +1,61 @@ +name: Lint test chart +description: "Run lint test chart" + +runs: + using: "composite" + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set up Helm + uses: azure/setup-helm@v3 + + - uses: actions/setup-python@v5 + with: + python-version: "3.9" + check-latest: true + + - name: Chart Rendering Tests + shell: bash + run: | + go test -v ./contrib/charts/dragonfly/... + + - name: Set up chart-testing + uses: helm/chart-testing-action@v2.6.1 + + - name: Run chart-testing (list-changed) + id: list-changed + shell: bash + run: | + changed=$(ct list-changed --config .ct.yaml) + if [[ -n "$changed" ]]; then + echo "changed=true" >> $GITHUB_OUTPUT + fi + + - name: Run chart-testing (lint) + shell: bash + run: | + ct \ + lint \ + --config .ct.yaml \ + ${{github.event_name == 'workflow_dispatch' && '--all'}} ; + + - name: Create kind cluster + uses: helm/kind-action@v1.8.0 + + - name: Getting cluster ready + shell: bash + run: | + kubectl label nodes chart-testing-control-plane key/node-kind=high-memory + + - name: Run chart-testing (install) + shell: bash + run: | + ct \ + install \ + --config .ct.yaml \ + --debug \ + --helm-extra-set-args "--set=image.repository=ghcr.io/${{ github.repository }},probes=null" \ + ${{github.event_name == 'workflow_dispatch' && '--all'}} ; diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e42d2fb9c..d623963b8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -146,55 +146,5 @@ jobs: lint-test-chart: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Set up Helm - uses: azure/setup-helm@v3 - - - uses: actions/setup-python@v5 - with: - python-version: "3.9" - check-latest: true - - - name: Chart Rendering Tests - run: | - go test -v ./contrib/charts/dragonfly/... - - - name: Set up chart-testing - uses: helm/chart-testing-action@v2.6.1 - - - name: Run chart-testing (list-changed) - id: list-changed - run: | - changed=$(ct list-changed --config .ct.yaml) - if [[ -n "$changed" ]]; then - echo "changed=true" >> $GITHUB_OUTPUT - fi - - - name: Run chart-testing (lint) - run: | - ct \ - lint \ - --config .ct.yaml \ - ${{github.event_name == 'workflow_dispatch' && '--all'}} ; - - - if: steps.list-changed.outputs.changed == 'true' || github.event_name == 'workflow_dispatch' - name: Create kind cluster - uses: helm/kind-action@v1.8.0 - - - if: steps.list-changed.outputs.changed == 'true' || github.event_name == 'workflow_dispatch' - name: Getting cluster ready - run: | - kubectl label nodes chart-testing-control-plane key/node-kind=high-memory - - - name: Run chart-testing (install) - run: | - ct \ - install \ - --config .ct.yaml \ - --debug \ - --helm-extra-set-args "--set=image.repository=ghcr.io/${{ github.repository }},probes=null" \ - ${{github.event_name == 'workflow_dispatch' && '--all'}} ; + - uses: actions/checkout@v3 + - uses: ./.github/actions/lint-test-chart diff --git a/.github/workflows/regression-tests.yml b/.github/workflows/regression-tests.yml index 3393d9d06..80be73544 100644 --- a/.github/workflows/regression-tests.yml +++ b/.github/workflows/regression-tests.yml @@ -48,3 +48,9 @@ jobs: with: name: logs path: /tmp/dragonfly.* + + lint-test-chart: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: ./.github/actions/lint-test-chart