mirror of
https://github.com/prometheus-operator/prometheus-operator.git
synced 2025-04-21 03:38:43 +00:00
.github/workflow: make execution of e2e and unit tests conditional
Ref: https://docs.github.com/en/actions/using-jobs/using-conditions-to-control-job-execution This will help to avoid blocking the merge on conditional execution when only markdown files are changed Signed-off-by: Jayapriya Pai <slashpai9@gmail.com>
This commit is contained in:
parent
a3563cc976
commit
07c873f627
4 changed files with 44 additions and 10 deletions
.github/workflows
27
.github/workflows/changed-files.yaml
vendored
Normal file
27
.github/workflows/changed-files.yaml
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
name: changed-files
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
outputs:
|
||||
non-markdown-files:
|
||||
description: "changed files list"
|
||||
value: ${{ jobs.changed-files.outputs.non-markdown-files }}
|
||||
|
||||
jobs:
|
||||
changed-files:
|
||||
# Map the job outputs to step outputs
|
||||
outputs:
|
||||
non-markdown-files : ${{ steps.changed-files.outputs.non-markdown-files}}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: checkout repo
|
||||
id: checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: get changed files
|
||||
id: changed-files
|
||||
run: |
|
||||
echo non-markdown-files=$(git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep -iv .md$ | xargs) >> $GITHUB_OUTPUT
|
||||
- run: |
|
||||
echo "${{ steps.changed-files.outputs.non-markdown-files}}"
|
8
.github/workflows/e2e-feature-gated.yaml
vendored
8
.github/workflows/e2e-feature-gated.yaml
vendored
|
@ -1,8 +1,6 @@
|
|||
name: e2e-feature-gated
|
||||
on:
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- '**/*.md'
|
||||
push:
|
||||
branches:
|
||||
- 'release-*'
|
||||
|
@ -10,15 +8,17 @@ on:
|
|||
- 'main'
|
||||
tags:
|
||||
- 'v*'
|
||||
paths-ignore:
|
||||
- '**/*.md'
|
||||
# To cancel running workflow when new commits pushed in a pull request
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
jobs:
|
||||
changed-files:
|
||||
uses: ./.github/workflows/changed-files.yaml
|
||||
e2e-tests:
|
||||
name: E2E tests for feature gates
|
||||
needs: changed-files
|
||||
if: ${{ needs.changed-files.outputs.non-markdown-files }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
|
11
.github/workflows/e2e.yaml
vendored
11
.github/workflows/e2e.yaml
vendored
|
@ -1,8 +1,6 @@
|
|||
name: e2e
|
||||
on:
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- '**/*.md'
|
||||
push:
|
||||
branches:
|
||||
- 'release-*'
|
||||
|
@ -10,16 +8,18 @@ on:
|
|||
- 'main'
|
||||
tags:
|
||||
- 'v*'
|
||||
paths-ignore:
|
||||
- '**/*.md'
|
||||
# To cancel running workflow when new commits pushed in a pull request
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
jobs:
|
||||
changed-files:
|
||||
uses: ./.github/workflows/changed-files.yaml
|
||||
e2e-tests:
|
||||
name: E2E tests
|
||||
runs-on: ubuntu-latest
|
||||
needs: changed-files
|
||||
if: ${{ needs.changed-files.outputs.non-markdown-files }}
|
||||
strategy:
|
||||
matrix:
|
||||
suite: [alertmanager, prometheus, prometheusAllNS, thanosruler, operatorUpgrade]
|
||||
|
@ -105,8 +105,9 @@ jobs:
|
|||
# Added to summarize the matrix and allow easy branch protection rules setup
|
||||
e2e-tests-result:
|
||||
name: End-to-End Test Results
|
||||
if: always()
|
||||
if: ${{ needs.changed-files.outputs.non-markdown-files }}
|
||||
needs:
|
||||
- changed-files
|
||||
- e2e-tests
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
|
8
.github/workflows/unit.yaml
vendored
8
.github/workflows/unit.yaml
vendored
|
@ -17,9 +17,13 @@ concurrency:
|
|||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: true
|
||||
jobs:
|
||||
changed-files:
|
||||
uses: ./.github/workflows/changed-files.yaml
|
||||
unit-tests:
|
||||
runs-on: ubuntu-latest
|
||||
name: Unit tests
|
||||
runs-on: ubuntu-latest
|
||||
needs: changed-files
|
||||
if: ${{ needs.changed-files.outputs.non-markdown-files }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Import environment variables from file
|
||||
|
@ -32,6 +36,8 @@ jobs:
|
|||
extended-tests:
|
||||
runs-on: ubuntu-latest
|
||||
name: Extended tests
|
||||
needs: changed-files
|
||||
if: ${{ needs.changed-files.outputs.non-markdown-files }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Import environment variables from file
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue