Merge branch 'actions:main' into update-contributors-guide

This commit is contained in:
Evgenii Korolevskii 2022-08-10 16:42:02 +02:00 committed by GitHub
commit 2f75d1de25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 33 additions and 29 deletions

View File

@ -30,7 +30,7 @@ jobs:
cache: npm cache: npm
- name: Install dependencies - name: Install dependencies
run: npm ci run: npm ci --ignore-scripts
- name: Rebuild the dist/ directory - name: Rebuild the dist/ directory
run: npm run build run: npm run build

View File

@ -15,7 +15,7 @@ jobs:
name: Check licenses name: Check licenses
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- run: npm ci - run: npm ci --ignore-scripts
- name: Install licensed - name: Install licensed
run: | run: |
cd $RUNNER_TEMP cd $RUNNER_TEMP

View File

@ -26,14 +26,14 @@ jobs:
with: with:
node-version: 16.x node-version: 16.x
cache: npm cache: npm
- run: npm ci - run: npm ci --ignore-scripts
- run: npm run build - run: npm run build
- run: npm run format-check - run: npm run format-check
- run: npm test - run: npm test
- name: Verify no unstaged changes - name: Verify no unstaged changes
if: runner.os != 'windows' if: runner.os != 'windows'
run: __tests__/verify-no-unstaged-changes.sh run: __tests__/verify-no-unstaged-changes.sh
test-setup-multiple-versions: test-setup-multiple-versions:
runs-on: ${{ matrix.operating-system }} runs-on: ${{ matrix.operating-system }}
strategy: strategy:
@ -50,9 +50,9 @@ jobs:
uses: ./ uses: ./
with: with:
dotnet-version: | dotnet-version: |
2.2.402 2.2.402
3.1.404 3.1.404
3.0.x 3.0.x
- name: Verify dotnet - name: Verify dotnet
shell: pwsh shell: pwsh
run: __tests__/verify-dotnet.ps1 2.2.402 3.1.404 '3.0' run: __tests__/verify-dotnet.ps1 2.2.402 3.1.404 '3.0'
@ -114,7 +114,7 @@ jobs:
- name: Verify dotnet - name: Verify dotnet
shell: pwsh shell: pwsh
run: __tests__/verify-dotnet.ps1 3.1 2.2 run: __tests__/verify-dotnet.ps1 3.1 2.2
test-setup-latest-patch-version: test-setup-latest-patch-version:
runs-on: ${{ matrix.operating-system }} runs-on: ${{ matrix.operating-system }}
strategy: strategy:

4
.husky/pre-commit Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npm run format

5
.husky/pre-push Executable file
View File

@ -0,0 +1,5 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
# Tests are not run at push time since they can take 2-4 minutes to complete
npm run format-check

View File

@ -16,6 +16,7 @@ describe('setup-dotnet tests', () => {
process.env.RUNNER_TOOL_CACHE = toolDir; process.env.RUNNER_TOOL_CACHE = toolDir;
process.env.DOTNET_INSTALL_DIR = toolDir; process.env.DOTNET_INSTALL_DIR = toolDir;
process.env.RUNNER_TEMP = tempDir; process.env.RUNNER_TEMP = tempDir;
process.env['INPUT_INCLUDE-PRERELEASE'] = 'false';
await io.rmRF(toolDir); await io.rmRF(toolDir);
await io.rmRF(tempDir); await io.rmRF(tempDir);
}); });

View File

@ -18,6 +18,7 @@ inputs:
include-prerelease: include-prerelease:
description: 'Whether prerelease versions should be matched with non-exact versions (for example 5.0.0-preview.6 being matched by 5, 5.0, 5.x or 5.0.x). Defaults to false if not provided.' description: 'Whether prerelease versions should be matched with non-exact versions (for example 5.0.0-preview.6 being matched by 5, 5.0, 5.x or 5.0.x). Defaults to false if not provided.'
required: False required: False
default: 'false'
runs: runs:
using: 'node16' using: 'node16'
main: 'dist/index.js' main: 'dist/index.js'

3
dist/index.js vendored
View File

