Repository navigation
Publish Cloud Cost Management cloud account listing #9734
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: Run Tests | |
| permissions: | |
| contents: read | |
| env: | |
| GIT_AUTHOR_EMAIL: "packages@datadoghq.com" | |
| GIT_AUTHOR_NAME: "ci.datadog-api-spec" | |
| on: | |
| pull_request: | |
| branches: | |
| - master | |
| schedule: | |
| - cron: "0 6 * * *" | |
| concurrency: | |
| group: unit-${{ github.head_ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| pre-commit: | |
| 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' | |
| permissions: | |
| id-token: write | |
| contents: read | |
| uses: ./.github/workflows/reusable-pre-commit.yml | |
| with: | |
| enable-commit-changes: true | |
| license: | |
| 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' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| repository: DataDog/datadog-api-client-rust | |
| - name: Install Rust | |
| id: rust | |
| run: | | |
| rustup toolchain install stable --profile minimal --no-self-update && rustup default stable | |
| echo "version=$(rustc --version | awk '{print $2}')" >> $GITHUB_OUTPUT | |
| shell: bash | |
| - name: Cache Cargo registry | |
| uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.toml') }} | |
| restore-keys: ${{ runner.os }}-cargo-registry- | |
| - name: Cache license tool | |
| uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2 | |
| with: | |
| path: ~/.cargo/bin/dd-rust-license-tool | |
| key: ${{ runner.os }}-cargo-bin-${{ steps.rust.outputs.version }}-${{ hashFiles('scripts/install-license-tool.sh') }} | |
| - name: Update package version in license lockfile | |
| if: github.event_name == 'schedule' || startsWith(github.event.pull_request.head.ref, 'release/') | |
| run: | | |
| export CARGO_RESOLVER_LOCKFILE_PATH="${PWD}/.ci/license/Cargo.lock" | |
| cargo update --package datadog-api-client | |
| shell: bash | |
| - name: License check | |
| run: ./scripts/license-check.sh | |
| shell: bash | |
| test: | |
| 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' | |
| uses: ./.github/workflows/reusable-rust-test.yml | |
| with: | |
| rust-versions: '["stable"]' | |
| platforms: '["ubuntu-latest"]' | |
| examples: | |
| 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' | |
| runs-on: ubuntu-latest | |
| env: | |
| CARGO_INCREMENTAL: "0" | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
| with: | |
| repository: DataDog/datadog-api-client-rust | |
| - name: Install Rust | |
| id: rust | |
| run: | | |
| rustup toolchain install stable --profile minimal --no-self-update && rustup default stable | |
| echo "version=$(rustc --version | awk '{print $2}')" >> $GITHUB_OUTPUT | |
| shell: bash | |
| - name: Cache Cargo registry | |
| uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.toml') }} | |
| restore-keys: ${{ runner.os }}-cargo-registry- | |
| - name: Resolve Cargo dependencies | |
| run: cargo generate-lockfile | |
| shell: bash | |
| - name: Cache Cargo build | |
| uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2 | |
| with: | |
| path: target | |
| key: ${{ runner.os }}-cargo-target-v2-${{ steps.rust.outputs.version }}-examples-${{ hashFiles('Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo-target-v2-${{ steps.rust.outputs.version }}-examples- | |
| ${{ runner.os }}-cargo-target-v2-${{ steps.rust.outputs.version }}- | |
| - name: Check examples | |
| run: cargo check --examples | |
| shell: bash | |
| - name: Remove workspace artifacts from cache | |
| run: cargo clean --package datadog-api-client | |
| shell: bash | |
| report: | |
| runs-on: ubuntu-latest | |
| if: always() && github.event_name == 'pull_request' && contains(github.event.pull_request.head.ref, 'datadog-api-spec/generated/') | |
| needs: | |
| - test | |
| - license | |
| - examples | |
| permissions: | |
| id-token: write | |
| steps: | |
| - name: Get GitHub App token | |
| if: github.event_name == 'pull_request' | |
| id: get_token | |
| uses: DataDog/dd-octo-sts-action@96a25462dbcb10ebf0bfd6e2ccc917d2ab235b9a # v1.0.4 | |
| with: | |
| scope: ddoghq/datadog-api-spec | |
| policy: datadog-api-client-rust.test.post-status | |
| - name: Post status check | |
| uses: DataDog/github-actions/post-status-check@65b4875f33ad773d7ba4b005a2cb5f35020295f3 # v2.3.0 | |
| with: | |
| github-token: ${{ steps.get_token.outputs.token }} | |
| owner: ddoghq | |
| repo: datadog-api-spec | |
| status: ${{ (needs.test.result == 'cancelled' || needs.license.result == 'cancelled' || needs.examples.result == 'cancelled') && 'pending' || (needs.test.result == 'success' && needs.license.result == 'success' && needs.examples.result == 'success') && 'success' || 'failure' }} | |
| context: master/unit |