@@ -124,3 +124,60 @@ jobs:
124
124
name : LICENSE-3rdparty.yml
125
125
path : /tmp/CI.yaml
126
126
overwrite : true
127
+
128
+ license-3rdparty-csv :
129
+ runs-on : ubuntu-latest
130
+ name : " Valid LICENSE-3rdparty.csv"
131
+ steps :
132
+ - name : Checkout sources
133
+ uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
134
+ - run : stat LICENSE-3rdparty.csv
135
+ - name : Cache
136
+ uses : actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2
137
+ with :
138
+ path : |
139
+ ~/.cargo/registry/
140
+ ~/.cargo/git/db/
141
+ ~/.cargo/bin/
142
+ ~/.cargo/.crates.toml
143
+ # cache key contains current version of dd-rust-license-tool
144
+ # when upstream version is updated we can bump the cache key version,
145
+ # to cache the latest version of the tool
146
+ key : " v1-dd-rust-license-tool"
147
+ - name : Cache
148
+ uses : ./.github/actions/cache
149
+ - name : Install dd-rust-license-tool
150
+ run : cargo install --git https://github.com/DataDog/rust-license-tool.git dd-rust-license-tool
151
+ # To ensure the dependency tree is identical between the CI runner and the
152
+ # local license generation script (which also forces the 'git' protocol),
153
+ # we explicitly set the crates.io protocol. Cargo's default can vary
154
+ # between 'git' and 'sparse' depending on the environment, which can lead
155
+ # to different dependency resolutions. This guarantees consistency.
156
+ - run : mkdir -p .cargo && printf "[registries.crates-io]\nprotocol = \"git\"\n" > .cargo/config.toml
157
+ - name : " Generate new LICENSE-3rdparty.csv and check against the previous"
158
+ run : |
159
+ # The LICENSE-3rdparty.csv file must match the output of the tool in the Linux CI environment.
160
+ # To update the file locally, run the './scripts/generate-licenses.sh' script.
161
+ echo "Running dd-rust-license-tool dump to generate CSV..."
162
+ if ! dd-rust-license-tool dump > /tmp/CI.csv 2> /tmp/CI.error; then
163
+ echo "ERROR: dd-rust-license-tool dump failed! See error output below:"
164
+ cat /tmp/CI.error
165
+ exit 1
166
+ fi
167
+
168
+ # Compare the generated CSV with the current one. If they differ, diff will have a non-zero exit code.
169
+ if ! diff /tmp/CI.csv LICENSE-3rdparty.csv; then
170
+ echo "Differences detected in LICENSE-3rdparty.csv."
171
+ echo "Please run './scripts/generate-licenses.sh' to update the file and commit the changes."
172
+ exit 1
173
+ fi
174
+
175
+ echo "No differences found."
176
+
177
+ - name : export the generated license file on failure
178
+ if : failure()
179
+ uses : actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # v4.6.1
180
+ with :
181
+ name : LICENSE-3rdparty.csv
182
+ path : /tmp/CI.csv
183
+ overwrite : true
0 commit comments