From 621de4d882a8a0df0bb555897380dc9e7f111302 Mon Sep 17 00:00:00 2001 From: Sajith Sasidharan Date: Mon, 18 Jan 2021 10:55:18 -0500 Subject: [PATCH 01/12] Add newsfragment --- newsfragments/3591.minor | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 newsfragments/3591.minor diff --git a/newsfragments/3591.minor b/newsfragments/3591.minor new file mode 100644 index 000000000..e69de29bb From fa1a8e8371a2a6567901e8b5dcd7259f0e1e7352 Mon Sep 17 00:00:00 2001 From: Sajith Sasidharan Date: Mon, 18 Jan 2021 10:57:31 -0500 Subject: [PATCH 02/12] Upgrade pip used in GitHub Actions From pip 20.1+ onward, "pip cache dir" can be used to find location of pip cache, and this is useful across all three major OSes supported by GitHub Actions. --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fd5049104..50a1a3d2f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,7 +43,7 @@ jobs: - name: Install Python packages run: | - pip install --upgrade codecov tox setuptools + pip install --upgrade codecov tox setuptools pip pip list - name: Display tool versions @@ -114,7 +114,7 @@ jobs: - name: Install Python packages run: | - pip install --upgrade tox + pip install --upgrade tox pip pip list - name: Display tool versions @@ -166,7 +166,7 @@ jobs: - name: Install Python packages run: | - pip install --upgrade tox + pip install --upgrade tox pip pip list - name: Display tool versions From 27a122088cdba445465428da6e7680c9a22e6c74 Mon Sep 17 00:00:00 2001 From: Sajith Sasidharan Date: Mon, 18 Jan 2021 11:02:55 -0500 Subject: [PATCH 03/12] Use pip cache on GitHub Actions Using the method outlined in https://github.com/actions/cache/blob/main/examples.md#using-pip-to-get-cache-location --- .github/workflows/ci.yml | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 50a1a3d2f..8ca015e07 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,6 +46,19 @@ jobs: pip install --upgrade codecov tox setuptools pip pip list + - name: Get pip cache directory + id: pip-cache + run: | + echo "::set-output name=dir::$(pip cache dir)" + + - name: pip cache + uses: actions/cache@v2 + with: + path: ${{ steps.pip-cache.outputs.dir }} + key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} + restore-keys: | + ${{ runner.os }}-pip- + - name: Display tool versions run: python misc/build_helpers/show-tool-versions.py @@ -117,6 +130,19 @@ jobs: pip install --upgrade tox pip pip list + - name: Get pip cache directory + id: pip-cache + run: | + echo "::set-output name=dir::$(pip cache dir)" + + - name: pip cache + uses: actions/cache@v2 + with: + path: ${{ steps.pip-cache.outputs.dir }} + key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} + restore-keys: | + ${{ runner.os }}-pip- + - name: Display tool versions run: python misc/build_helpers/show-tool-versions.py @@ -169,6 +195,19 @@ jobs: pip install --upgrade tox pip pip list + - name: Get pip cache directory + id: pip-cache + run: | + echo "::set-output name=dir::$(pip cache dir)" + + - name: pip cache + uses: actions/cache@v2 + with: + path: ${{ steps.pip-cache.outputs.dir }} + key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} + restore-keys: | + ${{ runner.os }}-pip- + - name: Display tool versions run: python misc/build_helpers/show-tool-versions.py From 573ab8768b4443a8e41304708040607974a9f4d4 Mon Sep 17 00:00:00 2001 From: Sajith Sasidharan Date: Mon, 18 Jan 2021 11:08:56 -0500 Subject: [PATCH 04/12] Re-title "use pip cache" step in GitHub Actions --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8ca015e07..51cec9e54 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,7 +51,7 @@ jobs: run: | echo "::set-output name=dir::$(pip cache dir)" - - name: pip cache + - name: Use pip cache uses: actions/cache@v2 with: path: ${{ steps.pip-cache.outputs.dir }} @@ -135,7 +135,7 @@ jobs: run: | echo "::set-output name=dir::$(pip cache dir)" - - name: pip cache + - name: Use pip cache uses: actions/cache@v2 with: path: ${{ steps.pip-cache.outputs.dir }} @@ -200,7 +200,7 @@ jobs: run: | echo "::set-output name=dir::$(pip cache dir)" - - name: pip cache + - name: Use pip cache uses: actions/cache@v2 with: path: ${{ steps.pip-cache.outputs.dir }} From f731159cd7608925c5713cb4053067ef81c6bf8b Mon Sep 17 00:00:00 2001 From: Sajith Sasidharan Date: Mon, 18 Jan 2021 13:13:32 -0500 Subject: [PATCH 05/12] Install Python packages after setting up pip cache --- .github/workflows/ci.yml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 51cec9e54..c3f32c919 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,11 +41,6 @@ jobs: with: python-version: ${{ matrix.python-version }} - - name: Install Python packages - run: | - pip install --upgrade codecov tox setuptools pip - pip list - - name: Get pip cache directory id: pip-cache run: | @@ -59,6 +54,11 @@ jobs: restore-keys: | ${{ runner.os }}-pip- + - name: Install Python packages + run: | + pip install --upgrade codecov tox setuptools pip + pip list + - name: Display tool versions run: python misc/build_helpers/show-tool-versions.py @@ -125,11 +125,6 @@ jobs: with: python-version: ${{ matrix.python-version }} - - name: Install Python packages - run: | - pip install --upgrade tox pip - pip list - - name: Get pip cache directory id: pip-cache run: | @@ -143,6 +138,11 @@ jobs: restore-keys: | ${{ runner.os }}-pip- + - name: Install Python packages + run: | + pip install --upgrade tox pip + pip list + - name: Display tool versions run: python misc/build_helpers/show-tool-versions.py @@ -190,11 +190,6 @@ jobs: with: python-version: ${{ matrix.python-version }} - - name: Install Python packages - run: | - pip install --upgrade tox pip - pip list - - name: Get pip cache directory id: pip-cache run: | @@ -208,6 +203,11 @@ jobs: restore-keys: | ${{ runner.os }}-pip- + - name: Install Python packages + run: | + pip install --upgrade tox pip + pip list + - name: Display tool versions run: python misc/build_helpers/show-tool-versions.py From 8bf068f99152aed31b51ab86b6f3edbfd20baf4a Mon Sep 17 00:00:00 2001 From: Sajith Sasidharan Date: Mon, 18 Jan 2021 13:19:18 -0500 Subject: [PATCH 06/12] What's the pip version on GitHub Actions? There's no need of upgrading pip if GA offers a sufficiently new pip. --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c3f32c919..0135d9ab9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,6 +44,7 @@ jobs: - name: Get pip cache directory id: pip-cache run: | + pip --version echo "::set-output name=dir::$(pip cache dir)" - name: Use pip cache From 1f1a30095ea9359a3c3b752bfbc513efa3685dca Mon Sep 17 00:00:00 2001 From: Sajith Sasidharan Date: Mon, 18 Jan 2021 13:22:04 -0500 Subject: [PATCH 07/12] Get pip version for all three GitHub Actions OSes --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0135d9ab9..1943933b2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -44,7 +44,6 @@ jobs: - name: Get pip cache directory id: pip-cache run: | - pip --version echo "::set-output name=dir::$(pip cache dir)" - name: Use pip cache @@ -194,6 +193,7 @@ jobs: - name: Get pip cache directory id: pip-cache run: | + pip --version echo "::set-output name=dir::$(pip cache dir)" - name: Use pip cache From 2a1a5cb0a5b232487894dafdfa7200a96f1b1d4b Mon Sep 17 00:00:00 2001 From: Sajith Sasidharan Date: Mon, 18 Jan 2021 13:32:53 -0500 Subject: [PATCH 08/12] GitHub Actions have sufficiently recent pip At the time of writing this commit message, GitHub Actions offers pip v20.3.3 for both ubuntu-latest and windows-latest, and pip v20.3.1 for macos-latest. Those are sufficiently recent pip versions that have "cache dir" sub-command. --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1943933b2..c3f32c919 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -193,7 +193,6 @@ jobs: - name: Get pip cache directory id: pip-cache run: | - pip --version echo "::set-output name=dir::$(pip cache dir)" - name: Use pip cache From adbe23fe7aac3a0f8b55b3135d266a531ec0bcc4 Mon Sep 17 00:00:00 2001 From: Sajith Sasidharan Date: Mon, 18 Jan 2021 13:34:25 -0500 Subject: [PATCH 09/12] Add a note about pip version on GitHub Actions --- .github/workflows/ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c3f32c919..8ccf07aba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,6 +41,11 @@ jobs: with: python-version: ${{ matrix.python-version }} + # We need "pip cache dir", which became a thing in pip v20.1+. + # At the time of writing this, GitHub Actions offers pip v20.3.3 + # for both ubuntu-latest and windows-latest, and pip v20.3.1 for + # macos-latest. Those are sufficiently recent pip versions that + # have "cache dir" sub-command. - name: Get pip cache directory id: pip-cache run: | From 99cca0ea8e7223886b5ee9d184dd70a70141a031 Mon Sep 17 00:00:00 2001 From: Sajith Sasidharan Date: Mon, 18 Jan 2021 13:38:09 -0500 Subject: [PATCH 10/12] No need of upgrading pip on GitHub Actions --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8ccf07aba..afb99c67a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,7 +61,7 @@ jobs: - name: Install Python packages run: | - pip install --upgrade codecov tox setuptools pip + pip install --upgrade codecov tox setuptools pip list - name: Display tool versions @@ -145,7 +145,7 @@ jobs: - name: Install Python packages run: | - pip install --upgrade tox pip + pip install --upgrade tox pip list - name: Display tool versions @@ -210,7 +210,7 @@ jobs: - name: Install Python packages run: | - pip install --upgrade tox pip + pip install --upgrade tox pip list - name: Display tool versions From 9e4ea0c4910c819284b9fc74fd488d522bcc5d47 Mon Sep 17 00:00:00 2001 From: Sajith Sasidharan Date: Mon, 18 Jan 2021 17:54:17 -0500 Subject: [PATCH 11/12] Use fetch-depth of 0 with GitHub Actions Using a fetch-depth of 0 should have the same effect as as `git fetch --prune --unshallow` after doing a shallow checkout. --- .github/workflows/ci.yml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index afb99c67a..213a87ba1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,11 +30,12 @@ jobs: with: args: install vcpython27 + # See https://github.com/actions/checkout. A fetch-depth of 0 + # fetches all tags and branches. - name: Check out Tahoe-LAFS sources uses: actions/checkout@v2 - - - name: Fetch all history for all tags and branches - run: git fetch --prune --unshallow + with: + fetch-depth: 0 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v1 @@ -121,9 +122,8 @@ jobs: - name: Check out Tahoe-LAFS sources uses: actions/checkout@v2 - - - name: Fetch all history for all tags and branches - run: git fetch --prune --unshallow + with: + fetch-depth: 0 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v1 @@ -186,9 +186,8 @@ jobs: - name: Check out Tahoe-LAFS sources uses: actions/checkout@v2 - - - name: Fetch all history for all tags and branches - run: git fetch --prune --unshallow + with: + fetch-depth: 0 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v1 From ed92202762f56c7b37a161064dc4613ec7d9d8d7 Mon Sep 17 00:00:00 2001 From: Sajith Sasidharan Date: Mon, 18 Jan 2021 17:55:07 -0500 Subject: [PATCH 12/12] Updates comments about GitHub cache action --- .github/workflows/ci.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 213a87ba1..ee36833ca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,16 +42,17 @@ jobs: with: python-version: ${{ matrix.python-version }} - # We need "pip cache dir", which became a thing in pip v20.1+. - # At the time of writing this, GitHub Actions offers pip v20.3.3 - # for both ubuntu-latest and windows-latest, and pip v20.3.1 for - # macos-latest. Those are sufficiently recent pip versions that - # have "cache dir" sub-command. + # To use pip caching with GitHub Actions in an OS-independent + # manner, we need `pip cache dir` command, which became + # available since pip v20.1+. At the time of writing this, + # GitHub Actions offers pip v20.3.3 for both ubuntu-latest and + # windows-latest, and pip v20.3.1 for macos-latest. - name: Get pip cache directory id: pip-cache run: | echo "::set-output name=dir::$(pip cache dir)" + # See https://github.com/actions/cache - name: Use pip cache uses: actions/cache@v2 with: