mirror of
https://github.com/actions/setup-python.git
synced 2025-04-17 00:29:14 +08:00
Compare commits
5 commits
1a5a07de97
...
ce6477abf0
Author | SHA1 | Date | |
---|---|---|---|
|
ce6477abf0 | ||
|
19e4675e06 | ||
|
6fd11e170a | ||
|
9c4618d9a3 | ||
|
fc9bcb4a04 |
3
.github/workflows/test-graalpy.yml
vendored
3
.github/workflows/test-graalpy.yml
vendored
|
@ -23,6 +23,7 @@ jobs:
|
||||||
- 'graalpy-22.3'
|
- 'graalpy-22.3'
|
||||||
- 'graalpy-23.0'
|
- 'graalpy-23.0'
|
||||||
- 'graalpy-23.1'
|
- 'graalpy-23.1'
|
||||||
|
- 'graalpy-24.0'
|
||||||
- 'graalpy-24.1'
|
- 'graalpy-24.1'
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
@ -90,7 +91,7 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, macos-latest, macos-13]
|
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Setup GraalPy and check latest
|
- name: Setup GraalPy and check latest
|
||||||
|
|
33
.github/workflows/test-python.yml
vendored
33
.github/workflows/test-python.yml
vendored
|
@ -245,6 +245,39 @@ jobs:
|
||||||
- name: Run simple code
|
- name: Run simple code
|
||||||
run: python -c 'import math; print(math.factorial(5))'
|
run: python -c 'import math; print(math.factorial(5))'
|
||||||
|
|
||||||
|
setup-versions-from-tool-versions-file:
|
||||||
|
name: Setup ${{ matrix.python }} ${{ matrix.os }} .tool-versions file
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os:
|
||||||
|
[
|
||||||
|
macos-latest,
|
||||||
|
windows-latest,
|
||||||
|
ubuntu-20.04,
|
||||||
|
ubuntu-22.04,
|
||||||
|
macos-13,
|
||||||
|
ubuntu-latest
|
||||||
|
]
|
||||||
|
python: [3.13.0, 3.14-dev, pypy3.11-7.3.18, graalpy-24.1.2]
|
||||||
|
exclude:
|
||||||
|
- os: windows-latest
|
||||||
|
python: graalpy-24.1.2
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: build-tool-versions-file ${{ matrix.python }}
|
||||||
|
run: |
|
||||||
|
echo "python ${{ matrix.python }}" > .tool-versions
|
||||||
|
|
||||||
|
- name: setup-python using .tool-versions ${{ matrix.python }}
|
||||||
|
id: setup-python-tool-versions
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
python-version-file: .tool-versions
|
||||||
|
|
||||||
setup-pre-release-version-from-manifest:
|
setup-pre-release-version-from-manifest:
|
||||||
name: Setup 3.14.0-alpha.1 ${{ matrix.os }}
|
name: Setup 3.14.0-alpha.1 ${{ matrix.os }}
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
---
|
---
|
||||||
name: "@actions/glob"
|
name: "@actions/glob"
|
||||||
version: 0.4.0
|
version: 0.5.0
|
||||||
type: npm
|
type: npm
|
||||||
summary: Actions glob lib
|
summary: Actions glob lib
|
||||||
homepage: https://github.com/actions/toolkit/tree/main/packages/glob
|
homepage: https://github.com/actions/toolkit/tree/main/packages/glob
|
File diff suppressed because it is too large
Load diff
|
@ -10,7 +10,7 @@ import * as path from 'path';
|
||||||
import * as semver from 'semver';
|
import * as semver from 'semver';
|
||||||
|
|
||||||
import * as finder from '../src/find-graalpy';
|
import * as finder from '../src/find-graalpy';
|
||||||
import {IGraalPyManifestRelease, IS_WINDOWS} from '../src/utils';
|
import {IGraalPyManifestRelease} from '../src/utils';
|
||||||
|
|
||||||
import manifestData from './data/graalpy.json';
|
import manifestData from './data/graalpy.json';
|
||||||
|
|
||||||
|
@ -19,9 +19,6 @@ const architecture = 'x64';
|
||||||
const toolDir = path.join(__dirname, 'runner', 'tools');
|
const toolDir = path.join(__dirname, 'runner', 'tools');
|
||||||
const tempDir = path.join(__dirname, 'runner', 'temp');
|
const tempDir = path.join(__dirname, 'runner', 'temp');
|
||||||
|
|
||||||
/* GraalPy doesn't have a windows release yet */
|
|
||||||
const describeSkipOnWindows = IS_WINDOWS ? describe.skip : describe;
|
|
||||||
|
|
||||||
describe('parseGraalPyVersion', () => {
|
describe('parseGraalPyVersion', () => {
|
||||||
it.each([
|
it.each([
|
||||||
['graalpy-23', '23'],
|
['graalpy-23', '23'],
|
||||||
|
@ -108,7 +105,7 @@ describe('findGraalPyToolCache', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describeSkipOnWindows('findGraalPyVersion', () => {
|
describe('findGraalPyVersion', () => {
|
||||||
let getBooleanInputSpy: jest.SpyInstance;
|
let getBooleanInputSpy: jest.SpyInstance;
|
||||||
let warningSpy: jest.SpyInstance;
|
let warningSpy: jest.SpyInstance;
|
||||||
let debugSpy: jest.SpyInstance;
|
let debugSpy: jest.SpyInstance;
|
||||||
|
@ -358,13 +355,13 @@ describeSkipOnWindows('findGraalPyVersion', () => {
|
||||||
it('found and install successfully, pre-release fallback', async () => {
|
it('found and install successfully, pre-release fallback', async () => {
|
||||||
spyCacheDir = jest.spyOn(tc, 'cacheDir');
|
spyCacheDir = jest.spyOn(tc, 'cacheDir');
|
||||||
spyCacheDir.mockImplementation(() =>
|
spyCacheDir.mockImplementation(() =>
|
||||||
path.join(toolDir, 'GraalPy', '23.1', architecture)
|
path.join(toolDir, 'GraalPy', '24.1', architecture)
|
||||||
);
|
);
|
||||||
spyChmodSync = jest.spyOn(fs, 'chmodSync');
|
spyChmodSync = jest.spyOn(fs, 'chmodSync');
|
||||||
spyChmodSync.mockImplementation(() => undefined);
|
spyChmodSync.mockImplementation(() => undefined);
|
||||||
await expect(
|
await expect(
|
||||||
finder.findGraalPyVersion(
|
finder.findGraalPyVersion(
|
||||||
'graalpy23.1',
|
'graalpy24.1',
|
||||||
architecture,
|
architecture,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
|
@ -372,7 +369,7 @@ describeSkipOnWindows('findGraalPyVersion', () => {
|
||||||
)
|
)
|
||||||
).rejects.toThrow();
|
).rejects.toThrow();
|
||||||
await expect(
|
await expect(
|
||||||
finder.findGraalPyVersion('graalpy23.1', architecture, false, false, true)
|
finder.findGraalPyVersion('graalpy24.1', architecture, false, false, true)
|
||||||
).resolves.toEqual('23.1.0-a.1');
|
).resolves.toEqual('24.1.0-ea.9');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -21,24 +21,21 @@ const architecture = 'x64';
|
||||||
const toolDir = path.join(__dirname, 'runner', 'tools');
|
const toolDir = path.join(__dirname, 'runner', 'tools');
|
||||||
const tempDir = path.join(__dirname, 'runner', 'temp');
|
const tempDir = path.join(__dirname, 'runner', 'temp');
|
||||||
|
|
||||||
/* GraalPy doesn't have a windows release yet */
|
|
||||||
const describeSkipOnWindows = IS_WINDOWS ? describe.skip : describe;
|
|
||||||
|
|
||||||
describe('graalpyVersionToSemantic', () => {
|
describe('graalpyVersionToSemantic', () => {
|
||||||
it.each([
|
it.each([
|
||||||
['23.0.0a1', '23.0.0a1'],
|
['graalpy-24.1.0-ea.09', '24.1.0-ea.9'],
|
||||||
['23.0.0', '23.0.0'],
|
['graal-23.0.0', '23.0.0'],
|
||||||
['23.0.x', '23.0.x'],
|
['vm-23.0.x', '23.0.x'],
|
||||||
['23.x', '23.x']
|
['graal-23.x', '23.x']
|
||||||
])('%s -> %s', (input, expected) => {
|
])('%s -> %s', (input, expected) => {
|
||||||
expect(installer.graalPyTagToVersion(input)).toEqual(expected);
|
expect(installer.graalPyTagToVersion(input)).toEqual(expected);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describeSkipOnWindows('findRelease', () => {
|
describe('findRelease', () => {
|
||||||
const result = JSON.stringify(manifestData);
|
const result = JSON.stringify(manifestData);
|
||||||
const releases = JSON.parse(result) as IGraalPyManifestRelease[];
|
const releases = JSON.parse(result) as IGraalPyManifestRelease[];
|
||||||
const extension = 'tar.gz';
|
const extension = IS_WINDOWS ? 'zip' : 'tar.gz';
|
||||||
const arch = installer.toGraalPyArchitecture(architecture);
|
const arch = installer.toGraalPyArchitecture(architecture);
|
||||||
const platform = installer.toGraalPyPlatform(process.platform);
|
const platform = installer.toGraalPyPlatform(process.platform);
|
||||||
const extensionName = `${platform}-${arch}.${extension}`;
|
const extensionName = `${platform}-${arch}.${extension}`;
|
||||||
|
@ -47,8 +44,8 @@ describeSkipOnWindows('findRelease', () => {
|
||||||
browser_download_url: `https://github.com/oracle/graalpython/releases/download/graal-23.0.0/graalpython-23.0.0-${extensionName}`
|
browser_download_url: `https://github.com/oracle/graalpython/releases/download/graal-23.0.0/graalpython-23.0.0-${extensionName}`
|
||||||
};
|
};
|
||||||
const filesRC1: IGraalPyManifestAsset = {
|
const filesRC1: IGraalPyManifestAsset = {
|
||||||
name: `graalpython-23.1.0a1-${extensionName}`,
|
name: `graalpy-24.1.0-ea.09-${extensionName}`,
|
||||||
browser_download_url: `https://github.com/oracle/graalpython/releases/download/graal-23.1.0a1/graalpython-23.1.0a1-${extensionName}`
|
browser_download_url: `https://github.com/graalvm/graal-languages-ea-builds/releases/download/graalpy-24.1.0-ea.09/graalpy-24.1.0-ea.09-${extensionName}`
|
||||||
};
|
};
|
||||||
|
|
||||||
let warningSpy: jest.SpyInstance;
|
let warningSpy: jest.SpyInstance;
|
||||||
|
@ -84,15 +81,15 @@ describeSkipOnWindows('findRelease', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Preview version of GraalPy is found', () => {
|
it('Preview version of GraalPy is found', () => {
|
||||||
const graalpyVersion = installer.graalPyTagToVersion('vm-23.1.0a1');
|
const graalpyVersion = installer.graalPyTagToVersion('vm-24.1.0-ea.09');
|
||||||
expect(
|
expect(
|
||||||
installer.findRelease(releases, graalpyVersion, architecture, false)
|
installer.findRelease(releases, graalpyVersion, architecture, false)
|
||||||
).toMatchObject({
|
).toMatchObject({
|
||||||
foundAsset: {
|
foundAsset: {
|
||||||
name: `graalpython-23.1.0a1-${extensionName}`,
|
name: `graalpy-24.1.0-ea.09-${extensionName}`,
|
||||||
browser_download_url: `https://github.com/oracle/graalpython/releases/download/graal-23.1.0a1/graalpython-23.1.0a1-${extensionName}`
|
browser_download_url: `https://github.com/graalvm/graal-languages-ea-builds/releases/download/graalpy-24.1.0-ea.09/graalpy-24.1.0-ea.09-${extensionName}`
|
||||||
},
|
},
|
||||||
resolvedGraalPyVersion: '23.1.0-a.1'
|
resolvedGraalPyVersion: '24.1.0-ea.9'
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -107,7 +104,7 @@ describeSkipOnWindows('findRelease', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('GraalPy version matches semver (pre-release)', () => {
|
it('GraalPy version matches semver (pre-release)', () => {
|
||||||
const graalpyVersion = '23.1.x';
|
const graalpyVersion = '24.1.x';
|
||||||
expect(
|
expect(
|
||||||
installer.findRelease(releases, graalpyVersion, architecture, false)
|
installer.findRelease(releases, graalpyVersion, architecture, false)
|
||||||
).toBeNull();
|
).toBeNull();
|
||||||
|
@ -115,12 +112,12 @@ describeSkipOnWindows('findRelease', () => {
|
||||||
installer.findRelease(releases, graalpyVersion, architecture, true)
|
installer.findRelease(releases, graalpyVersion, architecture, true)
|
||||||
).toMatchObject({
|
).toMatchObject({
|
||||||
foundAsset: filesRC1,
|
foundAsset: filesRC1,
|
||||||
resolvedGraalPyVersion: '23.1.0-a.1'
|
resolvedGraalPyVersion: '24.1.0-ea.9'
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describeSkipOnWindows('installGraalPy', () => {
|
describe('installGraalPy', () => {
|
||||||
let tcFind: jest.SpyInstance;
|
let tcFind: jest.SpyInstance;
|
||||||
let warningSpy: jest.SpyInstance;
|
let warningSpy: jest.SpyInstance;
|
||||||
let debugSpy: jest.SpyInstance;
|
let debugSpy: jest.SpyInstance;
|
||||||
|
@ -232,20 +229,20 @@ describeSkipOnWindows('installGraalPy', () => {
|
||||||
it('found and install GraalPy, pre-release fallback', async () => {
|
it('found and install GraalPy, pre-release fallback', async () => {
|
||||||
spyCacheDir = jest.spyOn(tc, 'cacheDir');
|
spyCacheDir = jest.spyOn(tc, 'cacheDir');
|
||||||
spyCacheDir.mockImplementation(() =>
|
spyCacheDir.mockImplementation(() =>
|
||||||
path.join(toolDir, 'GraalPy', '23.1.0', architecture)
|
path.join(toolDir, 'GraalPy', '24.1.0', architecture)
|
||||||
);
|
);
|
||||||
|
|
||||||
spyChmodSync = jest.spyOn(fs, 'chmodSync');
|
spyChmodSync = jest.spyOn(fs, 'chmodSync');
|
||||||
spyChmodSync.mockImplementation(() => undefined);
|
spyChmodSync.mockImplementation(() => undefined);
|
||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
installer.installGraalPy('23.1.x', architecture, false, undefined)
|
installer.installGraalPy('24.1.x', architecture, false, undefined)
|
||||||
).rejects.toThrow();
|
).rejects.toThrow();
|
||||||
await expect(
|
await expect(
|
||||||
installer.installGraalPy('23.1.x', architecture, true, undefined)
|
installer.installGraalPy('24.1.x', architecture, true, undefined)
|
||||||
).resolves.toEqual({
|
).resolves.toEqual({
|
||||||
installDir: path.join(toolDir, 'GraalPy', '23.1.0', architecture),
|
installDir: path.join(toolDir, 'GraalPy', '24.1.0', architecture),
|
||||||
resolvedGraalPyVersion: '23.1.0-a.1'
|
resolvedGraalPyVersion: '24.1.0-ea.9'
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(spyHttpClient).toHaveBeenCalled();
|
expect(spyHttpClient).toHaveBeenCalled();
|
||||||
|
|
|
@ -15,7 +15,8 @@ import {
|
||||||
getNextPageUrl,
|
getNextPageUrl,
|
||||||
isGhes,
|
isGhes,
|
||||||
IS_WINDOWS,
|
IS_WINDOWS,
|
||||||
getDownloadFileName
|
getDownloadFileName,
|
||||||
|
getVersionInputFromToolVersions
|
||||||
} from '../src/utils';
|
} from '../src/utils';
|
||||||
|
|
||||||
jest.mock('@actions/cache');
|
jest.mock('@actions/cache');
|
||||||
|
@ -139,6 +140,82 @@ describe('Version from file test', () => {
|
||||||
expect(_fn(pythonVersionFilePath)).toEqual([]);
|
expect(_fn(pythonVersionFilePath)).toEqual([]);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
it.each([getVersionInputFromToolVersions])(
|
||||||
|
'Version from .tool-versions',
|
||||||
|
async _fn => {
|
||||||
|
const toolVersionFileName = '.tool-versions';
|
||||||
|
const toolVersionFilePath = path.join(tempDir, toolVersionFileName);
|
||||||
|
const toolVersionContent = 'python 3.9.10\nnodejs 16';
|
||||||
|
fs.writeFileSync(toolVersionFilePath, toolVersionContent);
|
||||||
|
expect(_fn(toolVersionFilePath)).toEqual(['3.9.10']);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
it.each([getVersionInputFromToolVersions])(
|
||||||
|
'Version from .tool-versions with comment',
|
||||||
|
async _fn => {
|
||||||
|
const toolVersionFileName = '.tool-versions';
|
||||||
|
const toolVersionFilePath = path.join(tempDir, toolVersionFileName);
|
||||||
|
const toolVersionContent = '# python 3.8\npython 3.9';
|
||||||
|
fs.writeFileSync(toolVersionFilePath, toolVersionContent);
|
||||||
|
expect(_fn(toolVersionFilePath)).toEqual(['3.9']);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
it.each([getVersionInputFromToolVersions])(
|
||||||
|
'Version from .tool-versions with whitespace',
|
||||||
|
async _fn => {
|
||||||
|
const toolVersionFileName = '.tool-versions';
|
||||||
|
const toolVersionFilePath = path.join(tempDir, toolVersionFileName);
|
||||||
|
const toolVersionContent = ' python 3.10 ';
|
||||||
|
fs.writeFileSync(toolVersionFilePath, toolVersionContent);
|
||||||
|
expect(_fn(toolVersionFilePath)).toEqual(['3.10']);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
it.each([getVersionInputFromToolVersions])(
|
||||||
|
'Version from .tool-versions with v prefix',
|
||||||
|
async _fn => {
|
||||||
|
const toolVersionFileName = '.tool-versions';
|
||||||
|
const toolVersionFilePath = path.join(tempDir, toolVersionFileName);
|
||||||
|
const toolVersionContent = 'python v3.9.10';
|
||||||
|
fs.writeFileSync(toolVersionFilePath, toolVersionContent);
|
||||||
|
expect(_fn(toolVersionFilePath)).toEqual(['3.9.10']);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
it.each([getVersionInputFromToolVersions])(
|
||||||
|
'Version from .tool-versions with pypy version',
|
||||||
|
async _fn => {
|
||||||
|
const toolVersionFileName = '.tool-versions';
|
||||||
|
const toolVersionFilePath = path.join(tempDir, toolVersionFileName);
|
||||||
|
const toolVersionContent = 'python pypy3.10-7.3.14';
|
||||||
|
fs.writeFileSync(toolVersionFilePath, toolVersionContent);
|
||||||
|
expect(_fn(toolVersionFilePath)).toEqual(['pypy3.10-7.3.14']);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
it.each([getVersionInputFromToolVersions])(
|
||||||
|
'Version from .tool-versions with alpha Releases',
|
||||||
|
async _fn => {
|
||||||
|
const toolVersionFileName = '.tool-versions';
|
||||||
|
const toolVersionFilePath = path.join(tempDir, toolVersionFileName);
|
||||||
|
const toolVersionContent = 'python 3.14.0a5t';
|
||||||
|
fs.writeFileSync(toolVersionFilePath, toolVersionContent);
|
||||||
|
expect(_fn(toolVersionFilePath)).toEqual(['3.14.0a5t']);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
it.each([getVersionInputFromToolVersions])(
|
||||||
|
'Version from .tool-versions with dev suffix',
|
||||||
|
async _fn => {
|
||||||
|
const toolVersionFileName = '.tool-versions';
|
||||||
|
const toolVersionFilePath = path.join(tempDir, toolVersionFileName);
|
||||||
|
const toolVersionContent = 'python 3.14t-dev';
|
||||||
|
fs.writeFileSync(toolVersionFilePath, toolVersionContent);
|
||||||
|
expect(_fn(toolVersionFilePath)).toEqual(['3.14t-dev']);
|
||||||
|
}
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('getNextPageUrl', () => {
|
describe('getNextPageUrl', () => {
|
||||||
|
|
207
dist/setup/index.js
vendored
207
dist/setup/index.js
vendored
|
@ -8752,7 +8752,7 @@ function hashFiles(patterns, currentWorkspace = '', options, verbose = false) {
|
||||||
followSymbolicLinks = options.followSymbolicLinks;
|
followSymbolicLinks = options.followSymbolicLinks;
|
||||||
}
|
}
|
||||||
const globber = yield create(patterns, { followSymbolicLinks });
|
const globber = yield create(patterns, { followSymbolicLinks });
|
||||||
return internal_hash_files_1.hashFiles(globber, currentWorkspace, verbose);
|
return (0, internal_hash_files_1.hashFiles)(globber, currentWorkspace, verbose);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.hashFiles = hashFiles;
|
exports.hashFiles = hashFiles;
|
||||||
|
@ -8767,7 +8767,11 @@ exports.hashFiles = hashFiles;
|
||||||
|
|
||||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||||
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||||
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||||
|
}
|
||||||
|
Object.defineProperty(o, k2, desc);
|
||||||
}) : (function(o, m, k, k2) {
|
}) : (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
o[k2] = m[k];
|
o[k2] = m[k];
|
||||||
|
@ -8780,7 +8784,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
var result = {};
|
||||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
__setModuleDefault(result, mod);
|
__setModuleDefault(result, mod);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
@ -8795,7 +8799,8 @@ function getOptions(copy) {
|
||||||
followSymbolicLinks: true,
|
followSymbolicLinks: true,
|
||||||
implicitDescendants: true,
|
implicitDescendants: true,
|
||||||
matchDirectories: true,
|
matchDirectories: true,
|
||||||
omitBrokenSymbolicLinks: true
|
omitBrokenSymbolicLinks: true,
|
||||||
|
excludeHiddenFiles: false
|
||||||
};
|
};
|
||||||
if (copy) {
|
if (copy) {
|
||||||
if (typeof copy.followSymbolicLinks === 'boolean') {
|
if (typeof copy.followSymbolicLinks === 'boolean') {
|
||||||
|
@ -8814,6 +8819,10 @@ function getOptions(copy) {
|
||||||
result.omitBrokenSymbolicLinks = copy.omitBrokenSymbolicLinks;
|
result.omitBrokenSymbolicLinks = copy.omitBrokenSymbolicLinks;
|
||||||
core.debug(`omitBrokenSymbolicLinks '${result.omitBrokenSymbolicLinks}'`);
|
core.debug(`omitBrokenSymbolicLinks '${result.omitBrokenSymbolicLinks}'`);
|
||||||
}
|
}
|
||||||
|
if (typeof copy.excludeHiddenFiles === 'boolean') {
|
||||||
|
result.excludeHiddenFiles = copy.excludeHiddenFiles;
|
||||||
|
core.debug(`excludeHiddenFiles '${result.excludeHiddenFiles}'`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -8829,7 +8838,11 @@ exports.getOptions = getOptions;
|
||||||
|
|
||||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||||
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||||
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||||
|
}
|
||||||
|
Object.defineProperty(o, k2, desc);
|
||||||
}) : (function(o, m, k, k2) {
|
}) : (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
o[k2] = m[k];
|
o[k2] = m[k];
|
||||||
|
@ -8842,7 +8855,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
var result = {};
|
||||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
__setModuleDefault(result, mod);
|
__setModuleDefault(result, mod);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
@ -8896,19 +8909,21 @@ class DefaultGlobber {
|
||||||
return this.searchPaths.slice();
|
return this.searchPaths.slice();
|
||||||
}
|
}
|
||||||
glob() {
|
glob() {
|
||||||
var e_1, _a;
|
var _a, e_1, _b, _c;
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const result = [];
|
const result = [];
|
||||||
try {
|
try {
|
||||||
for (var _b = __asyncValues(this.globGenerator()), _c; _c = yield _b.next(), !_c.done;) {
|
for (var _d = true, _e = __asyncValues(this.globGenerator()), _f; _f = yield _e.next(), _a = _f.done, !_a; _d = true) {
|
||||||
const itemPath = _c.value;
|
_c = _f.value;
|
||||||
|
_d = false;
|
||||||
|
const itemPath = _c;
|
||||||
result.push(itemPath);
|
result.push(itemPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
||||||
finally {
|
finally {
|
||||||
try {
|
try {
|
||||||
if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b);
|
if (!_d && !_a && (_b = _e.return)) yield _b.call(_e);
|
||||||
}
|
}
|
||||||
finally { if (e_1) throw e_1.error; }
|
finally { if (e_1) throw e_1.error; }
|
||||||
}
|
}
|
||||||
|
@ -8966,6 +8981,10 @@ class DefaultGlobber {
|
||||||
if (!stats) {
|
if (!stats) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
// Hidden file or directory?
|
||||||
|
if (options.excludeHiddenFiles && path.basename(item.path).match(/^\./)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
// Directory
|
// Directory
|
||||||
if (stats.isDirectory()) {
|
if (stats.isDirectory()) {
|
||||||
// Matched
|
// Matched
|
||||||
|
@ -9071,7 +9090,11 @@ exports.DefaultGlobber = DefaultGlobber;
|
||||||
|
|
||||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||||
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||||
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||||
|
}
|
||||||
|
Object.defineProperty(o, k2, desc);
|
||||||
}) : (function(o, m, k, k2) {
|
}) : (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
o[k2] = m[k];
|
o[k2] = m[k];
|
||||||
|
@ -9084,7 +9107,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
var result = {};
|
||||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
__setModuleDefault(result, mod);
|
__setModuleDefault(result, mod);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
@ -9113,19 +9136,21 @@ const stream = __importStar(__nccwpck_require__(2203));
|
||||||
const util = __importStar(__nccwpck_require__(9023));
|
const util = __importStar(__nccwpck_require__(9023));
|
||||||
const path = __importStar(__nccwpck_require__(6928));
|
const path = __importStar(__nccwpck_require__(6928));
|
||||||
function hashFiles(globber, currentWorkspace, verbose = false) {
|
function hashFiles(globber, currentWorkspace, verbose = false) {
|
||||||
var e_1, _a;
|
var _a, e_1, _b, _c;
|
||||||
var _b;
|
var _d;
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const writeDelegate = verbose ? core.info : core.debug;
|
const writeDelegate = verbose ? core.info : core.debug;
|
||||||
let hasMatch = false;
|
let hasMatch = false;
|
||||||
const githubWorkspace = currentWorkspace
|
const githubWorkspace = currentWorkspace
|
||||||
? currentWorkspace
|
? currentWorkspace
|
||||||
: (_b = process.env['GITHUB_WORKSPACE']) !== null && _b !== void 0 ? _b : process.cwd();
|
: (_d = process.env['GITHUB_WORKSPACE']) !== null && _d !== void 0 ? _d : process.cwd();
|
||||||
const result = crypto.createHash('sha256');
|
const result = crypto.createHash('sha256');
|
||||||
let count = 0;
|
let count = 0;
|
||||||
try {
|
try {
|
||||||
for (var _c = __asyncValues(globber.globGenerator()), _d; _d = yield _c.next(), !_d.done;) {
|
for (var _e = true, _f = __asyncValues(globber.globGenerator()), _g; _g = yield _f.next(), _a = _g.done, !_a; _e = true) {
|
||||||
const file = _d.value;
|
_c = _g.value;
|
||||||
|
_e = false;
|
||||||
|
const file = _c;
|
||||||
writeDelegate(file);
|
writeDelegate(file);
|
||||||
if (!file.startsWith(`${githubWorkspace}${path.sep}`)) {
|
if (!file.startsWith(`${githubWorkspace}${path.sep}`)) {
|
||||||
writeDelegate(`Ignore '${file}' since it is not under GITHUB_WORKSPACE.`);
|
writeDelegate(`Ignore '${file}' since it is not under GITHUB_WORKSPACE.`);
|
||||||
|
@ -9148,7 +9173,7 @@ function hashFiles(globber, currentWorkspace, verbose = false) {
|
||||||
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
||||||
finally {
|
finally {
|
||||||
try {
|
try {
|
||||||
if (_d && !_d.done && (_a = _c.return)) yield _a.call(_c);
|
if (!_e && !_a && (_b = _f.return)) yield _b.call(_f);
|
||||||
}
|
}
|
||||||
finally { if (e_1) throw e_1.error; }
|
finally { if (e_1) throw e_1.error; }
|
||||||
}
|
}
|
||||||
|
@ -9188,7 +9213,7 @@ var MatchKind;
|
||||||
MatchKind[MatchKind["File"] = 2] = "File";
|
MatchKind[MatchKind["File"] = 2] = "File";
|
||||||
/** Matched */
|
/** Matched */
|
||||||
MatchKind[MatchKind["All"] = 3] = "All";
|
MatchKind[MatchKind["All"] = 3] = "All";
|
||||||
})(MatchKind = exports.MatchKind || (exports.MatchKind = {}));
|
})(MatchKind || (exports.MatchKind = MatchKind = {}));
|
||||||
//# sourceMappingURL=internal-match-kind.js.map
|
//# sourceMappingURL=internal-match-kind.js.map
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
@ -9200,7 +9225,11 @@ var MatchKind;
|
||||||
|
|
||||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||||
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||||
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||||
|
}
|
||||||
|
Object.defineProperty(o, k2, desc);
|
||||||
}) : (function(o, m, k, k2) {
|
}) : (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
o[k2] = m[k];
|
o[k2] = m[k];
|
||||||
|
@ -9213,7 +9242,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
var result = {};
|
||||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
__setModuleDefault(result, mod);
|
__setModuleDefault(result, mod);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
@ -9263,8 +9292,8 @@ exports.dirname = dirname;
|
||||||
* or `C:` are expanded based on the current working directory.
|
* or `C:` are expanded based on the current working directory.
|
||||||
*/
|
*/
|
||||||
function ensureAbsoluteRoot(root, itemPath) {
|
function ensureAbsoluteRoot(root, itemPath) {
|
||||||
assert_1.default(root, `ensureAbsoluteRoot parameter 'root' must not be empty`);
|
(0, assert_1.default)(root, `ensureAbsoluteRoot parameter 'root' must not be empty`);
|
||||||
assert_1.default(itemPath, `ensureAbsoluteRoot parameter 'itemPath' must not be empty`);
|
(0, assert_1.default)(itemPath, `ensureAbsoluteRoot parameter 'itemPath' must not be empty`);
|
||||||
// Already rooted
|
// Already rooted
|
||||||
if (hasAbsoluteRoot(itemPath)) {
|
if (hasAbsoluteRoot(itemPath)) {
|
||||||
return itemPath;
|
return itemPath;
|
||||||
|
@ -9274,7 +9303,7 @@ function ensureAbsoluteRoot(root, itemPath) {
|
||||||
// Check for itemPath like C: or C:foo
|
// Check for itemPath like C: or C:foo
|
||||||
if (itemPath.match(/^[A-Z]:[^\\/]|^[A-Z]:$/i)) {
|
if (itemPath.match(/^[A-Z]:[^\\/]|^[A-Z]:$/i)) {
|
||||||
let cwd = process.cwd();
|
let cwd = process.cwd();
|
||||||
assert_1.default(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`);
|
(0, assert_1.default)(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`);
|
||||||
// Drive letter matches cwd? Expand to cwd
|
// Drive letter matches cwd? Expand to cwd
|
||||||
if (itemPath[0].toUpperCase() === cwd[0].toUpperCase()) {
|
if (itemPath[0].toUpperCase() === cwd[0].toUpperCase()) {
|
||||||
// Drive only, e.g. C:
|
// Drive only, e.g. C:
|
||||||
|
@ -9299,11 +9328,11 @@ function ensureAbsoluteRoot(root, itemPath) {
|
||||||
// Check for itemPath like \ or \foo
|
// Check for itemPath like \ or \foo
|
||||||
else if (normalizeSeparators(itemPath).match(/^\\$|^\\[^\\]/)) {
|
else if (normalizeSeparators(itemPath).match(/^\\$|^\\[^\\]/)) {
|
||||||
const cwd = process.cwd();
|
const cwd = process.cwd();
|
||||||
assert_1.default(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`);
|
(0, assert_1.default)(cwd.match(/^[A-Z]:\\/i), `Expected current directory to start with an absolute drive root. Actual '${cwd}'`);
|
||||||
return `${cwd[0]}:\\${itemPath.substr(1)}`;
|
return `${cwd[0]}:\\${itemPath.substr(1)}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert_1.default(hasAbsoluteRoot(root), `ensureAbsoluteRoot parameter 'root' must have an absolute root`);
|
(0, assert_1.default)(hasAbsoluteRoot(root), `ensureAbsoluteRoot parameter 'root' must have an absolute root`);
|
||||||
// Otherwise ensure root ends with a separator
|
// Otherwise ensure root ends with a separator
|
||||||
if (root.endsWith('/') || (IS_WINDOWS && root.endsWith('\\'))) {
|
if (root.endsWith('/') || (IS_WINDOWS && root.endsWith('\\'))) {
|
||||||
// Intentionally empty
|
// Intentionally empty
|
||||||
|
@ -9320,7 +9349,7 @@ exports.ensureAbsoluteRoot = ensureAbsoluteRoot;
|
||||||
* `\\hello\share` and `C:\hello` (and using alternate separator).
|
* `\\hello\share` and `C:\hello` (and using alternate separator).
|
||||||
*/
|
*/
|
||||||
function hasAbsoluteRoot(itemPath) {
|
function hasAbsoluteRoot(itemPath) {
|
||||||
assert_1.default(itemPath, `hasAbsoluteRoot parameter 'itemPath' must not be empty`);
|
(0, assert_1.default)(itemPath, `hasAbsoluteRoot parameter 'itemPath' must not be empty`);
|
||||||
// Normalize separators
|
// Normalize separators
|
||||||
itemPath = normalizeSeparators(itemPath);
|
itemPath = normalizeSeparators(itemPath);
|
||||||
// Windows
|
// Windows
|
||||||
|
@ -9337,7 +9366,7 @@ exports.hasAbsoluteRoot = hasAbsoluteRoot;
|
||||||
* `\`, `\hello`, `\\hello\share`, `C:`, and `C:\hello` (and using alternate separator).
|
* `\`, `\hello`, `\\hello\share`, `C:`, and `C:\hello` (and using alternate separator).
|
||||||
*/
|
*/
|
||||||
function hasRoot(itemPath) {
|
function hasRoot(itemPath) {
|
||||||
assert_1.default(itemPath, `isRooted parameter 'itemPath' must not be empty`);
|
(0, assert_1.default)(itemPath, `isRooted parameter 'itemPath' must not be empty`);
|
||||||
// Normalize separators
|
// Normalize separators
|
||||||
itemPath = normalizeSeparators(itemPath);
|
itemPath = normalizeSeparators(itemPath);
|
||||||
// Windows
|
// Windows
|
||||||
|
@ -9405,7 +9434,11 @@ exports.safeTrimTrailingSeparator = safeTrimTrailingSeparator;
|
||||||
|
|
||||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||||
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||||
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||||
|
}
|
||||||
|
Object.defineProperty(o, k2, desc);
|
||||||
}) : (function(o, m, k, k2) {
|
}) : (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
o[k2] = m[k];
|
o[k2] = m[k];
|
||||||
|
@ -9418,7 +9451,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
var result = {};
|
||||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
__setModuleDefault(result, mod);
|
__setModuleDefault(result, mod);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
@ -9443,7 +9476,7 @@ class Path {
|
||||||
this.segments = [];
|
this.segments = [];
|
||||||
// String
|
// String
|
||||||
if (typeof itemPath === 'string') {
|
if (typeof itemPath === 'string') {
|
||||||
assert_1.default(itemPath, `Parameter 'itemPath' must not be empty`);
|
(0, assert_1.default)(itemPath, `Parameter 'itemPath' must not be empty`);
|
||||||
// Normalize slashes and trim unnecessary trailing slash
|
// Normalize slashes and trim unnecessary trailing slash
|
||||||
itemPath = pathHelper.safeTrimTrailingSeparator(itemPath);
|
itemPath = pathHelper.safeTrimTrailingSeparator(itemPath);
|
||||||
// Not rooted
|
// Not rooted
|
||||||
|
@ -9470,24 +9503,24 @@ class Path {
|
||||||
// Array
|
// Array
|
||||||
else {
|
else {
|
||||||
// Must not be empty
|
// Must not be empty
|
||||||
assert_1.default(itemPath.length > 0, `Parameter 'itemPath' must not be an empty array`);
|
(0, assert_1.default)(itemPath.length > 0, `Parameter 'itemPath' must not be an empty array`);
|
||||||
// Each segment
|
// Each segment
|
||||||
for (let i = 0; i < itemPath.length; i++) {
|
for (let i = 0; i < itemPath.length; i++) {
|
||||||
let segment = itemPath[i];
|
let segment = itemPath[i];
|
||||||
// Must not be empty
|
// Must not be empty
|
||||||
assert_1.default(segment, `Parameter 'itemPath' must not contain any empty segments`);
|
(0, assert_1.default)(segment, `Parameter 'itemPath' must not contain any empty segments`);
|
||||||
// Normalize slashes
|
// Normalize slashes
|
||||||
segment = pathHelper.normalizeSeparators(itemPath[i]);
|
segment = pathHelper.normalizeSeparators(itemPath[i]);
|
||||||
// Root segment
|
// Root segment
|
||||||
if (i === 0 && pathHelper.hasRoot(segment)) {
|
if (i === 0 && pathHelper.hasRoot(segment)) {
|
||||||
segment = pathHelper.safeTrimTrailingSeparator(segment);
|
segment = pathHelper.safeTrimTrailingSeparator(segment);
|
||||||
assert_1.default(segment === pathHelper.dirname(segment), `Parameter 'itemPath' root segment contains information for multiple segments`);
|
(0, assert_1.default)(segment === pathHelper.dirname(segment), `Parameter 'itemPath' root segment contains information for multiple segments`);
|
||||||
this.segments.push(segment);
|
this.segments.push(segment);
|
||||||
}
|
}
|
||||||
// All other segments
|
// All other segments
|
||||||
else {
|
else {
|
||||||
// Must not contain slash
|
// Must not contain slash
|
||||||
assert_1.default(!segment.includes(path.sep), `Parameter 'itemPath' contains unexpected path separators`);
|
(0, assert_1.default)(!segment.includes(path.sep), `Parameter 'itemPath' contains unexpected path separators`);
|
||||||
this.segments.push(segment);
|
this.segments.push(segment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9525,7 +9558,11 @@ exports.Path = Path;
|
||||||
|
|
||||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||||
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||||
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||||
|
}
|
||||||
|
Object.defineProperty(o, k2, desc);
|
||||||
}) : (function(o, m, k, k2) {
|
}) : (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
o[k2] = m[k];
|
o[k2] = m[k];
|
||||||
|
@ -9538,7 +9575,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
var result = {};
|
||||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
__setModuleDefault(result, mod);
|
__setModuleDefault(result, mod);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
@ -9626,7 +9663,11 @@ exports.partialMatch = partialMatch;
|
||||||
|
|
||||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||||
|
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||||
|
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||||
|
}
|
||||||
|
Object.defineProperty(o, k2, desc);
|
||||||
}) : (function(o, m, k, k2) {
|
}) : (function(o, m, k, k2) {
|
||||||
if (k2 === undefined) k2 = k;
|
if (k2 === undefined) k2 = k;
|
||||||
o[k2] = m[k];
|
o[k2] = m[k];
|
||||||
|
@ -9639,7 +9680,7 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
if (mod && mod.__esModule) return mod;
|
if (mod && mod.__esModule) return mod;
|
||||||
var result = {};
|
var result = {};
|
||||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||||
__setModuleDefault(result, mod);
|
__setModuleDefault(result, mod);
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
@ -9671,9 +9712,9 @@ class Pattern {
|
||||||
else {
|
else {
|
||||||
// Convert to pattern
|
// Convert to pattern
|
||||||
segments = segments || [];
|
segments = segments || [];
|
||||||
assert_1.default(segments.length, `Parameter 'segments' must not empty`);
|
(0, assert_1.default)(segments.length, `Parameter 'segments' must not empty`);
|
||||||
const root = Pattern.getLiteral(segments[0]);
|
const root = Pattern.getLiteral(segments[0]);
|
||||||
assert_1.default(root && pathHelper.hasAbsoluteRoot(root), `Parameter 'segments' first element must be a root path`);
|
(0, assert_1.default)(root && pathHelper.hasAbsoluteRoot(root), `Parameter 'segments' first element must be a root path`);
|
||||||
pattern = new internal_path_1.Path(segments).toString().trim();
|
pattern = new internal_path_1.Path(segments).toString().trim();
|
||||||
if (patternOrNegate) {
|
if (patternOrNegate) {
|
||||||
pattern = `!${pattern}`;
|
pattern = `!${pattern}`;
|
||||||
|
@ -9767,13 +9808,13 @@ class Pattern {
|
||||||
*/
|
*/
|
||||||
static fixupPattern(pattern, homedir) {
|
static fixupPattern(pattern, homedir) {
|
||||||
// Empty
|
// Empty
|
||||||
assert_1.default(pattern, 'pattern cannot be empty');
|
(0, assert_1.default)(pattern, 'pattern cannot be empty');
|
||||||
// Must not contain `.` segment, unless first segment
|
// Must not contain `.` segment, unless first segment
|
||||||
// Must not contain `..` segment
|
// Must not contain `..` segment
|
||||||
const literalSegments = new internal_path_1.Path(pattern).segments.map(x => Pattern.getLiteral(x));
|
const literalSegments = new internal_path_1.Path(pattern).segments.map(x => Pattern.getLiteral(x));
|
||||||
assert_1.default(literalSegments.every((x, i) => (x !== '.' || i === 0) && x !== '..'), `Invalid pattern '${pattern}'. Relative pathing '.' and '..' is not allowed.`);
|
(0, assert_1.default)(literalSegments.every((x, i) => (x !== '.' || i === 0) && x !== '..'), `Invalid pattern '${pattern}'. Relative pathing '.' and '..' is not allowed.`);
|
||||||
// Must not contain globs in root, e.g. Windows UNC path \\foo\b*r
|
// Must not contain globs in root, e.g. Windows UNC path \\foo\b*r
|
||||||
assert_1.default(!pathHelper.hasRoot(pattern) || literalSegments[0], `Invalid pattern '${pattern}'. Root segment must not contain globs.`);
|
(0, assert_1.default)(!pathHelper.hasRoot(pattern) || literalSegments[0], `Invalid pattern '${pattern}'. Root segment must not contain globs.`);
|
||||||
// Normalize slashes
|
// Normalize slashes
|
||||||
pattern = pathHelper.normalizeSeparators(pattern);
|
pattern = pathHelper.normalizeSeparators(pattern);
|
||||||
// Replace leading `.` segment
|
// Replace leading `.` segment
|
||||||
|
@ -9783,8 +9824,8 @@ class Pattern {
|
||||||
// Replace leading `~` segment
|
// Replace leading `~` segment
|
||||||
else if (pattern === '~' || pattern.startsWith(`~${path.sep}`)) {
|
else if (pattern === '~' || pattern.startsWith(`~${path.sep}`)) {
|
||||||
homedir = homedir || os.homedir();
|
homedir = homedir || os.homedir();
|
||||||
assert_1.default(homedir, 'Unable to determine HOME directory');
|
(0, assert_1.default)(homedir, 'Unable to determine HOME directory');
|
||||||
assert_1.default(pathHelper.hasAbsoluteRoot(homedir), `Expected HOME directory to be a rooted path. Actual '${homedir}'`);
|
(0, assert_1.default)(pathHelper.hasAbsoluteRoot(homedir), `Expected HOME directory to be a rooted path. Actual '${homedir}'`);
|
||||||
pattern = Pattern.globEscape(homedir) + pattern.substr(1);
|
pattern = Pattern.globEscape(homedir) + pattern.substr(1);
|
||||||
}
|
}
|
||||||
// Replace relative drive root, e.g. pattern is C: or C:foo
|
// Replace relative drive root, e.g. pattern is C: or C:foo
|
||||||
|
@ -99260,8 +99301,8 @@ function findGraalPyVersion(versionSpec, architecture, updateEnvironment, checkL
|
||||||
const pipDir = utils_1.IS_WINDOWS ? 'Scripts' : 'bin';
|
const pipDir = utils_1.IS_WINDOWS ? 'Scripts' : 'bin';
|
||||||
const _binDir = path.join(installDir, pipDir);
|
const _binDir = path.join(installDir, pipDir);
|
||||||
const binaryExtension = utils_1.IS_WINDOWS ? '.exe' : '';
|
const binaryExtension = utils_1.IS_WINDOWS ? '.exe' : '';
|
||||||
const pythonPath = path.join(utils_1.IS_WINDOWS ? installDir : _binDir, `python${binaryExtension}`);
|
const pythonPath = path.join(_binDir, `python${binaryExtension}`);
|
||||||
const pythonLocation = (0, utils_1.getBinaryDirectory)(installDir);
|
const pythonLocation = path.join(installDir, 'bin');
|
||||||
if (updateEnvironment) {
|
if (updateEnvironment) {
|
||||||
core.exportVariable('pythonLocation', installDir);
|
core.exportVariable('pythonLocation', installDir);
|
||||||
// https://cmake.org/cmake/help/latest/module/FindPython.html#module:FindPython
|
// https://cmake.org/cmake/help/latest/module/FindPython.html#module:FindPython
|
||||||
|
@ -99773,7 +99814,12 @@ function installGraalPy(graalpyVersion, architecture, allowPreReleases, releases
|
||||||
try {
|
try {
|
||||||
const graalpyPath = yield tc.downloadTool(downloadUrl, undefined, AUTH);
|
const graalpyPath = yield tc.downloadTool(downloadUrl, undefined, AUTH);
|
||||||
core.info('Extracting downloaded archive...');
|
core.info('Extracting downloaded archive...');
|
||||||
downloadDir = yield tc.extractTar(graalpyPath);
|
if (utils_1.IS_WINDOWS) {
|
||||||
|
downloadDir = yield tc.extractZip(graalpyPath);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
downloadDir = yield tc.extractTar(graalpyPath);
|
||||||
|
}
|
||||||
// root folder in archive can have unpredictable name so just take the first folder
|
// root folder in archive can have unpredictable name so just take the first folder
|
||||||
// downloadDir is unique folder under TEMP and can't contain any other folders
|
// downloadDir is unique folder under TEMP and can't contain any other folders
|
||||||
const archiveName = fs_1.default.readdirSync(downloadDir)[0];
|
const archiveName = fs_1.default.readdirSync(downloadDir)[0];
|
||||||
|
@ -99782,7 +99828,7 @@ function installGraalPy(graalpyVersion, architecture, allowPreReleases, releases
|
||||||
if (!(0, utils_1.isNightlyKeyword)(resolvedGraalPyVersion)) {
|
if (!(0, utils_1.isNightlyKeyword)(resolvedGraalPyVersion)) {
|
||||||
installDir = yield tc.cacheDir(toolDir, 'GraalPy', resolvedGraalPyVersion, architecture);
|
installDir = yield tc.cacheDir(toolDir, 'GraalPy', resolvedGraalPyVersion, architecture);
|
||||||
}
|
}
|
||||||
const binaryPath = (0, utils_1.getBinaryDirectory)(installDir);
|
const binaryPath = path.join(installDir, 'bin');
|
||||||
yield createGraalPySymlink(binaryPath, resolvedGraalPyVersion);
|
yield createGraalPySymlink(binaryPath, resolvedGraalPyVersion);
|
||||||
yield installPip(binaryPath);
|
yield installPip(binaryPath);
|
||||||
return { installDir, resolvedGraalPyVersion };
|
return { installDir, resolvedGraalPyVersion };
|
||||||
|
@ -99813,6 +99859,9 @@ function getAvailableGraalPyVersions() {
|
||||||
if (AUTH) {
|
if (AUTH) {
|
||||||
headers.authorization = AUTH;
|
headers.authorization = AUTH;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
Get releases first.
|
||||||
|
*/
|
||||||
let url = 'https://api.github.com/repos/oracle/graalpython/releases';
|
let url = 'https://api.github.com/repos/oracle/graalpython/releases';
|
||||||
const result = [];
|
const result = [];
|
||||||
do {
|
do {
|
||||||
|
@ -99823,6 +99872,19 @@ function getAvailableGraalPyVersions() {
|
||||||
result.push(...response.result);
|
result.push(...response.result);
|
||||||
url = (0, utils_1.getNextPageUrl)(response);
|
url = (0, utils_1.getNextPageUrl)(response);
|
||||||
} while (url);
|
} while (url);
|
||||||
|
/*
|
||||||
|
Add pre-release builds.
|
||||||
|
*/
|
||||||
|
url =
|
||||||
|
'https://api.github.com/repos/graalvm/graal-languages-ea-builds/releases';
|
||||||
|
do {
|
||||||
|
const response = yield http.getJson(url, headers);
|
||||||
|
if (!response.result) {
|
||||||
|
throw new Error(`Unable to retrieve the list of available GraalPy versions from '${url}'`);
|
||||||
|
}
|
||||||
|
result.push(...response.result);
|
||||||
|
url = (0, utils_1.getNextPageUrl)(response);
|
||||||
|
} while (url);
|
||||||
return result;
|
return result;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -99848,7 +99910,7 @@ function installPip(pythonLocation) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function graalPyTagToVersion(tag) {
|
function graalPyTagToVersion(tag) {
|
||||||
const versionPattern = /.*-(\d+\.\d+\.\d+(?:\.\d+)?)((?:a|b|rc))?(\d*)?/;
|
const versionPattern = /.*-(\d+\.\d+\.\d+(?:\.\d+)?)(?:-((?:ea|a|b|rc))\.0*(\d*))?/;
|
||||||
const match = tag.match(versionPattern);
|
const match = tag.match(versionPattern);
|
||||||
if (match && match[2]) {
|
if (match && match[2]) {
|
||||||
return `${match[1]}-${match[2]}.${match[3]}`;
|
return `${match[1]}-${match[2]}.${match[3]}`;
|
||||||
|
@ -99902,8 +99964,9 @@ exports.toGraalPyArchitecture = toGraalPyArchitecture;
|
||||||
function findAsset(item, architecture, platform) {
|
function findAsset(item, architecture, platform) {
|
||||||
const graalpyArch = toGraalPyArchitecture(architecture);
|
const graalpyArch = toGraalPyArchitecture(architecture);
|
||||||
const graalpyPlatform = toGraalPyPlatform(platform);
|
const graalpyPlatform = toGraalPyPlatform(platform);
|
||||||
|
const graalpyExt = platform == 'win32' ? 'zip' : 'tar.gz';
|
||||||
const found = item.assets.filter(file => file.name.startsWith('graalpy') &&
|
const found = item.assets.filter(file => file.name.startsWith('graalpy') &&
|
||||||
file.name.endsWith(`-${graalpyPlatform}-${graalpyArch}.tar.gz`));
|
file.name.endsWith(`-${graalpyPlatform}-${graalpyArch}.${graalpyExt}`));
|
||||||
/*
|
/*
|
||||||
In the future there could be more variants of GraalPy for a single release. Pick the shortest name, that one is the most likely to be the primary variant.
|
In the future there could be more variants of GraalPy for a single release. Pick the shortest name, that one is the most likely to be the primary variant.
|
||||||
*/
|
*/
|
||||||
|
@ -100494,7 +100557,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.getDownloadFileName = exports.getNextPageUrl = exports.getBinaryDirectory = exports.getVersionInputFromFile = exports.getVersionInputFromPlainFile = exports.getVersionInputFromTomlFile = exports.getOSInfo = exports.getLinuxInfo = exports.logWarning = exports.isCacheFeatureAvailable = exports.isGhes = exports.validatePythonVersionFormatForPyPy = exports.writeExactPyPyVersionFile = exports.readExactPyPyVersionFile = exports.getPyPyVersionFromPath = exports.isNightlyKeyword = exports.validateVersion = exports.createSymlinkInFolder = exports.WINDOWS_PLATFORMS = exports.WINDOWS_ARCHS = exports.IS_MAC = exports.IS_LINUX = exports.IS_WINDOWS = void 0;
|
exports.getDownloadFileName = exports.getNextPageUrl = exports.getBinaryDirectory = exports.getVersionInputFromFile = exports.getVersionInputFromToolVersions = exports.getVersionInputFromPlainFile = exports.getVersionInputFromTomlFile = exports.getOSInfo = exports.getLinuxInfo = exports.logWarning = exports.isCacheFeatureAvailable = exports.isGhes = exports.validatePythonVersionFormatForPyPy = exports.writeExactPyPyVersionFile = exports.readExactPyPyVersionFile = exports.getPyPyVersionFromPath = exports.isNightlyKeyword = exports.validateVersion = exports.createSymlinkInFolder = exports.WINDOWS_PLATFORMS = exports.WINDOWS_ARCHS = exports.IS_MAC = exports.IS_LINUX = exports.IS_WINDOWS = void 0;
|
||||||
/* eslint no-unsafe-finally: "off" */
|
/* eslint no-unsafe-finally: "off" */
|
||||||
const cache = __importStar(__nccwpck_require__(5116));
|
const cache = __importStar(__nccwpck_require__(5116));
|
||||||
const core = __importStar(__nccwpck_require__(7484));
|
const core = __importStar(__nccwpck_require__(7484));
|
||||||
|
@ -100718,19 +100781,53 @@ function getVersionInputFromPlainFile(versionFile) {
|
||||||
}
|
}
|
||||||
exports.getVersionInputFromPlainFile = getVersionInputFromPlainFile;
|
exports.getVersionInputFromPlainFile = getVersionInputFromPlainFile;
|
||||||
/**
|
/**
|
||||||
* Python version extracted from a plain or TOML file.
|
* Python version extracted from a .tool-versions file.
|
||||||
|
*/
|
||||||
|
function getVersionInputFromToolVersions(versionFile) {
|
||||||
|
var _a;
|
||||||
|
if (!fs_1.default.existsSync(versionFile)) {
|
||||||
|
core.warning(`File ${versionFile} does not exist.`);
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const fileContents = fs_1.default.readFileSync(versionFile, 'utf8');
|
||||||
|
const lines = fileContents.split('\n');
|
||||||
|
for (const line of lines) {
|
||||||
|
// Skip commented lines
|
||||||
|
if (line.trim().startsWith('#')) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const match = line.match(/^\s*python\s*v?\s*(?<version>[^\s]+)\s*$/);
|
||||||
|
if (match) {
|
||||||
|
return [((_a = match.groups) === null || _a === void 0 ? void 0 : _a.version.trim()) || ''];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
core.warning(`No Python version found in ${versionFile}`);
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
core.error(`Error reading ${versionFile}: ${error.message}`);
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.getVersionInputFromToolVersions = getVersionInputFromToolVersions;
|
||||||
|
/**
|
||||||
|
* Python version extracted from a plain, .tool-versions or TOML file.
|
||||||
*/
|
*/
|
||||||
function getVersionInputFromFile(versionFile) {
|
function getVersionInputFromFile(versionFile) {
|
||||||
if (versionFile.endsWith('.toml')) {
|
if (versionFile.endsWith('.toml')) {
|
||||||
return getVersionInputFromTomlFile(versionFile);
|
return getVersionInputFromTomlFile(versionFile);
|
||||||
}
|
}
|
||||||
|
else if (versionFile.match('.tool-versions')) {
|
||||||
|
return getVersionInputFromToolVersions(versionFile);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
return getVersionInputFromPlainFile(versionFile);
|
return getVersionInputFromPlainFile(versionFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.getVersionInputFromFile = getVersionInputFromFile;
|
exports.getVersionInputFromFile = getVersionInputFromFile;
|
||||||
/**
|
/**
|
||||||
* Get the directory containing interpreter binary from installation directory of PyPy or GraalPy
|
* Get the directory containing interpreter binary from installation directory of PyPy
|
||||||
* - On Linux and macOS, the Python interpreter is in 'bin'.
|
* - On Linux and macOS, the Python interpreter is in 'bin'.
|
||||||
* - On Windows, it is in the installation root.
|
* - On Windows, it is in the installation root.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -278,9 +278,9 @@ jobs:
|
||||||
|
|
||||||
## Using the `python-version-file` input
|
## Using the `python-version-file` input
|
||||||
|
|
||||||
`setup-python` action can read the Python or PyPy version from a version file. `python-version-file` input is used to specify the path to the version file. If the file that was supplied to `python-version-file` input doesn't exist, the action will fail with an error.
|
`setup-python` action can read Python or PyPy version from a version file. `python-version-file` input is used for specifying the path to the version file. If the file that was supplied to `python-version-file` input doesn't exist, the action will fail with error.
|
||||||
|
|
||||||
>In case both `python-version` and `python-version-file` inputs are supplied, the `python-version-file` input will be ignored due to its lower priority.
|
>In case both `python-version` and `python-version-file` inputs are supplied, the `python-version-file` input will be ignored due to its lower priority. The .tool-versions file supports version specifications in accordance with asdf standards, adhering to Semantic Versioning ([semver](https://semver.org)).
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
|
@ -300,6 +300,15 @@ steps:
|
||||||
- run: python my_script.py
|
- run: python my_script.py
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version-file: '.tool-versions' # Read python version from a file .tool-versions
|
||||||
|
- run: python my_script.py
|
||||||
|
```
|
||||||
|
|
||||||
## Check latest version
|
## Check latest version
|
||||||
|
|
||||||
The `check-latest` flag defaults to `false`. Use the default or set `check-latest` to `false` if you prefer stability and if you want to ensure a specific `Python or PyPy` version is always used.
|
The `check-latest` flag defaults to `false`. Use the default or set `check-latest` to `false` if you prefer stability and if you want to ensure a specific `Python or PyPy` version is always used.
|
||||||
|
|
9
package-lock.json
generated
9
package-lock.json
generated
|
@ -12,7 +12,7 @@
|
||||||
"@actions/cache": "^4.0.0",
|
"@actions/cache": "^4.0.0",
|
||||||
"@actions/core": "^1.10.0",
|
"@actions/core": "^1.10.0",
|
||||||
"@actions/exec": "^1.1.0",
|
"@actions/exec": "^1.1.0",
|
||||||
"@actions/glob": "^0.4.0",
|
"@actions/glob": "^0.5.0",
|
||||||
"@actions/http-client": "^2.2.3",
|
"@actions/http-client": "^2.2.3",
|
||||||
"@actions/io": "^1.0.2",
|
"@actions/io": "^1.0.2",
|
||||||
"@actions/tool-cache": "^2.0.1",
|
"@actions/tool-cache": "^2.0.1",
|
||||||
|
@ -100,9 +100,10 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@actions/glob": {
|
"node_modules/@actions/glob": {
|
||||||
"version": "0.4.0",
|
"version": "0.5.0",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.4.0.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.5.0.tgz",
|
||||||
"integrity": "sha512-+eKIGFhsFa4EBwaf/GMyzCdWrXWymGXfFmZU3FHQvYS8mPcHtTtZONbkcqqUMzw9mJ/pImEBFET1JNifhqGsAQ==",
|
"integrity": "sha512-tST2rjPvJLRZLuT9NMUtyBjvj9Yo0MiJS3ow004slMvm8GFM+Zv9HvMJ7HWzfUyJnGrJvDsYkWBaaG3YKXRtCw==",
|
||||||
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.9.1",
|
"@actions/core": "^1.9.1",
|
||||||
"minimatch": "^3.0.4"
|
"minimatch": "^3.0.4"
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
"@actions/cache": "^4.0.0",
|
"@actions/cache": "^4.0.0",
|
||||||
"@actions/core": "^1.10.0",
|
"@actions/core": "^1.10.0",
|
||||||
"@actions/exec": "^1.1.0",
|
"@actions/exec": "^1.1.0",
|
||||||
"@actions/glob": "^0.4.0",
|
"@actions/glob": "^0.5.0",
|
||||||
"@actions/http-client": "^2.2.3",
|
"@actions/http-client": "^2.2.3",
|
||||||
"@actions/io": "^1.0.2",
|
"@actions/io": "^1.0.2",
|
||||||
"@actions/tool-cache": "^2.0.1",
|
"@actions/tool-cache": "^2.0.1",
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as graalpyInstall from './install-graalpy';
|
import * as graalpyInstall from './install-graalpy';
|
||||||
import {
|
import {IS_WINDOWS, validateVersion, IGraalPyManifestRelease} from './utils';
|
||||||
IS_WINDOWS,
|
|
||||||
validateVersion,
|
|
||||||
IGraalPyManifestRelease,
|
|
||||||
getBinaryDirectory
|
|
||||||
} from './utils';
|
|
||||||
|
|
||||||
import * as semver from 'semver';
|
import * as semver from 'semver';
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
|
@ -62,11 +57,8 @@ export async function findGraalPyVersion(
|
||||||
const pipDir = IS_WINDOWS ? 'Scripts' : 'bin';
|
const pipDir = IS_WINDOWS ? 'Scripts' : 'bin';
|
||||||
const _binDir = path.join(installDir, pipDir);
|
const _binDir = path.join(installDir, pipDir);
|
||||||
const binaryExtension = IS_WINDOWS ? '.exe' : '';
|
const binaryExtension = IS_WINDOWS ? '.exe' : '';
|
||||||
const pythonPath = path.join(
|
const pythonPath = path.join(_binDir, `python${binaryExtension}`);
|
||||||
IS_WINDOWS ? installDir : _binDir,
|
const pythonLocation = path.join(installDir, 'bin');
|
||||||
`python${binaryExtension}`
|
|
||||||
);
|
|
||||||
const pythonLocation = getBinaryDirectory(installDir);
|
|
||||||
if (updateEnvironment) {
|
if (updateEnvironment) {
|
||||||
core.exportVariable('pythonLocation', installDir);
|
core.exportVariable('pythonLocation', installDir);
|
||||||
// https://cmake.org/cmake/help/latest/module/FindPython.html#module:FindPython
|
// https://cmake.org/cmake/help/latest/module/FindPython.html#module:FindPython
|
||||||
|
|
|
@ -15,7 +15,6 @@ import {
|
||||||
IGraalPyManifestRelease,
|
IGraalPyManifestRelease,
|
||||||
createSymlinkInFolder,
|
createSymlinkInFolder,
|
||||||
isNightlyKeyword,
|
isNightlyKeyword,
|
||||||
getBinaryDirectory,
|
|
||||||
getNextPageUrl
|
getNextPageUrl
|
||||||
} from './utils';
|
} from './utils';
|
||||||
|
|
||||||
|
@ -64,7 +63,11 @@ export async function installGraalPy(
|
||||||
const graalpyPath = await tc.downloadTool(downloadUrl, undefined, AUTH);
|
const graalpyPath = await tc.downloadTool(downloadUrl, undefined, AUTH);
|
||||||
|
|
||||||
core.info('Extracting downloaded archive...');
|
core.info('Extracting downloaded archive...');
|
||||||
downloadDir = await tc.extractTar(graalpyPath);
|
if (IS_WINDOWS) {
|
||||||
|
downloadDir = await tc.extractZip(graalpyPath);
|
||||||
|
} else {
|
||||||
|
downloadDir = await tc.extractTar(graalpyPath);
|
||||||
|
}
|
||||||
|
|
||||||
// root folder in archive can have unpredictable name so just take the first folder
|
// root folder in archive can have unpredictable name so just take the first folder
|
||||||
// downloadDir is unique folder under TEMP and can't contain any other folders
|
// downloadDir is unique folder under TEMP and can't contain any other folders
|
||||||
|
@ -81,7 +84,7 @@ export async function installGraalPy(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const binaryPath = getBinaryDirectory(installDir);
|
const binaryPath = path.join(installDir, 'bin');
|
||||||
await createGraalPySymlink(binaryPath, resolvedGraalPyVersion);
|
await createGraalPySymlink(binaryPath, resolvedGraalPyVersion);
|
||||||
await installPip(binaryPath);
|
await installPip(binaryPath);
|
||||||
|
|
||||||
|
@ -115,6 +118,9 @@ export async function getAvailableGraalPyVersions() {
|
||||||
headers.authorization = AUTH;
|
headers.authorization = AUTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Get releases first.
|
||||||
|
*/
|
||||||
let url: string | null =
|
let url: string | null =
|
||||||
'https://api.github.com/repos/oracle/graalpython/releases';
|
'https://api.github.com/repos/oracle/graalpython/releases';
|
||||||
const result: IGraalPyManifestRelease[] = [];
|
const result: IGraalPyManifestRelease[] = [];
|
||||||
|
@ -130,6 +136,23 @@ export async function getAvailableGraalPyVersions() {
|
||||||
url = getNextPageUrl(response);
|
url = getNextPageUrl(response);
|
||||||
} while (url);
|
} while (url);
|
||||||
|
|
||||||
|
/*
|
||||||
|
Add pre-release builds.
|
||||||
|
*/
|
||||||
|
url =
|
||||||
|
'https://api.github.com/repos/graalvm/graal-languages-ea-builds/releases';
|
||||||
|
do {
|
||||||
|
const response: ifm.TypedResponse<IGraalPyManifestRelease[]> =
|
||||||
|
await http.getJson(url, headers);
|
||||||
|
if (!response.result) {
|
||||||
|
throw new Error(
|
||||||
|
`Unable to retrieve the list of available GraalPy versions from '${url}'`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
result.push(...response.result);
|
||||||
|
url = getNextPageUrl(response);
|
||||||
|
} while (url);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,7 +198,8 @@ async function installPip(pythonLocation: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function graalPyTagToVersion(tag: string) {
|
export function graalPyTagToVersion(tag: string) {
|
||||||
const versionPattern = /.*-(\d+\.\d+\.\d+(?:\.\d+)?)((?:a|b|rc))?(\d*)?/;
|
const versionPattern =
|
||||||
|
/.*-(\d+\.\d+\.\d+(?:\.\d+)?)(?:-((?:ea|a|b|rc))\.0*(\d*))?/;
|
||||||
const match = tag.match(versionPattern);
|
const match = tag.match(versionPattern);
|
||||||
if (match && match[2]) {
|
if (match && match[2]) {
|
||||||
return `${match[1]}-${match[2]}.${match[3]}`;
|
return `${match[1]}-${match[2]}.${match[3]}`;
|
||||||
|
@ -251,10 +275,11 @@ export function findAsset(
|
||||||
) {
|
) {
|
||||||
const graalpyArch = toGraalPyArchitecture(architecture);
|
const graalpyArch = toGraalPyArchitecture(architecture);
|
||||||
const graalpyPlatform = toGraalPyPlatform(platform);
|
const graalpyPlatform = toGraalPyPlatform(platform);
|
||||||
|
const graalpyExt = platform == 'win32' ? 'zip' : 'tar.gz';
|
||||||
const found = item.assets.filter(
|
const found = item.assets.filter(
|
||||||
file =>
|
file =>
|
||||||
file.name.startsWith('graalpy') &&
|
file.name.startsWith('graalpy') &&
|
||||||
file.name.endsWith(`-${graalpyPlatform}-${graalpyArch}.tar.gz`)
|
file.name.endsWith(`-${graalpyPlatform}-${graalpyArch}.${graalpyExt}`)
|
||||||
);
|
);
|
||||||
/*
|
/*
|
||||||
In the future there could be more variants of GraalPy for a single release. Pick the shortest name, that one is the most likely to be the primary variant.
|
In the future there could be more variants of GraalPy for a single release. Pick the shortest name, that one is the most likely to be the primary variant.
|
||||||
|
|
38
src/utils.ts
38
src/utils.ts
|
@ -279,18 +279,52 @@ export function getVersionInputFromPlainFile(versionFile: string): string[] {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Python version extracted from a plain or TOML file.
|
* Python version extracted from a .tool-versions file.
|
||||||
|
*/
|
||||||
|
export function getVersionInputFromToolVersions(versionFile: string): string[] {
|
||||||
|
if (!fs.existsSync(versionFile)) {
|
||||||
|
core.warning(`File ${versionFile} does not exist.`);
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const fileContents = fs.readFileSync(versionFile, 'utf8');
|
||||||
|
const lines = fileContents.split('\n');
|
||||||
|
|
||||||
|
for (const line of lines) {
|
||||||
|
// Skip commented lines
|
||||||
|
if (line.trim().startsWith('#')) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const match = line.match(/^\s*python\s*v?\s*(?<version>[^\s]+)\s*$/);
|
||||||
|
if (match) {
|
||||||
|
return [match.groups?.version.trim() || ''];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
core.warning(`No Python version found in ${versionFile}`);
|
||||||
|
|
||||||
|
return [];
|
||||||
|
} catch (error) {
|
||||||
|
core.error(`Error reading ${versionFile}: ${(error as Error).message}`);
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Python version extracted from a plain, .tool-versions or TOML file.
|
||||||
*/
|
*/
|
||||||
export function getVersionInputFromFile(versionFile: string): string[] {
|
export function getVersionInputFromFile(versionFile: string): string[] {
|
||||||
if (versionFile.endsWith('.toml')) {
|
if (versionFile.endsWith('.toml')) {
|
||||||
return getVersionInputFromTomlFile(versionFile);
|
return getVersionInputFromTomlFile(versionFile);
|
||||||
|
} else if (versionFile.match('.tool-versions')) {
|
||||||
|
return getVersionInputFromToolVersions(versionFile);
|
||||||
} else {
|
} else {
|
||||||
return getVersionInputFromPlainFile(versionFile);
|
return getVersionInputFromPlainFile(versionFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the directory containing interpreter binary from installation directory of PyPy or GraalPy
|
* Get the directory containing interpreter binary from installation directory of PyPy
|
||||||
* - On Linux and macOS, the Python interpreter is in 'bin'.
|
* - On Linux and macOS, the Python interpreter is in 'bin'.
|
||||||
* - On Windows, it is in the installation root.
|
* - On Windows, it is in the installation root.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue