-
Notifications
You must be signed in to change notification settings - Fork 4
142 lines (133 loc) · 5.15 KB
/
Copy pathtest.yml
File metadata and controls
142 lines (133 loc) · 5.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
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
key: ${{ runner.os }}-cargo-bin-${{ steps.rust.outputs.version }}
restore-keys: ${{ runner.os }}-cargo-bin-
- 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'
needs: test
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 Cargo build
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2
with:
path: target
key: ${{ runner.os }}-cargo-target-${{ steps.rust.outputs.version }}-${{ hashFiles('**/Cargo.toml') }}
restore-keys: ${{ runner.os }}-cargo-target-${{ steps.rust.outputs.version }}-
- name: Check examples
run: cargo check --examples
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: DataDog/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 }}
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