Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

action: support GitHub check in branch protection #1508

Merged
merged 3 commits into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/ci-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# This workflow sets the test / all status check to success in case it's a docs only PR and test.yml is not triggered
# https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks#handling-skipped-but-required-checks
name: ci # The name must be the same as in ci.yml

on:
pull_request:
paths-ignore: # This expression needs to match the paths ignored on ci.yml.
- '**'
- '!**/*.md'
- '!**/*.asciidoc'

permissions:
contents: read

## Concurrency only allowed in the main branch.
## So old builds running for old commits within the same Pull Request are cancelled
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
# dummy steps that allow to bypass those mandatory checks for tests
ci:
runs-on: ubuntu-latest
steps:
- run: 'echo "Not required for docs"'
24 changes: 24 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ on:
permissions:
contents: read

## Concurrency only allowed in the main branch.
## So old builds running for old commits within the same Pull Request are cancelled
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
precheck:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -101,3 +107,21 @@ jobs:
cache-dependency-path: '**/go.sum'
- name: Unit tests
run: make test

# Very last job to create a GitHub check with the status. This is handy to centralise the
# GitHub check validation in the Branch protection and to support the ci-docs.yml
ci:
if: always()
runs-on: ubuntu-latest
needs:
- check-update-modules
- precheck
- test
- test-macos
- test-windows
steps:
- id: check
uses: elastic/apm-pipeline-library/.github/actions/check-dependent-jobs@current
with:
needs: ${{ toJSON(needs) }}
- run: ${{ steps.check.outputs.isSuccess }}