Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 104 additions & 0 deletions .github/workflows/reusable-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Reusable Complete CI Workflow

on:
workflow_call:
inputs:
target-branch:
description: 'Branch to checkout and test (defaults to the calling branch)'
required: false
type: string
default: ''
java-versions:
description: 'JSON array of Java versions to test against'
required: false
type: string
default: '["8", "16", "18", "19"]'
platforms:
description: 'JSON array of platforms to run tests on'
required: false
type: string
default: '["ubuntu-latest"]'
test-script:
description: 'Test script to execute'
required: false
type: string
default: './run-tests.sh'
examples-script:
description: 'Examples script to execute'
required: false
type: string
default: './check-examples.sh'
secrets:
PIPELINE_GITHUB_APP_ID:
required: false
PIPELINE_GITHUB_APP_PRIVATE_KEY:
required: false
# Integration test secrets
DD_API_KEY:
required: false
DD_CLIENT_API_KEY:
required: false
DD_CLIENT_APP_KEY:
required: false
SLEEP_AFTER_REQUEST:
required: false

jobs:
pre-commit:
uses: ./.github/workflows/reusable-pre-commit.yml
with:
target-branch: ${{ inputs.target-branch }}
enable-commit-changes: false # Don't auto-commit in external CI
secrets:
PIPELINE_GITHUB_APP_ID: ${{ secrets.PIPELINE_GITHUB_APP_ID }}
PIPELINE_GITHUB_APP_PRIVATE_KEY: ${{ secrets.PIPELINE_GITHUB_APP_PRIVATE_KEY }}

javadoc:
uses: ./.github/workflows/reusable-javadoc.yml
with:
target-branch: ${{ inputs.target-branch }}
secrets:
PIPELINE_GITHUB_APP_ID: ${{ secrets.PIPELINE_GITHUB_APP_ID }}
PIPELINE_GITHUB_APP_PRIVATE_KEY: ${{ secrets.PIPELINE_GITHUB_APP_PRIVATE_KEY }}

shading:
uses: ./.github/workflows/reusable-shading.yml
with:
target-branch: ${{ inputs.target-branch }}
secrets:
PIPELINE_GITHUB_APP_ID: ${{ secrets.PIPELINE_GITHUB_APP_ID }}
PIPELINE_GITHUB_APP_PRIVATE_KEY: ${{ secrets.PIPELINE_GITHUB_APP_PRIVATE_KEY }}

test:
uses: ./.github/workflows/reusable-java-test.yml
with:
target-branch: ${{ inputs.target-branch }}
java-versions: ${{ inputs.java-versions }}
platforms: ${{ inputs.platforms }}
test-script: ${{ inputs.test-script }}
secrets:
PIPELINE_GITHUB_APP_ID: ${{ secrets.PIPELINE_GITHUB_APP_ID }}
PIPELINE_GITHUB_APP_PRIVATE_KEY: ${{ secrets.PIPELINE_GITHUB_APP_PRIVATE_KEY }}
DD_API_KEY: ${{ secrets.DD_API_KEY }}

examples:
uses: ./.github/workflows/reusable-examples.yml
with:
target-branch: ${{ inputs.target-branch }}
examples-script: ${{ inputs.examples-script }}
secrets:
PIPELINE_GITHUB_APP_ID: ${{ secrets.PIPELINE_GITHUB_APP_ID }}
PIPELINE_GITHUB_APP_PRIVATE_KEY: ${{ secrets.PIPELINE_GITHUB_APP_PRIVATE_KEY }}

integration:
uses: ./.github/workflows/reusable-integration-test.yml
with:
target-branch: ${{ inputs.target-branch }}
secrets:
PIPELINE_GITHUB_APP_ID: ${{ secrets.PIPELINE_GITHUB_APP_ID }}
PIPELINE_GITHUB_APP_PRIVATE_KEY: ${{ secrets.PIPELINE_GITHUB_APP_PRIVATE_KEY }}
DD_API_KEY: ${{ secrets.DD_API_KEY }}
DD_CLIENT_API_KEY: ${{ secrets.DD_CLIENT_API_KEY }}
DD_CLIENT_APP_KEY: ${{ secrets.DD_CLIENT_APP_KEY }}
SLEEP_AFTER_REQUEST: ${{ secrets.SLEEP_AFTER_REQUEST }}

