From 6173a19bd9dd94ae6f07c43ab8323384b6f58036 Mon Sep 17 00:00:00 2001 From: r1viollet Date: Fri, 16 Feb 2024 13:25:29 +0100 Subject: [PATCH] 3rd party license check The check on the 3rd party licenses was causing issues when the registry paths were different. This is a workaround where we ignore parts of the paths. --- .github/workflows/lint.yml | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index fdfc7151a..51733dbae 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -81,13 +81,25 @@ jobs: - name: "Generate new LICENSE-3rdparty.yml and check against the previous" env: CARGO_HOME: "/tmp/dd-cargo" - run: > + run: | + # Run cargo bundle-licenses without directly checking against a previous snapshot cargo bundle-licenses \ --format yaml \ - --output /tmp/CI.yaml \ - --previous LICENSE-3rdparty.yml \ - --check-previous \ - || diff /tmp/CI.yaml LICENSE-3rdparty.yml + --output /tmp/CI.yaml + + # Normalize the paths in both files to ignore registry differences + sed -E 's/(registry\/src\/)[^\/]+/\1normalized_path/g' /tmp/CI.yaml > /tmp/CI_normalized.yaml + sed -E 's/(registry\/src\/)[^\/]+/\1normalized_path/g' LICENSE-3rdparty.yml > /tmp/LICENSE-3rdparty_normalized.yml + + # Now perform the diff on the normalized files + if ! diff /tmp/CI_normalized.yaml /tmp/LICENSE-3rdparty_normalized.yml; then + echo "Differences detected." + exit 1 + fi + + echo "No differences found." + + - name: export the generated license file on failure if: ${{ failure() }} uses: actions/upload-artifact@v3