From 95b99742391040113df5b783927fbbcad3eee8d0 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Thu, 16 Dec 2021 16:28:50 +0200 Subject: [PATCH 01/11] Include Python version in pip cache key --- __tests__/cache-restore.test.ts | 6 +----- src/cache-distributions/cache-factory.ts | 2 +- src/cache-distributions/pip-cache.ts | 9 ++++++--- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/__tests__/cache-restore.test.ts b/__tests__/cache-restore.test.ts index f3c5b01d4..d982fd060 100644 --- a/__tests__/cache-restore.test.ts +++ b/__tests__/cache-restore.test.ts @@ -92,13 +92,9 @@ describe('restore-cache', () => { dependencyFile ); await cacheDistributor.restoreCache(); - let pythonKey = ''; - if (packageManager === 'pipenv') { - pythonKey = `python-${pythonVersion}-`; - } expect(infoSpy).toHaveBeenCalledWith( - `Cache restored from key: setup-python-${process.env['RUNNER_OS']}-${pythonKey}${packageManager}-${fileHash}` + `Cache restored from key: setup-python-${process.env['RUNNER_OS']}-python-${pythonVersion}-${packageManager}-${fileHash}` ); } ); diff --git a/src/cache-distributions/cache-factory.ts b/src/cache-distributions/cache-factory.ts index 1a8a055f0..3e363a0e2 100644 --- a/src/cache-distributions/cache-factory.ts +++ b/src/cache-distributions/cache-factory.ts @@ -13,7 +13,7 @@ export function getCacheDistributor( ) { switch (packageManager) { case PackageManagers.Pip: - return new PipCache(cacheDependencyPath); + return new PipCache(pythonVersion, cacheDependencyPath); case PackageManagers.Pipenv: return new PipenvCache(pythonVersion, cacheDependencyPath); default: diff --git a/src/cache-distributions/pip-cache.ts b/src/cache-distributions/pip-cache.ts index 81b875fda..f4d7c2424 100644 --- a/src/cache-distributions/pip-cache.ts +++ b/src/cache-distributions/pip-cache.ts @@ -8,7 +8,10 @@ import os from 'os'; import CacheDistributor from './cache-distributor'; class PipCache extends CacheDistributor { - constructor(cacheDependencyPath: string = '**/requirements.txt') { + constructor( + private pythonVersion: string, + cacheDependencyPath: string = '**/requirements.txt' + ) { super('pip', cacheDependencyPath); } @@ -36,8 +39,8 @@ class PipCache extends CacheDistributor { protected async computeKeys() { const hash = await glob.hashFiles(this.cacheDependencyPath); - const primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${this.packageManager}-${hash}`; - const restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${this.packageManager}`; + const primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}-${hash}`; + const restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}`; return { primaryKey, From eba23d025a3559b0475d7d10962fa4630c2a36cd Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Fri, 24 Dec 2021 19:52:03 +0200 Subject: [PATCH 02/11] npm run release --- dist/setup/index.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index 321877d9a..ca8a37cbd 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -34467,8 +34467,9 @@ const path = __importStar(__webpack_require__(622)); const os_1 = __importDefault(__webpack_require__(87)); const cache_distributor_1 = __importDefault(__webpack_require__(435)); class PipCache extends cache_distributor_1.default { - constructor(cacheDependencyPath = '**/requirements.txt') { + constructor(pythonVersion, cacheDependencyPath = '**/requirements.txt') { super('pip', cacheDependencyPath); + this.pythonVersion = pythonVersion; } getCacheGlobalDirectories() { return __awaiter(this, void 0, void 0, function* () { @@ -34487,8 +34488,8 @@ class PipCache extends cache_distributor_1.default { computeKeys() { return __awaiter(this, void 0, void 0, function* () { const hash = yield glob.hashFiles(this.cacheDependencyPath); - const primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${this.packageManager}-${hash}`; - const restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${this.packageManager}`; + const primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}-${hash}`; + const restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}`; return { primaryKey, restoreKey: [restoreKey] @@ -43888,7 +43889,7 @@ var PackageManagers; function getCacheDistributor(packageManager, pythonVersion, cacheDependencyPath) { switch (packageManager) { case PackageManagers.Pip: - return new pip_cache_1.default(cacheDependencyPath); + return new pip_cache_1.default(pythonVersion, cacheDependencyPath); case PackageManagers.Pipenv: return new pipenv_cache_1.default(pythonVersion, cacheDependencyPath); default: From b51496cce3e836a69b50d4c522ced7b5e36f31f2 Mon Sep 17 00:00:00 2001 From: Dmitry Shibanov Date: Mon, 27 Dec 2021 11:31:50 +0300 Subject: [PATCH 03/11] add possible fix for pipenv windows --- .github/workflows/e2e-cache.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2e-cache.yml b/.github/workflows/e2e-cache.yml index d15c6f2b6..e53035cbd 100644 --- a/.github/workflows/e2e-cache.yml +++ b/.github/workflows/e2e-cache.yml @@ -50,7 +50,7 @@ jobs: python-version: ${{ matrix.python-version }} cache: 'pipenv' - name: Install dependencies - run: pipenv install flake8 + run: pipenv install flake8 --python ${{ matrix.python-version }} python-pip-dependencies-caching-path: name: Test pip (Python ${{ matrix.python-version}}, ${{ matrix.os }}) @@ -90,4 +90,4 @@ jobs: cache: 'pipenv' cache-dependency-path: '**/requirements-linux.txt' - name: Install dependencies - run: pipenv install flake8 \ No newline at end of file + run: pipenv install flake8 --python ${{ matrix.python-version }} \ No newline at end of file From c38d8e88e27d43b7958b8e9463ac72d0382d08f2 Mon Sep 17 00:00:00 2001 From: Dmitry Shibanov Date: Mon, 27 Dec 2021 12:07:44 +0300 Subject: [PATCH 04/11] fix builds --- .github/workflows/e2e-cache.yml | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/e2e-cache.yml b/.github/workflows/e2e-cache.yml index e53035cbd..09e4aa307 100644 --- a/.github/workflows/e2e-cache.yml +++ b/.github/workflows/e2e-cache.yml @@ -50,8 +50,13 @@ jobs: python-version: ${{ matrix.python-version }} cache: 'pipenv' - name: Install dependencies - run: pipenv install flake8 --python ${{ matrix.python-version }} - + shell: pwsh + run: | + if (${{ matrix.python-version }} -Match "pypy") { + pipenv install flake8 --python pypy + } else { + pipenv install flake8 --python ${{ matrix.python-version }} + } python-pip-dependencies-caching-path: name: Test pip (Python ${{ matrix.python-version}}, ${{ matrix.os }}) runs-on: ${{ matrix.os }} @@ -90,4 +95,10 @@ jobs: cache: 'pipenv' cache-dependency-path: '**/requirements-linux.txt' - name: Install dependencies - run: pipenv install flake8 --python ${{ matrix.python-version }} \ No newline at end of file + shell: pwsh + run: | + if (${{ matrix.python-version }} -Match "pypy") { + pipenv install flake8 --python pypy + } else { + pipenv install flake8 --python ${{ matrix.python-version }} + } \ No newline at end of file From bed8ca24e11c4fcb933e8f2e372bc6643145e63e Mon Sep 17 00:00:00 2001 From: Dmitry Shibanov Date: Mon, 27 Dec 2021 12:25:55 +0300 Subject: [PATCH 05/11] fix condition --- .github/workflows/e2e-cache.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2e-cache.yml b/.github/workflows/e2e-cache.yml index 09e4aa307..0872816ec 100644 --- a/.github/workflows/e2e-cache.yml +++ b/.github/workflows/e2e-cache.yml @@ -52,7 +52,7 @@ jobs: - name: Install dependencies shell: pwsh run: | - if (${{ matrix.python-version }} -Match "pypy") { + if ("${{ matrix.python-version }}" -Match "pypy") { pipenv install flake8 --python pypy } else { pipenv install flake8 --python ${{ matrix.python-version }} @@ -97,7 +97,7 @@ jobs: - name: Install dependencies shell: pwsh run: | - if (${{ matrix.python-version }} -Match "pypy") { + if ("${{ matrix.python-version }}" -Match "pypy") { pipenv install flake8 --python pypy } else { pipenv install flake8 --python ${{ matrix.python-version }} From 0c72164e6c5e885a96ddbcb5eff1d49b79b2d8a6 Mon Sep 17 00:00:00 2001 From: Dmitry Shibanov Date: Thu, 13 Jan 2022 15:22:57 +0300 Subject: [PATCH 06/11] change installation pipenv --- .github/workflows/e2e-cache.yml | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/.github/workflows/e2e-cache.yml b/.github/workflows/e2e-cache.yml index 0872816ec..46bc9e74e 100644 --- a/.github/workflows/e2e-cache.yml +++ b/.github/workflows/e2e-cache.yml @@ -42,21 +42,19 @@ jobs: python-version: ['3.7', '3.8', '3.9', 'pypy-3.7-v7.3.5', 'pypy-3.7-v7.x'] steps: - uses: actions/checkout@v2 - - name: Install pipenv - run: pipx install pipenv - name: Setup Python uses: ./ with: python-version: ${{ matrix.python-version }} cache: 'pipenv' + - run: pip install pipenv - name: Install dependencies shell: pwsh run: | - if ("${{ matrix.python-version }}" -Match "pypy") { - pipenv install flake8 --python pypy - } else { - pipenv install flake8 --python ${{ matrix.python-version }} + if ($IsMacOS) { + $env:PATH += ":/Users/runner/.local/bin" } + pipenv install flake8 python-pip-dependencies-caching-path: name: Test pip (Python ${{ matrix.python-version}}, ${{ matrix.os }}) runs-on: ${{ matrix.os }} @@ -86,19 +84,17 @@ jobs: python-version: ['3.7', '3.8', '3.9', 'pypy-3.7-v7.3.5', 'pypy-3.7-v7.x'] steps: - uses: actions/checkout@v2 - - name: Install pipenv - run: pipx install pipenv - name: Setup Python uses: ./ with: python-version: ${{ matrix.python-version }} cache: 'pipenv' cache-dependency-path: '**/requirements-linux.txt' + - run: pip install pipenv - name: Install dependencies shell: pwsh run: | - if ("${{ matrix.python-version }}" -Match "pypy") { - pipenv install flake8 --python pypy - } else { - pipenv install flake8 --python ${{ matrix.python-version }} - } \ No newline at end of file + if ($IsMacOS) { + $env:PATH += ":/Users/runner/.local/bin" + } + pipenv install flake8 \ No newline at end of file From 9d4f4c6f93cf8bab62efbec9f3f9369429502933 Mon Sep 17 00:00:00 2001 From: Dmitry Shibanov Date: Thu, 13 Jan 2022 15:23:57 +0300 Subject: [PATCH 07/11] change order --- .github/workflows/e2e-cache.yml | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/.github/workflows/e2e-cache.yml b/.github/workflows/e2e-cache.yml index 46bc9e74e..d733f1ee0 100644 --- a/.github/workflows/e2e-cache.yml +++ b/.github/workflows/e2e-cache.yml @@ -47,14 +47,11 @@ jobs: with: python-version: ${{ matrix.python-version }} cache: 'pipenv' - - run: pip install pipenv + - name: Install pipenv + run: pipx install pipenv - name: Install dependencies - shell: pwsh - run: | - if ($IsMacOS) { - $env:PATH += ":/Users/runner/.local/bin" - } - pipenv install flake8 + run: pipenv install flake8 + python-pip-dependencies-caching-path: name: Test pip (Python ${{ matrix.python-version}}, ${{ matrix.os }}) runs-on: ${{ matrix.os }} @@ -90,11 +87,7 @@ jobs: python-version: ${{ matrix.python-version }} cache: 'pipenv' cache-dependency-path: '**/requirements-linux.txt' - - run: pip install pipenv + - name: Install pipenv + run: pipx install pipenv - name: Install dependencies - shell: pwsh - run: | - if ($IsMacOS) { - $env:PATH += ":/Users/runner/.local/bin" - } - pipenv install flake8 \ No newline at end of file + run: pipenv install flake8 \ No newline at end of file From cc5a14068b7e6f74bd9ef4e1d52f161746fd8a22 Mon Sep 17 00:00:00 2001 From: Dmitry Shibanov Date: Thu, 13 Jan 2022 15:38:25 +0300 Subject: [PATCH 08/11] add cat --- .github/workflows/e2e-cache.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2e-cache.yml b/.github/workflows/e2e-cache.yml index d733f1ee0..7d77d28e2 100644 --- a/.github/workflows/e2e-cache.yml +++ b/.github/workflows/e2e-cache.yml @@ -50,7 +50,9 @@ jobs: - name: Install pipenv run: pipx install pipenv - name: Install dependencies - run: pipenv install flake8 + run: | + pipenv install flake8 + cat Pipfile.lock python-pip-dependencies-caching-path: name: Test pip (Python ${{ matrix.python-version}}, ${{ matrix.os }}) @@ -90,4 +92,6 @@ jobs: - name: Install pipenv run: pipx install pipenv - name: Install dependencies - run: pipenv install flake8 \ No newline at end of file + run: | + pipenv install flake8 + cat Pipfile.lock \ No newline at end of file From 7e619a308faa41836625dc55c7b9388b91ed6157 Mon Sep 17 00:00:00 2001 From: Dmitry Shibanov Date: Thu, 13 Jan 2022 15:55:31 +0300 Subject: [PATCH 09/11] add exclude --- .github/workflows/e2e-cache.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/e2e-cache.yml b/.github/workflows/e2e-cache.yml index 7d77d28e2..7488c07d0 100644 --- a/.github/workflows/e2e-cache.yml +++ b/.github/workflows/e2e-cache.yml @@ -40,6 +40,11 @@ jobs: matrix: os: [ubuntu-latest, windows-latest, macos-latest] python-version: ['3.7', '3.8', '3.9', 'pypy-3.7-v7.3.5', 'pypy-3.7-v7.x'] + exclude: + - os: windows-latest + python-version: 'pypy-3.7-v7.3.5' + - os: windows-latest + python-version: 'pypy-3.7-v7.x' steps: - uses: actions/checkout@v2 - name: Setup Python @@ -81,6 +86,11 @@ jobs: matrix: os: [ubuntu-latest, windows-latest, macos-latest] python-version: ['3.7', '3.8', '3.9', 'pypy-3.7-v7.3.5', 'pypy-3.7-v7.x'] + exclude: + - os: windows-latest + python-version: 'pypy-3.7-v7.3.5' + - os: windows-latest + python-version: 'pypy-3.7-v7.x' steps: - uses: actions/checkout@v2 - name: Setup Python From ea1555cac16776ad9f020755678d6d6431fee3ae Mon Sep 17 00:00:00 2001 From: Dmitry Shibanov Date: Tue, 25 Jan 2022 18:00:42 +0300 Subject: [PATCH 10/11] change to numpy --- .github/workflows/e2e-cache.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2e-cache.yml b/.github/workflows/e2e-cache.yml index 7488c07d0..996d24c96 100644 --- a/.github/workflows/e2e-cache.yml +++ b/.github/workflows/e2e-cache.yml @@ -56,7 +56,7 @@ jobs: run: pipx install pipenv - name: Install dependencies run: | - pipenv install flake8 + pipenv install numpy cat Pipfile.lock python-pip-dependencies-caching-path: @@ -103,5 +103,5 @@ jobs: run: pipx install pipenv - name: Install dependencies run: | - pipenv install flake8 + pipenv install numpy cat Pipfile.lock \ No newline at end of file From 4854a68b463ab933150ab392476cfac9e451bdcb Mon Sep 17 00:00:00 2001 From: Dmitry Shibanov Date: Tue, 25 Jan 2022 18:01:32 +0300 Subject: [PATCH 11/11] comment exclude --- .github/workflows/e2e-cache.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/e2e-cache.yml b/.github/workflows/e2e-cache.yml index 996d24c96..66ed09736 100644 --- a/.github/workflows/e2e-cache.yml +++ b/.github/workflows/e2e-cache.yml @@ -40,11 +40,11 @@ jobs: matrix: os: [ubuntu-latest, windows-latest, macos-latest] python-version: ['3.7', '3.8', '3.9', 'pypy-3.7-v7.3.5', 'pypy-3.7-v7.x'] - exclude: - - os: windows-latest - python-version: 'pypy-3.7-v7.3.5' - - os: windows-latest - python-version: 'pypy-3.7-v7.x' + # exclude: + # - os: windows-latest + # python-version: 'pypy-3.7-v7.3.5' + # - os: windows-latest + # python-version: 'pypy-3.7-v7.x' steps: - uses: actions/checkout@v2 - name: Setup Python @@ -86,11 +86,11 @@ jobs: matrix: os: [ubuntu-latest, windows-latest, macos-latest] python-version: ['3.7', '3.8', '3.9', 'pypy-3.7-v7.3.5', 'pypy-3.7-v7.x'] - exclude: - - os: windows-latest - python-version: 'pypy-3.7-v7.3.5' - - os: windows-latest - python-version: 'pypy-3.7-v7.x' + # exclude: + # - os: windows-latest + # python-version: 'pypy-3.7-v7.3.5' + # - os: windows-latest + # python-version: 'pypy-3.7-v7.x' steps: - uses: actions/checkout@v2 - name: Setup Python