44 changes: 44 additions & 0 deletions .github/workflows/reusable-examples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Reusable Examples Workflow

on:
workflow_call:
inputs:
target-branch:
description: 'Branch to checkout and test (defaults to the calling branch)'
required: false
type: string
default: ''
examples-script:
description: 'Examples script to execute'
required: false
type: string
default: './check-examples.sh'
java-version:
description: 'Java version to use for examples'
required: false
type: string
default: '16'
secrets:
PIPELINE_GITHUB_APP_ID:
required: false
PIPELINE_GITHUB_APP_PRIVATE_KEY:
required: false

jobs:
examples:
runs-on: ubuntu-latest
if: (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/')) || github.event_name == 'schedule'
steps:
- uses: actions/checkout@v3
with:
repository: DataDog/datadog-api-client-java
ref: ${{ inputs.target-branch || github.ref }}
- name: Install Java
uses: actions/setup-java@v3
with:
java-version: ${{ inputs.java-version }}
distribution: "temurin"
cache: "maven"
- name: Check examples
run: ${{ inputs.examples-script }}
shell: bash
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Run Integration Tests
name: Reusable Integration Test Workflow

permissions:
contents: read
Expand All @@ -16,6 +16,41 @@ on:
- master
schedule:
- cron: "0 3 * * *"
workflow_call:
inputs:
target-branch:
description: 'Branch to checkout and test (defaults to the calling branch)'
required: false
type: string
default: ''
enable-status-reporting:
description: 'Whether to post status checks to datadog-api-spec repo'
required: false
type: boolean
default: false
status-context:
description: 'Context for status checks'
required: false
type: string
default: 'integration'
target-repo:
description: 'Repository to post status to'
required: false
type: string
default: 'datadog-api-spec'
secrets:
PIPELINE_GITHUB_APP_ID:
required: false
PIPELINE_GITHUB_APP_PRIVATE_KEY:
required: false
DD_API_KEY:
required: true
DD_CLIENT_API_KEY:
required: true
DD_CLIENT_APP_KEY:
required: true
SLEEP_AFTER_REQUEST:
required: false

concurrency:
group: integration-${{ github.head_ref }}
Expand Down Expand Up @@ -48,17 +83,20 @@ jobs:
with:
app-id: ${{ secrets.PIPELINE_GITHUB_APP_ID }}
private-key: ${{ secrets.PIPELINE_GITHUB_APP_PRIVATE_KEY }}
repositories: datadog-api-spec
repositories: ${{ inputs.target-repo || 'datadog-api-spec' }}
- name: Checkout code
uses: actions/checkout@v3
with:
repository: DataDog/datadog-api-client-java
ref: ${{ inputs.target-branch || github.ref }}
- name: Post pending status check
if: github.event_name == 'pull_request' && contains(github.event.pull_request.head.ref, 'datadog-api-spec/generated/')
if: github.event_name == 'pull_request' && contains(github.event.pull_request.head.ref, 'datadog-api-spec/generated/') && (inputs.enable-status-reporting || github.event_name != 'workflow_call')
uses: DataDog/github-actions/post-status-check@v2
with:
github-token: ${{ steps.get_token.outputs.token }}
repo: datadog-api-spec
repo: ${{ inputs.target-repo || 'datadog-api-spec' }}
status: pending
context: integration
context: ${{ inputs.status-context || 'integration' }}
- name: Install Java
uses: actions/setup-java@v3
with:
Expand All @@ -85,18 +123,18 @@ jobs:
RECORD: "none"
SLEEP_AFTER_REQUEST: "${{ vars.SLEEP_AFTER_REQUEST }}"
- name: Post failure status check
if: failure() && github.event_name == 'pull_request' && contains(github.event.pull_request.head.ref, 'datadog-api-spec/generated/')
if: failure() && github.event_name == 'pull_request' && contains(github.event.pull_request.head.ref, 'datadog-api-spec/generated/') && (inputs.enable-status-reporting || github.event_name != 'workflow_call')
uses: DataDog/github-actions/post-status-check@v2
with:
github-token: ${{ steps.get_token.outputs.token }}
repo: datadog-api-spec
repo: ${{ inputs.target-repo || 'datadog-api-spec' }}
status: failure
context: integration
context: ${{ inputs.status-context || 'integration' }}
- name: Post success status check
if: "!failure() && github.event_name == 'pull_request' && contains(github.event.pull_request.head.ref, 'datadog-api-spec/generated/')"
if: "!failure() && github.event_name == 'pull_request' && contains(github.event.pull_request.head.ref, 'datadog-api-spec/generated/') && (inputs.enable-status-reporting || github.event_name != 'workflow_call')"
uses: DataDog/github-actions/post-status-check@v2
with:
github-token: ${{ steps.get_token.outputs.token }}
repo: datadog-api-spec
repo: ${{ inputs.target-repo || 'datadog-api-spec' }}
status: success
context: integration
context: ${{ inputs.status-context || 'integration' }}
62 changes: 62 additions & 0 deletions .github/workflows/reusable-java-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Reusable Java Testing Workflow

on:
workflow_call:
inputs:
target-branch:
description: 'Branch to checkout and test (defaults to the calling branch)'
required: false
type: string
default: ''
java-versions:
description: 'JSON array of Java versions to test against'
required: false
type: string
default: '["8", "16", "18", "19"]'
platforms:
description: 'JSON array of platforms to run tests on'
required: false
type: string
default: '["ubuntu-latest"]'
test-script:
description: 'Test script to execute'
required: false
type: string
default: './run-tests.sh'
secrets:
PIPELINE_GITHUB_APP_ID:
required: false
PIPELINE_GITHUB_APP_PRIVATE_KEY:
required: false
DD_API_KEY:
required: false

jobs:
test:
strategy:
matrix:
java-version: ${{ fromJSON(inputs.java-versions) }}
platform: ${{ fromJSON(inputs.platforms) }}
runs-on: ${{ matrix.platform }}
if: (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/')) || github.event_name == 'schedule'
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
repository: DataDog/datadog-api-client-java
ref: ${{ inputs.target-branch || github.ref }}
- name: Install Java
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java-version }}
distribution: "temurin"
cache: "maven"
- name: Configure Datadog Test Optimization
uses: datadog/test-visibility-github-action@v2
with:
languages: java
api_key: ${{ secrets.DD_API_KEY }}
- name: Test
run: ${{ inputs.test-script }}
env:
DD_CIVISIBILITY_COMPILER_PLUGIN_AUTO_CONFIGURATION_ENABLED: "false"
39 changes: 39 additions & 0 deletions .github/workflows/reusable-javadoc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Reusable Javadoc Workflow

on:
workflow_call:
inputs:
target-branch:
description: 'Branch to checkout and test (defaults to the calling branch)'
required: false
type: string
default: ''
java-version:
description: 'Java version to use for javadoc'
required: false
type: string
default: '8'
secrets:
PIPELINE_GITHUB_APP_ID:
required: false
PIPELINE_GITHUB_APP_PRIVATE_KEY:
required: false

jobs:
javadoc:
runs-on: ubuntu-latest
if: (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/')) || github.event_name == 'schedule'
steps:
- uses: actions/checkout@v3
with:
repository: DataDog/datadog-api-client-java
ref: ${{ inputs.target-branch || github.ref }}
- name: Install Java
uses: actions/setup-java@v3
with:
java-version: ${{ inputs.java-version }}
distribution: "temurin"
cache: "maven"
- name: Build javadoc
run: mvn javadoc:javadoc
shell: bash
Loading