Skip to content

Commit

Permalink
add e2e tests to merge queue and use github env instead
Browse files Browse the repository at this point in the history
Signed-off-by: Laura Fitzgerald <[email protected]>
  • Loading branch information
laurafitzgerald committed Jan 27, 2025
1 parent d3bd8fc commit 58ade9b
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 24 deletions.
49 changes: 39 additions & 10 deletions .github/workflows/ci-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,10 @@ on:
- "ci_*"
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
paths-ignore:
- '**.adoc'
- '**.md'
- 'samples/**'
- 'LICENSE'
pull_request_target:
branches:
- main
- "release-*"
paths-ignore:
- '**.adoc'
- '**.md'
- 'samples/**'
- 'LICENSE'
workflow_dispatch:
inputs:
ginkgoParallel:
Expand All @@ -48,6 +38,8 @@ env:
jobs:
e2e_test_suite:
name: E2E Test Suite
needs: is_path_ignore
if: ${{ needs.is_path_ignore.outputs.should_ignore == 'false' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -112,3 +104,40 @@ jobs:
run: |
echo "Executed using dry run, exiting as failure"
exit 1
required-checks:
name: CI Required Checks
needs: [ e2e_test_suite ]
if: always()
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: echo '${{ toJSON(needs) }}' | jq -e 'to_entries | all(.value.result == "success")'

is_path_ignore:
if: always()
name: Check for changes on path_ignore
outputs:
should_ignore: ${{ steps.is_path_ignore.outputs.should_ignore }}
runs-on:
- ubuntu-20.04
steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 10
- id: check_files
name: Get changed files
uses: tj-actions/changed-files@v41
with:
files: |
LICENSE
file-types: "**.adoc,**.md"
- id: set_output
name: Set output based on only files being changed that should be ignored
run: |
if [[ "${{ steps.check_files.outputs.any_changed }}" == "true" ]] && "${{ steps.check_files.outputs.files }}" != "${{ steps.check_files.outputs.all_changed_files }}"; then
echo "should_ignore=true" >> $GITHUB_ENV
else
echo "should_ignore=false" >> $GITHUB_ENV
fi
43 changes: 29 additions & 14 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ on:
jobs:
lint:
name: lint
if: ${{ needs.is_path_ignore.outputs.ignore != 'true' }}
needs: is_path_ignore
if: ${{ needs.is_path_ignore.outputs.should_ignore == 'false' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -33,7 +34,8 @@ jobs:
args: --timeout=5m
verify-code:
name: Verify code
if: ${{ needs.is_path_ignore.outputs.ignore != 'true' }}
needs: is_path_ignore
if: ${{ needs.is_path_ignore.outputs.should_ignore == 'false' }}
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.21.x
Expand All @@ -49,7 +51,8 @@ jobs:
make verify-code
verify-manifests:
name: Verify manifests
if: ${{ needs.is_path_ignore.outputs.ignore != 'true' }}
needs: is_path_ignore
if: ${{ needs.is_path_ignore.outputs.should_ignore == 'false' }}
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.21.x
Expand All @@ -65,7 +68,8 @@ jobs:
make verify-manifests
verify-bundle:
name: Verify bundle
if: ${{ needs.is_path_ignore.outputs.ignore != 'true' }}
needs: is_path_ignore
if: ${{ needs.is_path_ignore.outputs.should_ignore == 'false' }}
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.21.x
Expand All @@ -81,7 +85,8 @@ jobs:
make verify-bundle
verify-helm-build:
name: Verify helm build
if: ${{ needs.is_path_ignore.outputs.ignore != 'true' }}
needs: is_path_ignore
if: ${{ needs.is_path_ignore.outputs.should_ignore == 'false' }}
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.21.x
Expand All @@ -97,7 +102,8 @@ jobs:
make verify-helm-build
verify-imports:
name: Verify imports
if: ${{ needs.is_path_ignore.outputs.ignore != 'true' }}
needs: is_path_ignore
if: ${{ needs.is_path_ignore.outputs.should_ignore == 'false' }}
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.21.x
Expand All @@ -113,7 +119,8 @@ jobs:
make verify-imports
verify-generate:
name: Verify generate
if: ${{ needs.is_path_ignore.outputs.ignore != 'true' }}
needs: is_path_ignore
if: ${{ needs.is_path_ignore.outputs.should_ignore == 'false' }}
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.21.x
Expand All @@ -129,7 +136,8 @@ jobs:
make verify-generate
verify-go-mod:
name: Verify go.mod
if: ${{ needs.is_path_ignore.outputs.ignore != 'true' }}
needs: is_path_ignore
if: ${{ needs.is_path_ignore.outputs.should_ignore == 'false' }}
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.21.x
Expand All @@ -145,7 +153,8 @@ jobs:
make verify-go-mod
unit_test_suite:
name: Unit Test Suite
if: ${{ needs.is_path_ignore.outputs.ignore != 'true' }}
needs: is_path_ignore
if: ${{ needs.is_path_ignore.outputs.should_ignore == 'false' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -158,7 +167,8 @@ jobs:
make test-unit
integration_test_suite:
name: Integration Test Suite
if: ${{ needs.is_path_ignore.outputs.ignore != 'true' }}
needs: is_path_ignore
if: ${{ needs.is_path_ignore.outputs.should_ignore == 'false' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -183,7 +193,7 @@ jobs:
if: always()
name: Check for changes on path_ignore
outputs:
ignore: ${{ steps.is_path_ignore.outputs.ignore }}
should_ignore: ${{ steps.is_path_ignore.outputs.should_ignore }}
runs-on:
- ubuntu-20.04
steps:
Expand All @@ -196,10 +206,15 @@ jobs:
uses: tj-actions/changed-files@v41
with:
files: |
samples/**
LICENSE
file-types: "**.adoc,**.md"
- id: set_output
if: steps.check_files.outputs.any_changed == 'true' && steps.check_files.outputs.files != steps.check_files.outputs.all_changed_files
name: Set output based on only files being changed that should be ignored
run: echo '::set-output name=ignore=true'
run: |
if [[ "${{ steps.check_files.outputs.any_changed }}" == "true" ]] && "${{ steps.check_files.outputs.files }}" != "${{ steps.check_files.outputs.all_changed_files }}"; then
echo '::set-output name=should_ignore=true'
echo "should_ignore=true" >> $GITHUB_ENV
else
echo '::set-output name=should_ignore=false'
echo "should_ignore=false" >> $GITHUB_ENV
fi

0 comments on commit 58ade9b

Please sign in to comment.