Skip to content
20 changes: 0 additions & 20 deletions .github/workflows/check-spelling.yml

This file was deleted.

13 changes: 13 additions & 0 deletions .github/workflows/ci-contrib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,22 @@ on:
push:
branches:
- main
paths: &path_filters
- 'helpers/**'
Copy link
Contributor

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

jobs:
  detect-changes:
    runs-on: ubuntu-latest
    outputs:
      helpers: ${{ steps.filter.outputs.helpers }}
      propagators: ${{ steps.filter.outputs.propagators }}
      ...
    steps:
      - uses: actions/checkout@v5
      - uses: dorny/paths-filter@v3
        id: filter
        with:
          filters: |
            helpers:
              - 'helpers/**'
            propagators:
              - 'propagator/**'
            ...

  helpers:
    needs: detect-changes
    if: ${{ needs.detect-changes.outputs.helpers == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}

  propagators:
    ...

- 'propagator/**'
- 'resources/**'
- 'processor/**'
- 'sampler/**'
- '.github/workflows/ci-contrib.yml'
- '.github/actions/**'
- 'Gemfile'
- 'Rakefile'
- '.rubocop.yml'
- 'gemspecs/**'
pull_request:
branches:
- main
paths: *path_filters
schedule:
- cron: "0 0 * * *"

Expand Down
156 changes: 156 additions & 0 deletions .github/workflows/ci-instrumentation-full.yml
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
- 'helpers/**'
- 'instrumentation/action_mailer/**'
Copy link
Contributor

Choose a reason for hiding this comment

The 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. http/.

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"
        ...

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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 instrumentation/active_support I also want to tests for anything that depends on that gem e.g. action_view.

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/base and helpers should also trigger Instrumentation with services since those are critical dependencies for those libraries as well.

- '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"
23 changes: 23 additions & 0 deletions .github/workflows/ci-instrumentation-with-services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,32 @@ on:
push:
branches:
- main
paths: &path_filters
- 'helpers/**'
- 'instrumentation/base/**'
- 'instrumentation/bunny/**'
- 'instrumentation/dalli/**'
- 'instrumentation/mongo/**'
- 'instrumentation/mysql2/**'
- 'instrumentation/pg/**'
- 'instrumentation/que/**'
- 'instrumentation/racecar/**'
- 'instrumentation/rdkafka/**'
- 'instrumentation/redis/**'
- 'instrumentation/resque/**'
- 'instrumentation/ruby_kafka/**'
- 'instrumentation/sidekiq/**'
- 'instrumentation/trilogy/**'
- '.github/workflows/ci-instrumentation-with-services.yml'
- '.github/actions/**'
- 'Gemfile'
- 'Rakefile'
- '.rubocop.yml'
- 'gemspecs/**'
pull_request:
branches:
- main
paths: *path_filters
schedule:
- cron: "0 0 * * *"

Expand Down
54 changes: 2 additions & 52 deletions .github/workflows/ci-instrumentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,44 +19,12 @@ concurrency:
cancel-in-progress: true # Cancel any previous runs of this workflow

jobs:
instrumentation:
instrumentation_all:
strategy:
fail-fast: false
matrix:
gem:
- action_mailer
- action_pack
- action_view
- active_job
- active_model_serializers
- active_record
- active_storage
- active_support
- all
- 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

Expand Down Expand Up @@ -88,25 +56,7 @@ jobs:
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.
# The 'all' instrumentation should work with JRuby
true
- name: "Test JRuby"
if: "${{ matrix.os == 'ubuntu-latest' && steps.jruby_skip.outputs.skip == 'false' }}"
Expand Down
53 changes: 53 additions & 0 deletions .github/workflows/ci-markdown-checks.yml
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
25 changes: 0 additions & 25 deletions .github/workflows/ci-markdown-link.yml

This file was deleted.

Loading