@ -478,8 +478,7 @@ function run() {
} }
} }
if (versions.length) { if (versions.length) {
const includePrerelease = (core.getInput('include-prerelease') || 'false').toLowerCase() === const includePrerelease = core.getBooleanInput('include-prerelease');
'true';
let dotnetInstaller; let dotnetInstaller;
for (const version of new Set(versions)) { for (const version of new Set(versions)) {
dotnetInstaller = new installer.DotnetCoreInstaller(version, includePrerelease); dotnetInstaller = new installer.DotnetCoreInstaller(version, includePrerelease);

16
package-lock.json generated
View File

@ -23,7 +23,7 @@
"@types/node": "^16.11.25", "@types/node": "^16.11.25",
"@types/semver": "^6.2.2", "@types/semver": "^6.2.2",
"@vercel/ncc": "^0.33.4", "@vercel/ncc": "^0.33.4",
"husky": "^7.0.2", "husky": "^8.0.1",
"jest": "^27.2.5", "jest": "^27.2.5",
"jest-circus": "^27.2.5", "jest-circus": "^27.2.5",
"prettier": "^1.19.1", "prettier": "^1.19.1",
@ -2305,15 +2305,15 @@
} }
}, },
"node_modules/husky": { "node_modules/husky": {
"version": "7.0.2", "version": "8.0.1",
"resolved": "https://registry.npmjs.org/husky/-/husky-7.0.2.tgz", "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.1.tgz",
"integrity": "sha512-8yKEWNX4z2YsofXAMT7KvA1g8p+GxtB1ffV8XtpAEGuXNAbCV5wdNKH+qTpw8SM9fh4aMPDR+yQuKfgnreyZlg==", "integrity": "sha512-xs7/chUH/CKdOCs7Zy0Aev9e/dKOMZf3K1Az1nar3tzlv0jfqnYtu235bstsWTmXOR0EfINrPa97yy4Lz6RiKw==",
"dev": true, "dev": true,
"bin": { "bin": {
"husky": "lib/bin.js" "husky": "lib/bin.js"
}, },
"engines": { "engines": {
"node": ">=12" "node": ">=14"
}, },
"funding": { "funding": {
"url": "https://github.com/sponsors/typicode" "url": "https://github.com/sponsors/typicode"
@ -6645,9 +6645,9 @@
"dev": true "dev": true
}, },
"husky": { "husky": {
"version": "7.0.2", "version": "8.0.1",
"resolved": "https://registry.npmjs.org/husky/-/husky-7.0.2.tgz", "resolved": "https://registry.npmjs.org/husky/-/husky-8.0.1.tgz",
"integrity": "sha512-8yKEWNX4z2YsofXAMT7KvA1g8p+GxtB1ffV8XtpAEGuXNAbCV5wdNKH+qTpw8SM9fh4aMPDR+yQuKfgnreyZlg==", "integrity": "sha512-xs7/chUH/CKdOCs7Zy0Aev9e/dKOMZf3K1Az1nar3tzlv0jfqnYtu235bstsWTmXOR0EfINrPa97yy4Lz6RiKw==",
"dev": true "dev": true
}, },
"iconv-lite": { "iconv-lite": {

View File

@ -8,16 +8,10 @@
"build": "tsc && ncc build", "build": "tsc && ncc build",
"format": "prettier --write **/*.ts", "format": "prettier --write **/*.ts",
"format-check": "prettier --check **/*.ts", "format-check": "prettier --check **/*.ts",
"prepare": "husky install",
"test": "jest", "test": "jest",
"update-installers": "nwget https://dot.net/v1/dotnet-install.ps1 -O externals/install-dotnet.ps1 && nwget https://dot.net/v1/dotnet-install.sh -O externals/install-dotnet.sh" "update-installers": "nwget https://dot.net/v1/dotnet-install.ps1 -O externals/install-dotnet.ps1 && nwget https://dot.net/v1/dotnet-install.sh -O externals/install-dotnet.sh"
}, },
"husky": {
"hooks": {
"//": "Tests are not run at push time since they can take 2-4 minutes to complete",
"pre-commit": "npm run format",
"pre-push": "npm run format-check"
}
},
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/actions/setup-dotnet.git" "url": "git+https://github.com/actions/setup-dotnet.git"
@ -44,7 +38,7 @@
"@types/node": "^16.11.25", "@types/node": "^16.11.25",
"@types/semver": "^6.2.2", "@types/semver": "^6.2.2",
"@vercel/ncc": "^0.33.4", "@vercel/ncc": "^0.33.4",
"husky": "^7.0.2", "husky": "^8.0.1",
"jest": "^27.2.5", "jest": "^27.2.5",
"jest-circus": "^27.2.5", "jest-circus": "^27.2.5",
"prettier": "^1.19.1", "prettier": "^1.19.1",

View File

@ -38,9 +38,9 @@ export async function run() {
} }
if (versions.length) { if (versions.length) {
const includePrerelease: boolean = const includePrerelease: boolean = core.getBooleanInput(
(core.getInput('include-prerelease') || 'false').toLowerCase() === 'include-prerelease'
'true'; );
let dotnetInstaller!: installer.DotnetCoreInstaller; let dotnetInstaller!: installer.DotnetCoreInstaller;
for (const version of new Set<string>(versions)) { for (const version of new Set<string>(versions)) {
dotnetInstaller = new installer.DotnetCoreInstaller( dotnetInstaller = new installer.DotnetCoreInstaller(