Skip to content

Commit b420e16

Browse files
authored
action: faster docs PRs and branch protection gatekeeper (#409)
1 parent 4a6080a commit b420e16

File tree

3 files changed

+101
-3
lines changed

3 files changed

+101
-3
lines changed

.github/workflows/README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
## CI/CD
2+
3+
There are 5 main stages that run on GitHub actions
4+
5+
* Build
6+
* Lint
7+
* Notice
8+
* Test
9+
* Release
10+
11+
There are some other stages that run for every push on the main branches:
12+
13+
* [Smoke Tests](./smoke-tests.yml)
14+
15+
### Scenarios
16+
17+
* Pull Requests that are only affecting the docs files should not trigger any test or similar stages that are not required.
18+
* Builds do not get triggered automatically for Pull Requests from contributors that are not Elasticians when need to access to any GitHub Secrets.
19+
20+
### How to interact with the CI?
21+
22+
#### On a PR basis
23+
24+
Once a PR has been opened then there are two different ways you can trigger builds in the CI:
25+
26+
1. Commit based
27+
1. UI based, any Elasticians can force a build through the GitHub UI
28+
29+
#### Branches
30+
31+
Every time there is a merge to main or any release branches the whole workflow will compile and test every entry in the compatibility matrix for Linux and MacOS.
32+
33+
#### Release process
34+
35+
This process has been fully automated and it gets triggered when a tag release has been created, for further details please refers to the [release](../../RELEASE.md) docs.
36+
37+
#### Smoke Tests
38+
39+
You can run the [smoke-tests](https://github.com/elastic/apm-aws-lambda/actions/workflows/smoke-tests.yml) using the UI if needed.
40+
41+
### OpenTelemetry
42+
43+
There is a GitHub workflow in charge to populate what the workflow run in terms of jobs and steps. Those details can be seen in [here](https://ela.st/oblt-ci-cd-stats) (**NOTE**: only available for Elasticians).

.github/workflows/test-docs.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# This workflow sets the test / ci status check to success in case it's a docs only PR and test.yml is not triggered
2+
# 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
3+
name: test # The name must be the same as in test.yml
4+
5+
on:
6+
pull_request:
7+
paths-ignore: # This expression needs to match the paths ignored on main.yml.
8+
- '**'
9+
- '!**/*.md'
10+
- '!**/*.asciidoc'
11+
- '!**/*.png'
12+
13+
permissions:
14+
contents: read
15+
16+
## Concurrency only allowed in the main branch.
17+
## So old builds running for old commits within the same Pull Request are cancelled
18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.ref }}
20+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
21+
22+
jobs:
23+
# dummy steps that allow to bypass those mandatory checks for tests
24+
ci:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- run: 'echo "Not required for docs"'

.github/workflows/test.yml

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,28 @@
11
name: test
22

33
on:
4+
pull_request:
5+
paths-ignore:
6+
- "**/*.asciidoc"
7+
- "**/*.md"
8+
- "**/*.png"
49
push:
510
branches:
611
- main
7-
pull_request:
12+
paths-ignore:
13+
- "**/*.asciidoc"
14+
- "**/*.md"
15+
- "**/*.png"
816

917
permissions:
1018
contents: read
1119

20+
## Concurrency only allowed in the main branch.
21+
## So old builds running for old commits within the same Pull Request are cancelled
22+
concurrency:
23+
group: ${{ github.workflow }}-${{ github.ref }}
24+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
25+
1226
jobs:
1327
test:
1428
strategy:
@@ -60,6 +74,20 @@ jobs:
6074
- uses: actions/checkout@v3
6175
- name: notice
6276
run: make check-notice
63-
64-
6577

78+
# The very last job to report whether the Workflow passed.
79+
# This will act as the Branch Protection gatekeeper
80+
ci:
81+
if: always()
82+
needs:
83+
- build
84+
- lint
85+
- notice
86+
- test
87+
runs-on: ubuntu-latest
88+
steps:
89+
- id: check
90+
uses: elastic/apm-pipeline-library/.github/actions/check-dependent-jobs@current
91+
with:
92+
needs: ${{ toJSON(needs) }}
93+
- run: ${{ steps.check.outputs.isSuccess }}

0 commit comments

Comments
 (0)