-
Notifications
You must be signed in to change notification settings - Fork 226
ci: Add path-based triggers to CI workflows #1766
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
Changes from all commits
e19beb4
7cf11a3
3aeef34
3d029c5
cb5410e
c6d0fc9
b346c78
f9729ee
a22c7ac
e36135e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,156 @@ | ||
| name: CI Instrumentation Full | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| push: | ||
| branches: | ||
| - main | ||
| paths: &path_filters | ||
kaylareopelle marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - 'helpers/**' | ||
| - 'instrumentation/action_mailer/**' | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it will still trigger all instrumentation test to run even if I only modified the file inside e.g. Just an idea: the matrix can be modified detect-changes:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
...
- name: Get changed instrumentation files
id: changed-files
run: |
if [[ "${{ github.event_name }}" == "schedule" ]] || [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "run_all=true" >> $GITHUB_OUTPUT
else
echo "run_all=false" >> $GITHUB_OUTPUT
echo "changed_gems=$(git diff --name-only ...)" >> $GITHUB_OUTPUT
fi
- name: Set matrix
id: set-matrix
run: |
# get CHANGED_GEMS from last step
echo "matrix={\"gem\":$CHANGED_GEMS,\"os\":[\"ubuntu-latest\"]}" >> $GITHUB_OUTPUT
instrumentation:
needs: detect-changes
if: ${{ needs.detect-changes.outputs.matrix != '' && fromJson(needs.detect-changes.outputs.matrix).gem[0] != null }}
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.detect-changes.outputs.matrix) }}
name: ${{ matrix.gem }} / ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v5
- name: "Test Ruby 3.4"
...
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh I see what you mean. If an instrumentation changes, there are too many interdependencies at the moment between helpers, frameworks and HTTP etc.. so I do want them to run together. For example, if I change It is a bit difficult to encode that as a set of dependencies to make sure they all run together. Now that I think about it, changes to |
||
| - 'instrumentation/action_pack/**' | ||
| - 'instrumentation/action_view/**' | ||
| - 'instrumentation/active_job/**' | ||
| - 'instrumentation/active_model_serializers/**' | ||
| - 'instrumentation/active_record/**' | ||
| - 'instrumentation/active_storage/**' | ||
| - 'instrumentation/active_support/**' | ||
| - 'instrumentation/aws_sdk/**' | ||
| - 'instrumentation/aws_lambda/**' | ||
| - 'instrumentation/base/**' | ||
| - 'instrumentation/concurrent_ruby/**' | ||
| - 'instrumentation/delayed_job/**' | ||
| - 'instrumentation/ethon/**' | ||
| - 'instrumentation/excon/**' | ||
| - 'instrumentation/faraday/**' | ||
| - 'instrumentation/grape/**' | ||
| - 'instrumentation/graphql/**' | ||
| - 'instrumentation/grpc/**' | ||
| - 'instrumentation/gruf/**' | ||
| - 'instrumentation/http/**' | ||
| - 'instrumentation/http_client/**' | ||
| - 'instrumentation/httpx/**' | ||
| - 'instrumentation/koala/**' | ||
| - 'instrumentation/lmdb/**' | ||
| - 'instrumentation/logger/**' | ||
| - 'instrumentation/net_http/**' | ||
| - 'instrumentation/rack/**' | ||
| - 'instrumentation/rails/**' | ||
| - 'instrumentation/restclient/**' | ||
| - 'instrumentation/rspec/**' | ||
| - 'instrumentation/sinatra/**' | ||
| - '.github/workflows/ci-instrumentation-full.yml' | ||
| - '.github/actions/**' | ||
| - 'Gemfile' | ||
| - 'Rakefile' | ||
| - '.rubocop.yml' | ||
| - 'gemspecs/**' | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| paths: *path_filters | ||
| schedule: | ||
| - cron: "0 0 * * *" | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.event.pull_request.number }} # Ensure that only one instance of this workflow is running per Pull Request | ||
| cancel-in-progress: true # Cancel any previous runs of this workflow | ||
|
|
||
| jobs: | ||
| instrumentation: | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| gem: | ||
| - action_mailer | ||
| - action_pack | ||
| - action_view | ||
| - active_job | ||
| - active_model_serializers | ||
| - active_record | ||
| - active_storage | ||
| - active_support | ||
| - aws_sdk | ||
| - aws_lambda | ||
| - base | ||
| - concurrent_ruby | ||
| - delayed_job | ||
| - ethon | ||
| - excon | ||
| - faraday | ||
| - grape | ||
| - graphql | ||
| - grpc | ||
| - gruf | ||
| - http | ||
| - http_client | ||
| - httpx | ||
| - koala | ||
| - lmdb | ||
| - logger | ||
| - net_http | ||
| - rack | ||
| - rails | ||
| - restclient | ||
| - rspec | ||
| - sinatra | ||
| os: | ||
| - ubuntu-latest | ||
|
|
||
| name: ${{ matrix.gem }} / ${{ matrix.os }} | ||
| runs-on: ${{ matrix.os }} | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
| - name: "Test Ruby 3.4" | ||
| uses: ./.github/actions/test_gem | ||
| with: | ||
| gem: "opentelemetry-instrumentation-${{ matrix.gem }}" | ||
| ruby: "3.4" | ||
| - name: "Test Ruby 3.3" | ||
| uses: ./.github/actions/test_gem | ||
| with: | ||
| gem: "opentelemetry-instrumentation-${{ matrix.gem }}" | ||
| ruby: "3.3" | ||
| - name: "Test Ruby 3.2" | ||
| uses: ./.github/actions/test_gem | ||
| with: | ||
| gem: "opentelemetry-instrumentation-${{ matrix.gem }}" | ||
| ruby: "3.2" | ||
| yard: true | ||
| rubocop: true | ||
| coverage: true | ||
| build: true | ||
| - name: "JRuby Filter" | ||
| id: jruby_skip | ||
| shell: bash | ||
| run: | | ||
| echo "skip=false" >> $GITHUB_OUTPUT | ||
| [[ "${{ matrix.gem }}" == "action_pack" ]] && echo "skip=true" >> $GITHUB_OUTPUT | ||
| [[ "${{ matrix.gem }}" == "action_view" ]] && echo "skip=true" >> $GITHUB_OUTPUT | ||
| [[ "${{ matrix.gem }}" == "active_model_serializers" ]] && echo "skip=true" >> $GITHUB_OUTPUT | ||
| [[ "${{ matrix.gem }}" == "active_record" ]] && echo "skip=true" >> $GITHUB_OUTPUT | ||
| [[ "${{ matrix.gem }}" == "active_storage" ]] && echo "skip=true" >> $GITHUB_OUTPUT | ||
| [[ "${{ matrix.gem }}" == "active_support" ]] && echo "skip=true" >> $GITHUB_OUTPUT | ||
| [[ "${{ matrix.gem }}" == "aws_sdk" ]] && echo "skip=true" >> $GITHUB_OUTPUT | ||
| [[ "${{ matrix.gem }}" == "aws_lambda" ]] && echo "skip=true" >> $GITHUB_OUTPUT | ||
| [[ "${{ matrix.gem }}" == "delayed_job" ]] && echo "skip=true" >> $GITHUB_OUTPUT | ||
| [[ "${{ matrix.gem }}" == "graphql" ]] && echo "skip=true" >> $GITHUB_OUTPUT | ||
| [[ "${{ matrix.gem }}" == "http" ]] && echo "skip=true" >> $GITHUB_OUTPUT | ||
| [[ "${{ matrix.gem }}" == "http_client" ]] && echo "skip=true" >> $GITHUB_OUTPUT | ||
| [[ "${{ matrix.gem }}" == "koala" ]] && echo "skip=true" >> $GITHUB_OUTPUT | ||
| [[ "${{ matrix.gem }}" == "lmdb" ]] && echo "skip=true" >> $GITHUB_OUTPUT | ||
| [[ "${{ matrix.gem }}" == "rack" ]] && echo "skip=true" >> $GITHUB_OUTPUT | ||
| [[ "${{ matrix.gem }}" == "rails" ]] && echo "skip=true" >> $GITHUB_OUTPUT | ||
| [[ "${{ matrix.gem }}" == "grpc" ]] && echo "skip=true" >> $GITHUB_OUTPUT | ||
| [[ "${{ matrix.gem }}" == "gruf" ]] && echo "skip=true" >> $GITHUB_OUTPUT | ||
| # This is essentially a bash script getting evaluated, so we need to return true or the whole job fails. | ||
| true | ||
| - name: "Test JRuby" | ||
| if: "${{ matrix.os == 'ubuntu-latest' && steps.jruby_skip.outputs.skip == 'false' }}" | ||
| uses: ./.github/actions/test_gem | ||
| with: | ||
| gem: "opentelemetry-instrumentation-${{ matrix.gem }}" | ||
| ruby: "jruby-10.0.2.0" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| name: Markdown Checks | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths: | ||
| - '**/*.md' | ||
|
|
||
| permissions: | ||
| contents: read | ||
| pull-requests: write # required for posting PR review comments | ||
|
|
||
| jobs: | ||
| markdownlint-check: | ||
| name: Markdown Lint Check | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
|
|
||
| # equivalent cli: markdownlint-cli2 "**/*.md" "#**/CHANGELOG.md" --config .markdownlint.json | ||
| - name: "Markdown Lint Check" | ||
| uses: DavidAnson/markdownlint-cli2-action@v20 | ||
| continue-on-error: true | ||
| with: | ||
| fix: false | ||
| globs: | | ||
| **/*.md | ||
| !**/CHANGELOG.md | ||
|
|
||
| markdown-link-check: | ||
| name: Markdown Link Check | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
|
|
||
| # equivalent cli: linkspector check | ||
| - name: Run linkspector | ||
| uses: umbrelladocs/action-linkspector@v1 | ||
| with: | ||
| github_token: ${{ secrets.GITHUB_TOKEN }} | ||
| reporter: github-pr-review | ||
| fail_on_error: true | ||
|
|
||
| spelling-check: | ||
| name: Spelling Check | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
| - uses: streetsidesoftware/cspell-action@v7 | ||
| with: | ||
| # Files should be consistent with check:spelling files | ||
| files: | | ||
| **/*.md | ||
| config: .cspell.yml |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as last comment, if I only modified resources/, I probably only want resources/ to run test.
With paths-filter, we can use the output from detect-changes to decide on what jobs to run