name: Run Integration Tests on: pull_request: branches: - master schedule: - cron: "0 2 * * *" concurrency: group: integration-${{ github.head_ref }} cancel-in-progress: true jobs: test_integration: runs-on: ubuntu-latest if: > (github.event_name == 'pull_request' && github.event.pull_request.draft == false && !contains(github.event.pull_request.labels.*.name, 'ci/skip') && !contains(github.event.pull_request.head.ref, 'datadog-api-spec/test/') && contains(github.event.pull_request.labels.*.name, 'ci/integrations')) || github.event_name == 'schedule' services: datadog-agent: image: datadog/agent:latest ports: - 8126:8126 env: DD_API_KEY: ${{ secrets.DD_API_KEY }} DD_HOSTNAME: "none" DD_INSIDE_CI: "true" steps: - name: Get GitHub App token if: github.event_name == 'pull_request' id: get_token uses: tibdex/github-app-token@v1.3.0 with: app_id: ${{ secrets.PIPELINE_GITHUB_APP_ID }} private_key: ${{ secrets.PIPELINE_GITHUB_APP_PRIVATE_KEY }} repository: DataDog/datadog-api-spec - name: Checkout code uses: actions/checkout@v2 - name: Post pending status check if: github.event_name == 'pull_request' uses: actions/github-script@v4.0.2 with: github-token: ${{ steps.get_token.outputs.token }} script: | const script = require('.github/workflows/scripts/test_integration.js') await script.post_status_check(github, context, "pending") - name: Set up Ruby 2.7 uses: ruby/setup-ruby@v1 with: ruby-version: 2.7 bundler-cache: true - name: Install deps run: bundle install - name: Run integration tests run: ./run-tests.sh shell: bash env: CI: "true" DD_AGENT_HOST: localhost DD_ENV: prod DD_SERVICE: datadog-api-client-ruby DD_TAGS: "team:integration-tools-and-libraries" DD_TEST_CLIENT_API_KEY: ${{ secrets.DD_CLIENT_API_KEY }} DD_TEST_CLIENT_APP_KEY: ${{ secrets.DD_CLIENT_APP_KEY }} DD_TRACE_ANALYTICS_ENABLED: "true" RECORD: "none" - name: Post failure status check if: failure() && github.event_name == 'pull_request' uses: actions/github-script@v4.0.2 with: github-token: ${{ steps.get_token.outputs.token }} script: | const script = require('./.github/workflows/scripts/test_integration.js') await script.post_status_check(github, context, "failure") - name: Post success status check if: "!failure() && github.event_name == 'pull_request'" uses: actions/github-script@v4.0.2 with: github-token: ${{ steps.get_token.outputs.token }} script: | const script = require('./.github/workflows/scripts/test_integration.js') await script.post_status_check(github, context, "success")