Skip to content

Commit 1186594

Browse files
ci: Add path-based triggers to CI workflows (#1766)
* ci: Add path-based triggers to CI workflows This should skip running tests for cases where it is not needed Fixes: #1753 * squash: Revert me * squash: Reverting changes * Add dedicated workflow for 'all' instrumentation meta-package - Created ci-instrumentation-all.yml to handle the 'all' instrumentation - This workflow triggers on any instrumentation/** or helpers/** changes - Removed 'all' from ci-instrumentation.yml to avoid duplication - Ensures 'all' instrumentation tests run for any instrumentation change as required for merging while maintaining CI optimization benefits * squash: rename a few files to keep required builds * squash: consolidate more linters * squash: move things around * squash: use anchors to avoid duplication
1 parent af463bc commit 1186594

File tree

8 files changed

+247
-120
lines changed

8 files changed

+247
-120
lines changed

.github/workflows/check-spelling.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.

.github/workflows/ci-contrib.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,22 @@ on:
55
push:
66
branches:
77
- main
8+
paths: &path_filters
9+
- 'helpers/**'
10+
- 'propagator/**'
11+
- 'resources/**'
12+
- 'processor/**'
13+
- 'sampler/**'
14+
- '.github/workflows/ci-contrib.yml'
15+
- '.github/actions/**'
16+
- 'Gemfile'
17+
- 'Rakefile'
18+
- '.rubocop.yml'
19+
- 'gemspecs/**'
820
pull_request:
921
branches:
1022
- main
23+
paths: *path_filters
1124
schedule:
1225
- cron: "0 0 * * *"
1326

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
name: CI Instrumentation Full
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
paths: &path_filters
9+
- 'helpers/**'
10+
- 'instrumentation/action_mailer/**'
11+
- 'instrumentation/action_pack/**'
12+
- 'instrumentation/action_view/**'
13+
- 'instrumentation/active_job/**'
14+
- 'instrumentation/active_model_serializers/**'
15+
- 'instrumentation/active_record/**'
16+
- 'instrumentation/active_storage/**'
17+
- 'instrumentation/active_support/**'
18+
- 'instrumentation/aws_sdk/**'
19+
- 'instrumentation/aws_lambda/**'
20+
- 'instrumentation/base/**'
21+
- 'instrumentation/concurrent_ruby/**'
22+
- 'instrumentation/delayed_job/**'
23+
- 'instrumentation/ethon/**'
24+
- 'instrumentation/excon/**'
25+
- 'instrumentation/faraday/**'
26+
- 'instrumentation/grape/**'
27+
- 'instrumentation/graphql/**'
28+
- 'instrumentation/grpc/**'
29+
- 'instrumentation/gruf/**'
30+
- 'instrumentation/http/**'
31+
- 'instrumentation/http_client/**'
32+
- 'instrumentation/httpx/**'
33+
- 'instrumentation/koala/**'
34+
- 'instrumentation/lmdb/**'
35+
- 'instrumentation/logger/**'
36+
- 'instrumentation/net_http/**'
37+
- 'instrumentation/rack/**'
38+
- 'instrumentation/rails/**'
39+
- 'instrumentation/restclient/**'
40+
- 'instrumentation/rspec/**'
41+
- 'instrumentation/sinatra/**'
42+
- '.github/workflows/ci-instrumentation-full.yml'
43+
- '.github/actions/**'
44+
- 'Gemfile'
45+
- 'Rakefile'
46+
- '.rubocop.yml'
47+
- 'gemspecs/**'
48+
pull_request:
49+
branches:
50+
- main
51+
paths: *path_filters
52+
schedule:
53+
- cron: "0 0 * * *"
54+
55+
permissions:
56+
contents: read
57+
58+
concurrency:
59+
group: ${{ github.workflow }}-${{ github.event.pull_request.number }} # Ensure that only one instance of this workflow is running per Pull Request
60+
cancel-in-progress: true # Cancel any previous runs of this workflow
61+
62+
jobs:
63+
instrumentation:
64+
strategy:
65+
fail-fast: false
66+
matrix:
67+
gem:
68+
- action_mailer
69+
- action_pack
70+
- action_view
71+
- active_job
72+
- active_model_serializers
73+
- active_record
74+
- active_storage
75+
- active_support
76+
- aws_sdk
77+
- aws_lambda
78+
- base
79+
- concurrent_ruby
80+
- delayed_job
81+
- ethon
82+
- excon
83+
- faraday
84+
- grape
85+
- graphql
86+
- grpc
87+
- gruf
88+
- http
89+
- http_client
90+
- httpx
91+
- koala
92+
- lmdb
93+
- logger
94+
- net_http
95+
- rack
96+
- rails
97+
- restclient
98+
- rspec
99+
- sinatra
100+
os:
101+
- ubuntu-latest
102+
103+
name: ${{ matrix.gem }} / ${{ matrix.os }}
104+
runs-on: ${{ matrix.os }}
105+
steps:
106+
- uses: actions/checkout@v5
107+
- name: "Test Ruby 3.4"
108+
uses: ./.github/actions/test_gem
109+
with:
110+
gem: "opentelemetry-instrumentation-${{ matrix.gem }}"
111+
ruby: "3.4"
112+
- name: "Test Ruby 3.3"
113+
uses: ./.github/actions/test_gem
114+
with:
115+
gem: "opentelemetry-instrumentation-${{ matrix.gem }}"
116+
ruby: "3.3"
117+
- name: "Test Ruby 3.2"
118+
uses: ./.github/actions/test_gem
119+
with:
120+
gem: "opentelemetry-instrumentation-${{ matrix.gem }}"
121+
ruby: "3.2"
122+
yard: true
123+
rubocop: true
124+
coverage: true
125+
build: true
126+
- name: "JRuby Filter"
127+
id: jruby_skip
128+
shell: bash
129+
run: |
130+
echo "skip=false" >> $GITHUB_OUTPUT
131+
[[ "${{ matrix.gem }}" == "action_pack" ]] && echo "skip=true" >> $GITHUB_OUTPUT
132+
[[ "${{ matrix.gem }}" == "action_view" ]] && echo "skip=true" >> $GITHUB_OUTPUT
133+
[[ "${{ matrix.gem }}" == "active_model_serializers" ]] && echo "skip=true" >> $GITHUB_OUTPUT
134+
[[ "${{ matrix.gem }}" == "active_record" ]] && echo "skip=true" >> $GITHUB_OUTPUT
135+
[[ "${{ matrix.gem }}" == "active_storage" ]] && echo "skip=true" >> $GITHUB_OUTPUT
136+
[[ "${{ matrix.gem }}" == "active_support" ]] && echo "skip=true" >> $GITHUB_OUTPUT
137+
[[ "${{ matrix.gem }}" == "aws_sdk" ]] && echo "skip=true" >> $GITHUB_OUTPUT
138+
[[ "${{ matrix.gem }}" == "aws_lambda" ]] && echo "skip=true" >> $GITHUB_OUTPUT
139+
[[ "${{ matrix.gem }}" == "delayed_job" ]] && echo "skip=true" >> $GITHUB_OUTPUT
140+
[[ "${{ matrix.gem }}" == "graphql" ]] && echo "skip=true" >> $GITHUB_OUTPUT
141+
[[ "${{ matrix.gem }}" == "http" ]] && echo "skip=true" >> $GITHUB_OUTPUT
142+
[[ "${{ matrix.gem }}" == "http_client" ]] && echo "skip=true" >> $GITHUB_OUTPUT
143+
[[ "${{ matrix.gem }}" == "koala" ]] && echo "skip=true" >> $GITHUB_OUTPUT
144+
[[ "${{ matrix.gem }}" == "lmdb" ]] && echo "skip=true" >> $GITHUB_OUTPUT
145+
[[ "${{ matrix.gem }}" == "rack" ]] && echo "skip=true" >> $GITHUB_OUTPUT
146+
[[ "${{ matrix.gem }}" == "rails" ]] && echo "skip=true" >> $GITHUB_OUTPUT
147+
[[ "${{ matrix.gem }}" == "grpc" ]] && echo "skip=true" >> $GITHUB_OUTPUT
148+
[[ "${{ matrix.gem }}" == "gruf" ]] && echo "skip=true" >> $GITHUB_OUTPUT
149+
# This is essentially a bash script getting evaluated, so we need to return true or the whole job fails.
150+
true
151+
- name: "Test JRuby"
152+
if: "${{ matrix.os == 'ubuntu-latest' && steps.jruby_skip.outputs.skip == 'false' }}"
153+
uses: ./.github/actions/test_gem
154+
with:
155+
gem: "opentelemetry-instrumentation-${{ matrix.gem }}"
156+
ruby: "jruby-10.0.2.0"

.github/workflows/ci-instrumentation-with-services.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,32 @@ on:
55
push:
66
branches:
77
- main
8+
paths: &path_filters
9+
- 'helpers/**'
10+
- 'instrumentation/base/**'
11+
- 'instrumentation/bunny/**'
12+
- 'instrumentation/dalli/**'
13+
- 'instrumentation/mongo/**'
14+
- 'instrumentation/mysql2/**'
15+
- 'instrumentation/pg/**'
16+
- 'instrumentation/que/**'
17+
- 'instrumentation/racecar/**'
18+
- 'instrumentation/rdkafka/**'
19+
- 'instrumentation/redis/**'
20+
- 'instrumentation/resque/**'
21+
- 'instrumentation/ruby_kafka/**'
22+
- 'instrumentation/sidekiq/**'
23+
- 'instrumentation/trilogy/**'
24+
- '.github/workflows/ci-instrumentation-with-services.yml'
25+
- '.github/actions/**'
26+
- 'Gemfile'
27+
- 'Rakefile'
28+
- '.rubocop.yml'
29+
- 'gemspecs/**'
830
pull_request:
931
branches:
1032
- main
33+
paths: *path_filters
1134
schedule:
1235
- cron: "0 0 * * *"
1336

.github/workflows/ci-instrumentation.yml

Lines changed: 2 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -19,44 +19,12 @@ concurrency:
1919
cancel-in-progress: true # Cancel any previous runs of this workflow
2020

2121
jobs:
22-
instrumentation:
22+
instrumentation_all:
2323
strategy:
2424
fail-fast: false
2525
matrix:
2626
gem:
27-
- action_mailer
28-
- action_pack
29-
- action_view
30-
- active_job
31-
- active_model_serializers
32-
- active_record
33-
- active_storage
34-
- active_support
3527
- all
36-
- aws_sdk
37-
- aws_lambda
38-
- base
39-
- concurrent_ruby
40-
- delayed_job
41-
- ethon
42-
- excon
43-
- faraday
44-
- grape
45-
- graphql
46-
- grpc
47-
- gruf
48-
- http
49-
- http_client
50-
- httpx
51-
- koala
52-
- lmdb
53-
- logger
54-
- net_http
55-
- rack
56-
- rails
57-
- restclient
58-
- rspec
59-
- sinatra
6028
os:
6129
- ubuntu-latest
6230

@@ -88,25 +56,7 @@ jobs:
8856
shell: bash
8957
run: |
9058
echo "skip=false" >> $GITHUB_OUTPUT
91-
[[ "${{ matrix.gem }}" == "action_pack" ]] && echo "skip=true" >> $GITHUB_OUTPUT
92-
[[ "${{ matrix.gem }}" == "action_view" ]] && echo "skip=true" >> $GITHUB_OUTPUT
93-
[[ "${{ matrix.gem }}" == "active_model_serializers" ]] && echo "skip=true" >> $GITHUB_OUTPUT
94-
[[ "${{ matrix.gem }}" == "active_record" ]] && echo "skip=true" >> $GITHUB_OUTPUT
95-
[[ "${{ matrix.gem }}" == "active_storage" ]] && echo "skip=true" >> $GITHUB_OUTPUT
96-
[[ "${{ matrix.gem }}" == "active_support" ]] && echo "skip=true" >> $GITHUB_OUTPUT
97-
[[ "${{ matrix.gem }}" == "aws_sdk" ]] && echo "skip=true" >> $GITHUB_OUTPUT
98-
[[ "${{ matrix.gem }}" == "aws_lambda" ]] && echo "skip=true" >> $GITHUB_OUTPUT
99-
[[ "${{ matrix.gem }}" == "delayed_job" ]] && echo "skip=true" >> $GITHUB_OUTPUT
100-
[[ "${{ matrix.gem }}" == "graphql" ]] && echo "skip=true" >> $GITHUB_OUTPUT
101-
[[ "${{ matrix.gem }}" == "http" ]] && echo "skip=true" >> $GITHUB_OUTPUT
102-
[[ "${{ matrix.gem }}" == "http_client" ]] && echo "skip=true" >> $GITHUB_OUTPUT
103-
[[ "${{ matrix.gem }}" == "koala" ]] && echo "skip=true" >> $GITHUB_OUTPUT
104-
[[ "${{ matrix.gem }}" == "lmdb" ]] && echo "skip=true" >> $GITHUB_OUTPUT
105-
[[ "${{ matrix.gem }}" == "rack" ]] && echo "skip=true" >> $GITHUB_OUTPUT
106-
[[ "${{ matrix.gem }}" == "rails" ]] && echo "skip=true" >> $GITHUB_OUTPUT
107-
[[ "${{ matrix.gem }}" == "grpc" ]] && echo "skip=true" >> $GITHUB_OUTPUT
108-
[[ "${{ matrix.gem }}" == "gruf" ]] && echo "skip=true" >> $GITHUB_OUTPUT
109-
# This is essentially a bash script getting evaluated, so we need to return true or the whole job fails.
59+
# The 'all' instrumentation should work with JRuby
11060
true
11161
- name: "Test JRuby"
11262
if: "${{ matrix.os == 'ubuntu-latest' && steps.jruby_skip.outputs.skip == 'false' }}"
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Markdown Checks
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- '**/*.md'
7+
8+
permissions:
9+
contents: read
10+
pull-requests: write # required for posting PR review comments
11+
12+
jobs:
13+
markdownlint-check:
14+
name: Markdown Lint Check
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v5
18+
19+
# equivalent cli: markdownlint-cli2 "**/*.md" "#**/CHANGELOG.md" --config .markdownlint.json
20+
- name: "Markdown Lint Check"
21+
uses: DavidAnson/markdownlint-cli2-action@v20
22+
continue-on-error: true
23+
with:
24+
fix: false
25+
globs: |
26+
**/*.md
27+
!**/CHANGELOG.md
28+
29+
markdown-link-check:
30+
name: Markdown Link Check
31+
runs-on: ubuntu-latest
32+
steps:
33+
- uses: actions/checkout@v5
34+
35+
# equivalent cli: linkspector check
36+
- name: Run linkspector
37+
uses: umbrelladocs/action-linkspector@v1
38+
with:
39+
github_token: ${{ secrets.GITHUB_TOKEN }}
40+
reporter: github-pr-review
41+
fail_on_error: true
42+
43+
spelling-check:
44+
name: Spelling Check
45+
runs-on: ubuntu-latest
46+
steps:
47+
- uses: actions/checkout@v5
48+
- uses: streetsidesoftware/cspell-action@v7
49+
with:
50+
# Files should be consistent with check:spelling files
51+
files: |
52+
**/*.md
53+
config: .cspell.yml

.github/workflows/ci-markdown-link.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)