From d28ce001ab9a8c16a971531d1922bea092ef24b9 Mon Sep 17 00:00:00 2001 From: Lingkai Dong Date: Wed, 26 May 2021 14:00:12 +0100 Subject: [PATCH 1/3] Travis: Use shallow fetches We only compare files in current PR with the base branch. There's no need to fetch the full git history or branches that are not involved in the comparison. This is to save time in Travis runs. --- .travis.yml | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index ab9a2872aba..4465254b50d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -68,9 +68,8 @@ matrix: before_script: - mkdir -p SCANCODE - mkdir -p SCANCODE_NEW_FILES - # Fetch remaining information needed for branch comparison - - git fetch --all --unshallow --tags - - git fetch origin "${TRAVIS_BRANCH}" + # Fetch the base branch to compare against + - git fetch origin "${TRAVIS_BRANCH}" --depth=1 script: # scancode does not support list of files, only one file or directory # we use SCANCODE directory for all changed files (their copies with full tree) @@ -130,9 +129,8 @@ matrix: export PATH="${PWD}/bin:${PATH}"; cd - - astyle --version - # Fetch remaining information needed for branch comparison - - git fetch --all --unshallow --tags - - git fetch origin "${TRAVIS_BRANCH}" + # Fetch the base branch to compare against + - git fetch origin "${TRAVIS_BRANCH}" --depth=1 script: - >- git diff --name-only --diff-filter=d FETCH_HEAD..HEAD \ @@ -246,9 +244,8 @@ matrix: - python -m pip install --upgrade setuptools==40.4.3 - pip install tabulate argparse - pip list --verbose - # Fetch remaining information needed for branch comparison - - git fetch --all --unshallow --tags - - git fetch origin "${TRAVIS_BRANCH}" + # Fetch the base branch to compare against + - git fetch origin "${TRAVIS_BRANCH}" --depth=1 script: - >- git diff --name-only --diff-filter=d FETCH_HEAD..HEAD \ From 4d09e47c8faf3dd9e4722defca02b5f9acb7b242 Mon Sep 17 00:00:00 2001 From: Lingkai Dong Date: Wed, 26 May 2021 14:05:34 +0100 Subject: [PATCH 2/3] Travis: Fix frozen tools check never failing Having recently moved the frozen tools check to a standalone stage at the end, we need to fetch the base branch so make comparison work. Travis environments are not shared across different stages. Without the fetch, the check always passes as a PR is compared with itself. --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 4465254b50d..50b0747b9d8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -317,6 +317,9 @@ matrix: stage: "Frozen tools check" name: "Frozen tools check" env: NAME=frozen_tools_check + before_script: + # Fetch the base branch to compare against + - git fetch origin "${TRAVIS_BRANCH}" --depth=1 script: # Reject any changes to tools that would require a re-release of the # tools for the online compiler. From e31f2bb781296b289b0edff9d7c9ff5ad1db4f30 Mon Sep 17 00:00:00 2001 From: Lingkai Dong Date: Wed, 26 May 2021 14:31:35 +0100 Subject: [PATCH 3/3] Travis: Do not ignore deleted frozen files The filter `--diff-filter=d' causes deleted files to be ignored from the frozen tools check. But there is no reason for this, as deleting a file can break compatibility with the legacy tools. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 50b0747b9d8..564dc54d292 100644 --- a/.travis.yml +++ b/.travis.yml @@ -325,7 +325,7 @@ matrix: # tools for the online compiler. - >- frozen_files=`\ - git diff --name-only --diff-filter=d FETCH_HEAD..HEAD \ + git diff --name-only FETCH_HEAD..HEAD \ | egrep \ -e "^tools/build_api*" \ -e "^tools/config*" \