Merge 34fd4fddeb
into 2216f56ae1
This commit is contained in:
commit
7a9d0ad3c0
|
@ -0,0 +1,54 @@
|
|||
name: Windows fix validation
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- releases/*
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
-
|
||||
jobs:
|
||||
setup-version:
|
||||
runs-on: ${{ matrix.operating-system }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
operating-system: [windows-2019, windows-2022]
|
||||
dotnet-version: ['2.1', '2.2', '3.0', '3.1', '5.0', '6.0', '7.0', '8.0']
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Clear toolcache
|
||||
shell: pwsh
|
||||
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
|
||||
|
||||
- name: Take note of the current time
|
||||
run: Get-Date | Out-File -FilePath "timestamp.txt"
|
||||
|
||||
- name: Setup dotnet ${{ matrix.dotnet-version }}
|
||||
uses: ./
|
||||
with:
|
||||
dotnet-version: ${{ matrix.dotnet-version }}
|
||||
|
||||
- name: Verify the action took less than 1 minute
|
||||
run: |
|
||||
$timestampContent = Get-Content -Path "timestamp.txt"
|
||||
$timestamp = [DateTime]::Parse($timestampContent)
|
||||
$now = Get-Date
|
||||
|
||||
$diff = New-TimeSpan -Start $timestamp -End $now
|
||||
if ($diff.Minutes -gt 1) {
|
||||
throw "The action took longer than 1 minute to run"
|
||||
}
|
||||
|
||||
- name: Verify dotnet was installed on drive D
|
||||
run: |
|
||||
$dotnetPath = Get-ChildItem -Path "D:\Program Files\dotnet" -Directory -Name
|
||||
if ($dotnetPath -eq $null) {
|
||||
throw "dotnet was not installed on drive D"
|
||||
}
|
|
@ -72836,7 +72836,7 @@ const core = __importStar(__nccwpck_require__(2186));
|
|||
const exec = __importStar(__nccwpck_require__(1514));
|
||||
const io = __importStar(__nccwpck_require__(7436));
|
||||
const hc = __importStar(__nccwpck_require__(6255));
|
||||
const fs_1 = __nccwpck_require__(7147);
|
||||
const fs_1 = __importStar(__nccwpck_require__(7147));
|
||||
const path_1 = __importDefault(__nccwpck_require__(1017));
|
||||
const os_1 = __importDefault(__nccwpck_require__(2037));
|
||||
const semver_1 = __importDefault(__nccwpck_require__(5911));
|
||||
|
@ -73008,6 +73008,16 @@ class DotnetInstallScript {
|
|||
}
|
||||
}
|
||||
exports.DotnetInstallScript = DotnetInstallScript;
|
||||
// Workaround for slow installation on Windows with network attached C: drive
|
||||
// see https://github.com/actions/setup-dotnet/issues/260
|
||||
const fixWindowsInstallDir = (installDir) => {
|
||||
if (!(0, utils_1.isSelfHosted)() && fs_1.default.existsSync('d:\\')) {
|
||||
return installDir.replace(/^[cC]:\\/, 'd:\\');
|
||||
}
|
||||
else {
|
||||
return installDir;
|
||||
}
|
||||
};
|
||||
class DotnetInstallDir {
|
||||
static convertInstallPathToAbsolute(installDir) {
|
||||
if (path_1.default.isAbsolute(installDir))
|
||||
|
@ -73029,7 +73039,7 @@ exports.DotnetInstallDir = DotnetInstallDir;
|
|||
DotnetInstallDir.default = {
|
||||
linux: '/usr/share/dotnet',
|
||||
mac: path_1.default.join(process.env['HOME'] + '', '.dotnet'),
|
||||
windows: path_1.default.join(process.env['PROGRAMFILES'] + '', 'dotnet')
|
||||
windows: fixWindowsInstallDir(path_1.default.join(process.env['PROGRAMFILES'] + '', 'dotnet'))
|
||||
};
|
||||
DotnetInstallDir.dirPath = process.env['DOTNET_INSTALL_DIR']
|
||||
? DotnetInstallDir.convertInstallPathToAbsolute(process.env['DOTNET_INSTALL_DIR'])
|
||||
|
@ -73272,7 +73282,7 @@ run();
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.PLATFORM = exports.IS_WINDOWS = void 0;
|
||||
exports.isSelfHosted = exports.PLATFORM = exports.IS_WINDOWS = void 0;
|
||||
exports.IS_WINDOWS = process.platform === 'win32';
|
||||
exports.PLATFORM = (() => {
|
||||
if (process.platform === 'win32')
|
||||
|
@ -73281,6 +73291,10 @@ exports.PLATFORM = (() => {
|
|||
return 'linux';
|
||||
return 'mac';
|
||||
})();
|
||||
const isSelfHosted = () => process.env['AGENT_ISSELFHOSTED'] === '1' ||
|
||||
(process.env['AGENT_ISSELFHOSTED'] === undefined &&
|
||||
process.env['RUNNER_ENVIRONMENT'] !== 'github-hosted');
|
||||
exports.isSelfHosted = isSelfHosted;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
|
File diff suppressed because it is too large
Load Diff
10
package.json
10
package.json
|
@ -38,7 +38,7 @@
|
|||
"semver": "^6.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^27.5.2",
|
||||
"@types/jest": "^28.1.3",
|
||||
"@types/node": "^16.11.25",
|
||||
"@types/semver": "^6.2.2",
|
||||
"@typescript-eslint/eslint-plugin": "^5.54.0",
|
||||
|
@ -49,11 +49,11 @@
|
|||
"eslint-plugin-jest": "^27.2.1",
|
||||
"eslint-plugin-node": "^11.1.0",
|
||||
"husky": "^8.0.1",
|
||||
"jest": "^27.5.1",
|
||||
"jest-circus": "^27.5.1",
|
||||
"jest-each": "^27.5.1",
|
||||
"jest": "^28.1.3",
|
||||
"jest-circus": "^28.1.3",
|
||||
"jest-each": "^28.1.3",
|
||||
"prettier": "^2.8.4",
|
||||
"ts-jest": "^27.0.5",
|
||||
"ts-jest": "^28.0.8",
|
||||
"typescript": "^4.8.4",
|
||||
"wget-improved": "^3.2.1"
|
||||
},
|
||||
|
|
|
@ -3,11 +3,11 @@ import * as core from '@actions/core';
|
|||
import * as exec from '@actions/exec';
|
||||
import * as io from '@actions/io';
|
||||
import * as hc from '@actions/http-client';
|
||||
import {chmodSync} from 'fs';
|
||||
import fs, {chmodSync} from 'fs';
|
||||
import path from 'path';
|
||||
import os from 'os';
|
||||
import semver from 'semver';
|
||||
import {IS_WINDOWS, PLATFORM} from './utils';
|
||||
import {IS_WINDOWS, isSelfHosted, PLATFORM} from './utils';
|
||||
import {QualityOptions} from './setup-dotnet';
|
||||
|
||||
export interface DotnetVersion {
|
||||
|
@ -215,11 +215,23 @@ export class DotnetInstallScript {
|
|||
}
|
||||
}
|
||||
|
||||
// Workaround for slow installation on Windows with network attached C: drive
|
||||
// see https://github.com/actions/setup-dotnet/issues/260
|
||||
const fixWindowsInstallDir = (installDir: string): string => {
|
||||
if (!isSelfHosted() && fs.existsSync('d:\\')) {
|
||||
return installDir.replace(/^[cC]:\\/, 'd:\\');
|
||||
} else {
|
||||
return installDir;
|
||||
}
|
||||
};
|
||||
|
||||
export abstract class DotnetInstallDir {
|
||||
private static readonly default = {
|
||||
linux: '/usr/share/dotnet',
|
||||
mac: path.join(process.env['HOME'] + '', '.dotnet'),
|
||||
windows: path.join(process.env['PROGRAMFILES'] + '', 'dotnet')
|
||||
windows: fixWindowsInstallDir(
|
||||
path.join(process.env['PROGRAMFILES'] + '', 'dotnet')
|
||||
)
|
||||
};
|
||||
|
||||
public static readonly dirPath = process.env['DOTNET_INSTALL_DIR']
|
||||
|
|
|
@ -4,3 +4,7 @@ export const PLATFORM = ((): 'windows' | 'linux' | 'mac' => {
|
|||
if (process.platform === 'linux') return 'linux';
|
||||
return 'mac';
|
||||
})();
|
||||
export const isSelfHosted = (): boolean =>
|
||||
process.env['AGENT_ISSELFHOSTED'] === '1' ||
|
||||
(process.env['AGENT_ISSELFHOSTED'] === undefined &&
|
||||
process.env['RUNNER_ENVIRONMENT'] !== 'github-hosted');
|
||||
|
|
Loading…
Reference in New Issue