Unit Tests #46
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Unit Tests | |
| on: # yamllint disable-line rule:truthy | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| branches: | |
| - master | |
| schedule: | |
| - cron: 0 */4 * * 1-5 | |
| - cron: 0 3 * * 0,6 | |
| # Default permissions for all jobs | |
| permissions: {} | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.run_id || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| # ADD NEW RUBIES HERE | |
| ruby-40: | |
| name: "Ruby 4.0" | |
| uses: ./.github/workflows/_unit_test.yml | |
| with: | |
| engine: ruby | |
| version: "4.0" | |
| alias: ruby-40 | |
| ruby-34: | |
| name: "Ruby 3.4" | |
| uses: ./.github/workflows/_unit_test.yml | |
| with: | |
| engine: ruby | |
| version: "3.4" | |
| alias: ruby-34 | |
| ruby-33: | |
| name: "Ruby 3.3" | |
| uses: ./.github/workflows/_unit_test.yml | |
| with: | |
| engine: ruby | |
| version: "3.3" | |
| alias: ruby-33 | |
| ruby-32: | |
| name: "Ruby 3.2" | |
| uses: ./.github/workflows/_unit_test.yml | |
| with: | |
| engine: ruby | |
| version: "3.2" | |
| alias: ruby-32 | |
| ruby-31: | |
| name: "Ruby 3.1" | |
| uses: ./.github/workflows/_unit_test.yml | |
| with: | |
| engine: ruby | |
| version: "3.1" | |
| alias: ruby-31 | |
| ruby-30: | |
| name: "Ruby 3.0" | |
| uses: ./.github/workflows/_unit_test.yml | |
| with: | |
| engine: ruby | |
| version: "3.0" | |
| alias: ruby-30 | |
| ruby-27: | |
| name: "Ruby 2.7" | |
| uses: ./.github/workflows/_unit_test.yml | |
| with: | |
| engine: ruby | |
| version: "2.7" | |
| alias: ruby-27 | |
| ruby-26: | |
| name: "Ruby 2.6" | |
| uses: ./.github/workflows/_unit_test.yml | |
| with: | |
| engine: ruby | |
| version: "2.6" | |
| alias: ruby-26 | |
| ruby-25: | |
| name: "Ruby 2.5" | |
| uses: ./.github/workflows/_unit_test.yml | |
| with: | |
| engine: ruby | |
| version: "2.5" | |
| alias: ruby-25 | |
| junit: | |
| name: dd/junit | |
| if: ${{ !cancelled() }} | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| id-token: write | |
| container: | |
| image: datadog/ci:v3.7.1 | |
| env: | |
| DD_ENV: ci | |
| DATADOG_SITE: datadoghq.com | |
| DD_SERVICE: dd-trace-rb | |
| DD_GIT_REPOSITORY_URL: "${{ github.repositoryUrl }}" | |
| needs: | |
| # ADD NEW RUBIES HERE | |
| - ruby-40 | |
| - ruby-34 | |
| - ruby-33 | |
| - ruby-32 | |
| - ruby-31 | |
| - ruby-30 | |
| - ruby-27 | |
| - ruby-26 | |
| - ruby-25 | |
| steps: | |
| - run: mkdir -p tmp/rspec && datadog-ci version | |
| - name: Download all junit reports | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| path: tmp/rspec | |
| pattern: junit-* | |
| merge-multiple: true | |
| - name: Format file paths | |
| run: sed -i 's;file="./;file=";g' tmp/rspec/*.xml | |
| # Note that GITHUB_SHA for this event is the last merge commit of the pull request merge branch, | |
| # which `datadog-ci` failed to sync the correct git metadata in Github Actions. | |
| # | |
| # This causes the CODEOWNERS data being lost. | |
| # | |
| # This is a workaround to manually set the correct git commit sha for the pull request event. | |
| - if: github.event_name == 'pull_request' | |
| env: | |
| DD_GIT_COMMIT_SHA: ${{ github.event.pull_request.head.sha }} | |
| run: echo "DD_GIT_COMMIT_SHA=$DD_GIT_COMMIT_SHA" >> "$GITHUB_ENV" | |
| - if: github.event_name != 'pull_request' | |
| env: | |
| DD_GIT_COMMIT_SHA: ${{ github.sha }} | |
| run: echo "DD_GIT_COMMIT_SHA=$DD_GIT_COMMIT_SHA" >> "$GITHUB_ENV" | |
| - run: echo "$DD_GIT_COMMIT_SHA" | |
| - name: Get Datadog credentials via dd-sts | |
| id: dd-sts | |
| uses: DataDog/dd-sts-action@639d841c72f15e4e77747bd726ef8105ce971da2 | |
| with: | |
| policy: public-datadog-dd-trace-rb | |
| - name: Upload junit reports | |
| env: | |
| DD_API_KEY: ${{ steps.dd-sts.outputs.api_key }} | |
| run: datadog-ci junit upload --verbose tmp/rspec/ | |
| coverage: | |
| name: dd/coverage | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| id-token: write | |
| needs: | |
| # ADD NEW RUBIES HERE | |
| - ruby-40 | |
| - ruby-34 | |
| - ruby-33 | |
| - ruby-32 | |
| - ruby-31 | |
| - ruby-30 | |
| - ruby-27 | |
| - ruby-26 | |
| - ruby-25 | |
| container: | |
| image: datadog/ci:v5.7.0 | |
| env: | |
| DD_ENV: ci | |
| DATADOG_SITE: datadoghq.com | |
| DD_SERVICE: dd-trace-rb | |
| DD_GIT_REPOSITORY_URL: "${{ github.repositoryUrl }}" | |
| steps: | |
| - run: mkdir -p tmp/coverage && datadog-ci version | |
| - name: Download all coverage data | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| path: tmp/coverage | |
| pattern: coverage-* | |
| merge-multiple: true | |
| - name: Get Datadog credentials via dd-sts | |
| id: dd-sts | |
| uses: DataDog/dd-sts-action@639d841c72f15e4e77747bd726ef8105ce971da2 | |
| with: | |
| policy: public-datadog-dd-trace-rb | |
| - name: Upload coverage reports to Datadog | |
| env: | |
| DD_API_KEY: ${{ steps.dd-sts.outputs.api_key }} | |
| run: | | |
| for container_dir in tmp/coverage/versions/*/*/; do | |
| alias_name=$(basename "$(dirname "$container_dir")") | |
| container_id=$(basename "$container_dir") | |
| test_type="${container_id%%-*}" | |
| datadog-ci coverage upload --verbose --flags "ruby-ver:$alias_name" --flags "type:$test_type" "$container_dir" | |
| done | |
| complete: | |
| name: Unit Tests (complete) | |
| runs-on: ubuntu-24.04 | |
| needs: | |
| # ADD NEW RUBIES HERE | |
| - ruby-40 | |
| - ruby-34 | |
| - ruby-33 | |
| - ruby-32 | |
| - ruby-31 | |
| - ruby-30 | |
| - ruby-27 | |
| - ruby-26 | |
| - ruby-25 | |
| steps: | |
| - run: echo "DONE!" |