Skip to content

Run CI tests only if Trino and Gateway file change #1062

Run CI tests only if Trino and Gateway file change

Run CI tests only if Trino and Gateway file change #1062

Workflow file for this run

# This workflow:
# - lints the chart, runs tests and verifies documentation is up to date
# Additionally if the event isn't a pull-request (and hence a merge/push to main):
# - sync README to gh-pages branch
# - release a new chart version if the version isn't already released
name: CI/CD
on:
push:
branches:
- main
pull_request:
# Cancel previous PR builds.
concurrency:
# Cancel all workflow runs except latest within a concurrency group. This is achieved by defining a concurrency group for the PR.
# Non-PR builds have singleton concurrency groups.
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.number || github.sha }}
cancel-in-progress: true
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up chart-testing
uses: helm/chart-testing-action@v2.7.0
- name: Lint charts
run: ct lint --charts=charts/trino,charts/gateway --validate-maintainers=false
changes:
runs-on: ubuntu-latest
name: Get changed trino/gateway related files
outputs:
trino-any-changed: ${{ steps.trino-changed-files.outputs.any_changed }}
gateway-any-changed: ${{ steps.gatway-changed-files.outputs.any_changed }}
steps:
- uses: actions/checkout@v4
# Detect changes in Trino-related files to conditionally run tests
- name: Get changed trino related files
id: trino-changed-files
uses: tj-actions/changed-files@v46.0.5
with:
files: |
charts/trino/**
tests/trino/**
.helmignore
!**/trino/**.md
# For PRs, use the base commit SHA; for Push events, use the commit before the current one
base_sha: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }}
# Detect changes in Gateway-related files to conditionally run tests
- name: Get changed gateway related files
id: gatway-changed-files
uses: tj-actions/changed-files@v46.0.5
with:
files: |
charts/gateway/**
tests/gateway/**
.helmignore
!**/gateway/**.md
# For PRs, use the base commit SHA; for Push events, use the commit before the current one
base_sha: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }}
test:
runs-on: ubuntu-latest
name: test trino ${{ matrix.label }}
needs: [changes]
if: ${{needs.changes.outputs.trino-any-changed == 'true'}}
strategy:
fail-fast: false
matrix:
include:
- { label: default, args: '' }
# last Trino version that requires JDK 21
- { label: 446, args: '-a "--set image.tag=446"' }
# last Trino version that requires JDK 17
- { label: 435, args: '-a "--set image.tag=435"' }
# skip cleanup to test deploying multiple releases in a single namespace
- { label: overrides, args: '-s -t default,overrides' }
steps:
- uses: actions/checkout@v4
- name: Set up Helm
uses: azure/setup-helm@v4
with:
version: v3.16.4
- name: Set up chart-testing
uses: helm/chart-testing-action@v2.7.0
- name: Create kind cluster
uses: helm/kind-action@v1.12.0
with:
version: v0.26.0
- name: Run tests
run: ./tests/trino/test.sh ${{ matrix.args }}
test-gateway:
runs-on: ubuntu-latest
name: test gateway ${{ matrix.label }}
needs: [changes]
if: ${{needs.changes.outputs.gateway-any-changed == 'true'}}
strategy:
fail-fast: false
matrix:
include:
- { label: default, args: '' }
steps:
- uses: actions/checkout@v4
- name: Set up Helm
uses: azure/setup-helm@v4
with:
version: v3.16.4
- name: Set up chart-testing
uses: helm/chart-testing-action@v2.7.0
# Create Kubernetes cluster only if Gateway-related files changed
- name: Create kind cluster
uses: helm/kind-action@v1.12.0
with:
version: v0.24.0
# Run gateway tests only if Gateway-related files changed
- name: Run gateway tests
run: ./tests/gateway/test.sh ${{ matrix.args }}
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- uses: pre-commit/action@v3.0.1
# Everything above is CI, everything here and below is for releases and runs only on non-pull-request events
sync-readme:
needs: [lint, test, test-gateway, docs]
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
steps:
- name: Checkout main
uses: actions/checkout@v4
with:
path: main
- name: Checkout gh-pages
uses: actions/checkout@v4
with:
ref: gh-pages
path: gh-pages
- name: Copy all README files from main to gh-pages
run: |
cd main
# cp --parents preserves directory structure
find . -name 'README.md' -exec cp --parents '{}' "../gh-pages/" ';'
- name: Commit changes to gh-pages and push
run: |
cd gh-pages
git add .
git config user.name "GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
# Commit only if changes exist to avoid failure in this step
git diff-index --quiet HEAD || git commit --signoff -m "Sync READMEs from main"
git push
release:
needs: [lint, test, test-gateway, docs, sync-readme]
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Release charts
uses: helm/chart-releaser-action@v1.7.0
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
CR_GENERATE_RELEASE_NOTES: true
# If we didn't bump the chart version then we can skip the release
CR_SKIP_EXISTING: true
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy