Compare commits

...
7 Commits
Author SHA1 Message Date
aparnajyothi-y f677139bbe Bump pyinstaller from 3.6 to 5.13.1 in /__tests__/data (#923)
* Update e2e-cache.yml

* Update basic-validation.yml

* Pyinstaller upgrade to 5.13.1

* pyinstaller-update

* Update basic-validation.yml

* Update e2e-cache.yml
2024-08-13 14:03:23 -05:00
2bd53f9a4d Documentation update for caching poetry dependencies (#908)
* Create testing.yml

* Update testing.yml

* Fix for parsing version number from TOML 1.0.0 pyproject.toml file

* Delete .github/workflows/testing.yml

* fixed license issue

* updated the Note

* updated doc

* updated the doc

* npm run build

* Mark up corrections

---------

Co-authored-by: gowridurgad <[email protected]>
Co-authored-by: HarithaVattikuti <[email protected]>
2024-08-08 12:54:56 -05:00
Zxilly 80b49d3ed8 fix: add arch to cache key (#896)
* fix: add arch to cache key

* test: update tests accordingly
2024-08-07 15:12:32 -05:00
Priya Gupta 036a523674 Fix: Add .zip extension to Windows package downloads for Expand-Archive Compatibility (#916)
* Fix: specify filename during Windows package download

* Changed unit test download urls
2024-08-05 12:23:34 -05:00
sciencewhiz 04c1311429 Fix display of emojis in contributors doc (#899) 2024-07-23 09:16:08 -05:00
priya-kinthali cb68456441 Updated @iarna/toml version to 3.0.0 (#912) 2024-07-22 13:50:49 -05:00
gowridurgadandgowridurgad 39cd14951b Documentation update for cache (#873)
* updated doc

* added note

* modify1

* Update advanced-usage.md

* Update 0000-caching-dependencies.md

---------

Co-authored-by: gowridurgad <[email protected]>
2024-07-10 08:48:13 -05:00
18 changed files with 355 additions and 456 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
--- ---
name: "@iarna/toml" name: "@iarna/toml"
version: 2.2.5 version: 3.0.0
type: npm type: npm
summary: Better TOML parsing and stringifying all in that familiar JSON interface. summary: Better TOML parsing and stringifying all in that familiar JSON interface.
homepage: https://github.com/iarna/iarna-toml#readme homepage: https://github.com/iarna/iarna-toml#readme
+25 -13
View File
@@ -184,19 +184,31 @@ virtualenvs.path = "{cache-dir}/virtualenvs" # /Users/patrick/Library/Caches/py
); );
} }
if (process.platform === 'linux' && packageManager === 'pip') { const restoredKeys = restoreCacheSpy.mock.results.map(
expect(infoSpy).toHaveBeenCalledWith( result => result.value
`Cache restored from key: setup-python-${process.env['RUNNER_OS']}-20.04-Ubuntu-python-${pythonVersion}-${packageManager}-${fileHash}` );
);
} else if (packageManager === 'poetry') { restoredKeys.forEach(restoredKey => {
expect(infoSpy).toHaveBeenCalledWith( if (restoredKey) {
`Cache restored from key: setup-python-${process.env['RUNNER_OS']}-python-${pythonVersion}-${packageManager}-v2-${fileHash}` if (process.platform === 'linux' && packageManager === 'pip') {
); expect(infoSpy).toHaveBeenCalledWith(
} else { `Cache restored from key: setup-python-${process.env['RUNNER_OS']}-${process.arch}-20.04-Ubuntu-python-${pythonVersion}-${packageManager}-${fileHash}`
expect(infoSpy).toHaveBeenCalledWith( );
`Cache restored from key: setup-python-${process.env['RUNNER_OS']}-python-${pythonVersion}-${packageManager}-${fileHash}` } else if (packageManager === 'poetry') {
); expect(infoSpy).toHaveBeenCalledWith(
} `Cache restored from key: setup-python-${process.env['RUNNER_OS']}-${process.arch}-python-${pythonVersion}-${packageManager}-v2-${fileHash}`
);
} else {
expect(infoSpy).toHaveBeenCalledWith(
`Cache restored from key: setup-python-${process.env['RUNNER_OS']}-${process.arch}-python-${pythonVersion}-${packageManager}-${fileHash}`
);
}
} else {
expect(infoSpy).toHaveBeenCalledWith(
`${packageManager} cache is not found`
);
}
});
}, },
30000 30000
); );
+150 -351
View File
File diff suppressed because one or more lines are too long
+3 -1
View File
@@ -5,8 +5,10 @@ description = ""
authors = ["Your Name <[email protected]>"] authors = ["Your Name <[email protected]>"]
[tool.poetry.dependencies] [tool.poetry.dependencies]
python = "^3.8" python = ">=3.8,<3.13"
flake8 = "^4.0.1" flake8 = "^4.0.1"
pyinstaller = "5.13.1"
[tool.poetry.dev-dependencies] [tool.poetry.dev-dependencies]
+1 -1
View File
@@ -34,7 +34,7 @@ pillow==7.2
pygments==2.6.1 pygments==2.6.1
pyinstaller==3.6 pyinstaller==5.13.1
pyparsing==2.4.7; python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2' pyparsing==2.4.7; python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2'
+37 -1
View File
@@ -12,7 +12,9 @@ import {
getVersionInputFromFile, getVersionInputFromFile,
getVersionInputFromPlainFile, getVersionInputFromPlainFile,
getVersionInputFromTomlFile, getVersionInputFromTomlFile,
getNextPageUrl getNextPageUrl,
IS_WINDOWS,
getDownloadFileName
} from '../src/utils'; } from '../src/utils';
jest.mock('@actions/cache'); jest.mock('@actions/cache');
@@ -159,3 +161,37 @@ describe('getNextPageUrl', () => {
expect(getNextPageUrl(generateResponse(page2Links))).toBeNull(); expect(getNextPageUrl(generateResponse(page2Links))).toBeNull();
}); });
}); });
describe('getDownloadFileName', () => {
const originalEnv = process.env;
const tempDir = path.join(__dirname, 'runner', 'temp');
beforeEach(() => {
process.env = {...originalEnv};
});
afterEach(() => {
process.env = originalEnv;
});
it('should return the correct path on Windows', () => {
if (IS_WINDOWS) {
process.env['RUNNER_TEMP'] = tempDir;
const downloadUrl =
'https://github.com/actions/sometool/releases/tag/1.2.3-20200402.6/sometool-1.2.3-win32-x64.zip';
const expectedPath = path.join(
process.env.RUNNER_TEMP,
path.basename(downloadUrl)
);
expect(getDownloadFileName(downloadUrl)).toBe(expectedPath);
}
});
it('should return undefined on non-Windows', () => {
if (!IS_WINDOWS) {
const downloadUrl =
'https://github.com/actions/sometool/releases/tag/1.2.3-20200402.6/sometool-1.2.3-linux-x64.tar.gz';
expect(getDownloadFileName(downloadUrl)).toBeUndefined();
}
});
});
+100 -68
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
View File
@@ -319,6 +319,7 @@ steps:
- run: poetry install - run: poetry install
- run: poetry run pytest - run: poetry run pytest
``` ```
>**Note:** If the `setup-python` version does not match the version specified in `pyproject.toml` and the python version in `pyproject.toml` is less than the runner's python version, `poetry install` will default to using the runner's Python version.
**Using a list of file paths to cache dependencies** **Using a list of file paths to cache dependencies**
```yaml ```yaml
+3 -3
View File
@@ -6,13 +6,13 @@ We have prepared a short guide so that the process of making your contribution i
## How can I contribute... ## How can I contribute...
* [Contribute Documentation:green_book:](#contribute-documentation) * [Contribute Documentation :green_book:](#contribute-documentation)
* [Contribute Code :computer:](#contribute-code) * [Contribute Code :computer:](#contribute-code)
* [Provide Support on Issues:pencil:](#provide-support-on-issues) * [Provide Support on Issues :pencil:](#provide-support-on-issues)
* [Review Pull Requests:mag:](#review-pull-requests) * [Review Pull Requests :mag:](#review-pull-requests)
## Contribute documentation ## Contribute documentation
+4 -4
View File
@@ -16,7 +16,7 @@
"@actions/http-client": "^2.2.1", "@actions/http-client": "^2.2.1",
"@actions/io": "^1.0.2", "@actions/io": "^1.0.2",
"@actions/tool-cache": "^2.0.1", "@actions/tool-cache": "^2.0.1",
"@iarna/toml": "^2.2.5", "@iarna/toml": "^3.0.0",
"semver": "^7.6.0" "semver": "^7.6.0"
}, },
"devDependencies": { "devDependencies": {
@@ -1084,9 +1084,9 @@
"dev": true "dev": true
}, },
"node_modules/@iarna/toml": { "node_modules/@iarna/toml": {
"version": "2.2.5", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/@iarna/toml/-/toml-2.2.5.tgz", "resolved": "https://registry.npmjs.org/@iarna/toml/-/toml-3.0.0.tgz",
"integrity": "sha512-trnsAYxU3xnS1gPHPyU961coFyLkh4gAD/0zQ5mymY4yOZ+CYvsPqUbOFSw0aDM4y0tV7tiFxL/1XfXPNC6IPg==" "integrity": "sha512-td6ZUkz2oS3VeleBcN+m//Q6HlCFCPrnI0FZhrt/h4XqLEdOyYp2u21nd8MdsR+WJy5r9PTDaHTDDfhf4H4l6Q=="
}, },
"node_modules/@istanbuljs/load-nyc-config": { "node_modules/@istanbuljs/load-nyc-config": {
"version": "1.1.0", "version": "1.1.0",
+1 -1
View File
@@ -32,7 +32,7 @@
"@actions/http-client": "^2.2.1", "@actions/http-client": "^2.2.1",
"@actions/io": "^1.0.2", "@actions/io": "^1.0.2",
"@actions/tool-cache": "^2.0.1", "@actions/tool-cache": "^2.0.1",
"@iarna/toml": "^2.2.5", "@iarna/toml": "^3.0.0",
"semver": "^7.6.0" "semver": "^7.6.0"
}, },
"devDependencies": { "devDependencies": {
+4 -4
View File
@@ -67,11 +67,11 @@ class PipCache extends CacheDistributor {
if (IS_LINUX) { if (IS_LINUX) {
const osInfo = await getLinuxInfo(); const osInfo = await getLinuxInfo();
primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${osInfo.osVersion}-${osInfo.osName}-python-${this.pythonVersion}-${this.packageManager}-${hash}`; primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${process.arch}-${osInfo.osVersion}-${osInfo.osName}-python-${this.pythonVersion}-${this.packageManager}-${hash}`;
restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${osInfo.osVersion}-${osInfo.osName}-python-${this.pythonVersion}-${this.packageManager}`; restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${process.arch}-${osInfo.osVersion}-${osInfo.osName}-python-${this.pythonVersion}-${this.packageManager}`;
} else { } else {
primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}-${hash}`; primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${process.arch}-python-${this.pythonVersion}-${this.packageManager}-${hash}`;
restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}`; restoreKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${process.arch}-python-${this.pythonVersion}-${this.packageManager}`;
} }
return { return {
+1 -1
View File
@@ -32,7 +32,7 @@ class PipenvCache extends CacheDistributor {
protected async computeKeys() { protected async computeKeys() {
const hash = await glob.hashFiles(this.patterns); const hash = await glob.hashFiles(this.patterns);
const primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}-${hash}`; const primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${process.arch}-python-${this.pythonVersion}-${this.packageManager}-${hash}`;
const restoreKey = undefined; const restoreKey = undefined;
return { return {
primaryKey, primaryKey,
+1 -1
View File
@@ -47,7 +47,7 @@ class PoetryCache extends CacheDistributor {
protected async computeKeys() { protected async computeKeys() {
const hash = await glob.hashFiles(this.patterns); const hash = await glob.hashFiles(this.patterns);
// "v2" is here to invalidate old caches of this cache distributor, which were created broken: // "v2" is here to invalidate old caches of this cache distributor, which were created broken:
const primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-python-${this.pythonVersion}-${this.packageManager}-v2-${hash}`; const primaryKey = `${this.CACHE_KEY_PREFIX}-${process.env['RUNNER_OS']}-${process.arch}-python-${this.pythonVersion}-${this.packageManager}-v2-${hash}`;
const restoreKey = undefined; const restoreKey = undefined;
return { return {
primaryKey, primaryKey,
+4 -2
View File
@@ -14,7 +14,8 @@ import {
createSymlinkInFolder, createSymlinkInFolder,
isNightlyKeyword, isNightlyKeyword,
writeExactPyPyVersionFile, writeExactPyPyVersionFile,
getBinaryDirectory getBinaryDirectory,
getDownloadFileName
} from './utils'; } from './utils';
export async function installPyPy( export async function installPyPy(
@@ -69,7 +70,8 @@ export async function installPyPy(
core.info(`Downloading PyPy from "${downloadUrl}" ...`); core.info(`Downloading PyPy from "${downloadUrl}" ...`);
try { try {
const pypyPath = await tc.downloadTool(downloadUrl); const fileName = getDownloadFileName(downloadUrl);
const pypyPath = await tc.downloadTool(downloadUrl, fileName);
core.info('Extracting downloaded archive...'); core.info('Extracting downloaded archive...');
if (IS_WINDOWS) { if (IS_WINDOWS) {
+3 -2
View File
@@ -4,7 +4,7 @@ import * as tc from '@actions/tool-cache';
import * as exec from '@actions/exec'; import * as exec from '@actions/exec';
import * as httpm from '@actions/http-client'; import * as httpm from '@actions/http-client';
import {ExecOptions} from '@actions/exec/lib/interfaces'; import {ExecOptions} from '@actions/exec/lib/interfaces';
import {IS_WINDOWS, IS_LINUX} from './utils'; import {IS_WINDOWS, IS_LINUX, getDownloadFileName} from './utils';
const TOKEN = core.getInput('token'); const TOKEN = core.getInput('token');
const AUTH = !TOKEN ? undefined : `token ${TOKEN}`; const AUTH = !TOKEN ? undefined : `token ${TOKEN}`;
@@ -98,7 +98,8 @@ export async function installCpythonFromRelease(release: tc.IToolRelease) {
core.info(`Download from "${downloadUrl}"`); core.info(`Download from "${downloadUrl}"`);
let pythonPath = ''; let pythonPath = '';
try { try {
pythonPath = await tc.downloadTool(downloadUrl, undefined, AUTH); const fileName = getDownloadFileName(downloadUrl);
pythonPath = await tc.downloadTool(downloadUrl, fileName, AUTH);
core.info('Extract downloaded archive'); core.info('Extract downloaded archive');
let pythonExtractedFolder; let pythonExtractedFolder;
if (IS_WINDOWS) { if (IS_WINDOWS) {
+14
View File
@@ -310,3 +310,17 @@ export function getNextPageUrl<T>(response: ifm.TypedResponse<T>) {
} }
return null; return null;
} }
/**
* Add temporary fix for Windows
* On Windows, it is necessary to retain the .zip extension for proper extraction.
* because the tc.extractZip() failure due to tc.downloadTool() not adding .zip extension.
* Related issue: https://github.com/actions/toolkit/issues/1179
* Related issue: https://github.com/actions/setup-python/issues/819
*/
export function getDownloadFileName(downloadUrl: string): string | undefined {
const tempDir = process.env.RUNNER_TEMP || '.';
return IS_WINDOWS
? path.join(tempDir, path.basename(downloadUrl))
: undefined;
}