synapsecns/sanguine

View on GitHub
.github/workflows/helm-test.yml

Summary

Maintainability
Test Coverage
name: 'Helm Charts'

on:
  pull_request:
    paths:
      - 'charts/**'
  push:
    paths:
      - 'charts/**'
      - '.github/workflows/helm-test.yml'

# TODO: it'd be nice to eventually work this into release process on new images
# definitely not a right now thing
jobs:
  cancel-outdated:
    name: Cancel Outdated Jobs
    runs-on: ubuntu-latest
    steps:
      - id: skip_check
        if: ${{ format('refs/heads/{0}', github.event.repository.default_branch) != github.ref && !contains(github.event.head_commit.message, '[no_skip]') }}
        uses: fkirc/skip-duplicate-actions@v5
        with:
          cancel_others: 'true'

  lint-test:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        chart: [ 'agents_embedded', 'agents_remote', 'scribe', 'explorer', 'omnirpc' ]
    steps:
      - name: Checkout
        uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Set up Helm
        uses: azure/setup-helm@v1
        with:
          version: v3.9.2

      - uses: actions/setup-python@v5
        with:
          python-version: 3.7

      - name: Set up chart-testing
        uses: helm/chart-testing-action@v2.3.1

      - name: Install helm dependencies
        working-directory: charts/
        run: make dependencies

      # Even if there are no changes to the chart itself, if running `make lint` changes Chart.lock,
      # then lint-test will fail due to version bump. To solve this, run `make lint` and version bump.
      - name: Run chart-testing (list-changed)
        id: list-changed
        run: |
          changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }})
          if [[ -n '$changed' ]]; then
            echo "::set-output name=changed::true"
          fi

      - name: Run chart-testing (lint)
        run: ct lint --target-branch ${{ github.event.repository.default_branch }} --validate-maintainers=false

      - name: Create kind cluster
        uses: helm/kind-action@v1.4.0
        if: steps.list-changed.outputs.changed == 'true'

      - name: Run chart-testing (install)
        working-directory: charts/
        if: ${{ !contains(matrix.chart, 'agents_embedded') && !contains(matrix.chart, 'agents_remote') }}
        run: ct install --debug --chart-dirs "${{ matrix.chart }}" --charts "${{ matrix.chart }}"

#      - name: Run chart-testing (install agents embedded)
#        working-directory: charts/
#        if: ${{ contains(matrix.chart, 'agents_embedded') }}
#        run: ct install --debug --helm-extra-set-args "--set=executor.type=embedded  --set=scribe.enabled=false" --chart-dirs "agents" --charts "agents"

      - name: Run chart-testing (install agents remote)
        working-directory: charts/
        if: ${{ contains(matrix.chart, 'agents_remote') }}
        run: ct install --debug --helm-extra-set-args "--set=executor.type=remote-fresh" --chart-dirs "agents" --charts "agents"