1
0
mirror of https://github.com/coreos/prometheus-operator.git synced 2026-02-05 06:45:27 +01:00

Merge pull request #6395 from slashpai/fix_actions

.github/workflow: make execution of e2e and unit tests conditional
This commit is contained in:
Jayapriya Pai
2024-10-21 19:40:44 +05:30
committed by GitHub
4 changed files with 44 additions and 10 deletions

27
.github/workflows/changed-files.yaml vendored Normal file
View 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}}"

View File

@@ -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

View File

@@ -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:

View File

@@ -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