mirror of
https://github.com/actions/setup-dotnet.git
synced 2026-03-22 22:52:17 +08:00
Compare commits
77 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
51f68377c1 | ||
|
|
7a98346f51 | ||
|
|
9d7c66c348 | ||
|
|
a1c7110c2a | ||
|
|
352338157c | ||
|
|
3569a93d9f | ||
|
|
985d576ba0 | ||
|
|
52dbd90938 | ||
|
|
d50c2980a5 | ||
|
|
b409ac80d1 | ||
|
|
4f53c95c39 | ||
|
|
bc0200672b | ||
|
|
3fdf140cf1 | ||
|
|
221e7bcc3b | ||
|
|
37b9e8b54a | ||
|
|
bedd981d16 | ||
|
|
422ae8cdee | ||
|
|
e3d81d9453 | ||
|
|
c7a4f4e270 | ||
|
|
55885b7a99 | ||
|
|
7a84008633 | ||
|
|
b8681684f4 | ||
|
|
908a1a8267 | ||
|
|
9e01770f11 | ||
|
|
9bdaa47c80 | ||
|
|
7621179156 | ||
|
|
81ca5f786c | ||
|
|
257d9b2a19 | ||
|
|
61ee7d7a72 | ||
|
|
3af4b91f2c | ||
|
|
fe319a6b7f | ||
|
|
20a4db787c | ||
|
|
80a21d447c | ||
|
|
4114018c87 | ||
|
|
7df9f59802 | ||
|
|
a4ec20650e | ||
|
|
b7a80c5d92 | ||
|
|
3648b37cf8 | ||
|
|
73683e5d2f | ||
|
|
232f64b253 | ||
|
|
5091cc16d9 | ||
|
|
a40afdb08e | ||
|
|
3c9d15de90 | ||
|
|
400e687804 | ||
|
|
8388fb6ff7 | ||
|
|
6efb2bd78f | ||
|
|
e169331466 | ||
|
|
40390722c2 | ||
|
|
fe5534da38 | ||
|
|
983c8ef1bd | ||
|
|
a8eaac54ab | ||
|
|
82b9a8ff02 | ||
|
|
392189ddd3 | ||
|
|
db2ebd0903 | ||
|
|
7895df17cc | ||
|
|
308b9ff32c | ||
|
|
a0982bfd3a | ||
|
|
994f136361 | ||
|
|
7b228edf43 | ||
|
|
3894eede2d | ||
|
|
3de417d35c | ||
|
|
c5ee7a1134 | ||
|
|
4051f74532 | ||
|
|
3eb0d2f3dd | ||
|
|
08fb271bd7 | ||
|
|
3426e11858 | ||
|
|
ebefd7bccb | ||
|
|
5411b6342a | ||
|
|
a5cce9bf9f | ||
|
|
561f9e2075 | ||
|
|
fd402244d0 | ||
|
|
00f2601192 | ||
|
|
cf5f899a30 | ||
|
|
553ff3fdfc | ||
|
|
8b1e9ddf26 | ||
|
|
db362d751e | ||
|
|
3280df5864 |
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
.licenses/** -diff linguist-generated=true
|
||||||
23
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
23
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Create a bug report
|
||||||
|
title: ''
|
||||||
|
labels: ''
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Description
|
||||||
|
|
||||||
|
<!--
|
||||||
|
* Please share short description of the problem
|
||||||
|
-->
|
||||||
|
|
||||||
|
### Details
|
||||||
|
|
||||||
|
<!--
|
||||||
|
* Include the relevant yaml, platform, and dotnet versions in use
|
||||||
|
* If an error occurred on a public action, please share a link
|
||||||
|
* Include any error messages received in text (search does not work for images)
|
||||||
|
* Was this a regression from previous behavior?
|
||||||
|
-->
|
||||||
5
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
5
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
blank_issues_enabled: true
|
||||||
|
contact_links:
|
||||||
|
- name: .NET issues
|
||||||
|
url: https://github.com/dotnet/runtime#filing-issues
|
||||||
|
about: Issues with the runtime, class libraries, frameworks, and SDK should be addressed directly with the .NET team. Documentation on filing issues can be found here.
|
||||||
20
.github/workflows/licensed.yml
vendored
Normal file
20
.github/workflows/licensed.yml
vendored
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
name: Licensed
|
||||||
|
|
||||||
|
on:
|
||||||
|
push: {branches: main}
|
||||||
|
pull_request: {branches: main}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Check licenses
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- run: npm ci
|
||||||
|
- name: Install licensed
|
||||||
|
run: |
|
||||||
|
cd $RUNNER_TEMP
|
||||||
|
curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/2.12.2/licensed-2.12.2-linux-x64.tar.gz
|
||||||
|
sudo tar -xzf licensed.tar.gz
|
||||||
|
sudo mv licensed /usr/local/bin/licensed
|
||||||
|
- run: licensed status
|
||||||
190
.github/workflows/workflow.yml
vendored
190
.github/workflows/workflow.yml
vendored
@@ -1,26 +1,188 @@
|
|||||||
name: Main workflow
|
name: Main workflow
|
||||||
on: [push, pull_request]
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
- releases/*
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
run:
|
build:
|
||||||
name: Run
|
|
||||||
runs-on: ${{ matrix.operating-system }}
|
runs-on: ${{ matrix.operating-system }}
|
||||||
strategy:
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
|
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@master
|
uses: actions/checkout@v2
|
||||||
|
- name: Set Node.js 12
|
||||||
- name: Set Node.js 10.x
|
uses: actions/setup-node@v1
|
||||||
uses: actions/setup-node@master
|
|
||||||
with:
|
with:
|
||||||
version: 10.x
|
node-version: 12.x
|
||||||
|
- run: npm ci
|
||||||
|
- run: npm run build
|
||||||
|
- run: npm run format-check
|
||||||
|
- run: npm test
|
||||||
|
- name: Verify no unstaged changes
|
||||||
|
if: runner.os != 'windows'
|
||||||
|
run: __tests__/verify-no-unstaged-changes.sh
|
||||||
|
|
||||||
- name: npm install
|
test:
|
||||||
run: npm install
|
runs-on: ${{ matrix.operating-system }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Clear tool cache (macOS)
|
||||||
|
if: runner.os == 'macos'
|
||||||
|
run: |
|
||||||
|
echo $PATH
|
||||||
|
dotnet --info
|
||||||
|
rm -rf "/Users/runner/.dotnet"
|
||||||
|
- name: Clear tool cache (Ubuntu)
|
||||||
|
if: runner.os == 'linux'
|
||||||
|
run: |
|
||||||
|
echo $PATH
|
||||||
|
dotnet --info
|
||||||
|
rm -rf "/usr/share/dotnet"
|
||||||
|
- name: Clear tool cache (Windows)
|
||||||
|
if: runner.os == 'windows'
|
||||||
|
run: |
|
||||||
|
echo $env:PATH
|
||||||
|
dotnet --info
|
||||||
|
Remove-Item $env:LocalAppData\Microsoft\dotnet/* -Recurse -Force -ErrorAction SilentlyContinue
|
||||||
|
Remove-Item "$env:ProgramFiles\dotnet/*" -Recurse -Force -ErrorAction SilentlyContinue
|
||||||
|
# Side-by-side install of 2.2 and 3.1 used for the test project
|
||||||
|
- name: Setup dotnet 2.2.402
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
dotnet-version: 2.2.402
|
||||||
|
- name: Setup dotnet 3.1.201
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
dotnet-version: 3.1.201
|
||||||
|
# We are including this veriable to force the generation of the nuget config file to verify that it is created in the correct place
|
||||||
|
source-url: https://api.nuget.org/v3/index.json
|
||||||
|
env:
|
||||||
|
NUGET_AUTH_TOKEN: NOTATOKEN
|
||||||
|
- name: Verify dotnet
|
||||||
|
if: runner.os != 'windows'
|
||||||
|
run: __tests__/verify-dotnet.sh 3.1.201 2.2.402
|
||||||
|
- name: Verify dotnet (Windows)
|
||||||
|
if: runner.os == 'windows'
|
||||||
|
run: __tests__/verify-dotnet.ps1 3.1.201 2.2.402
|
||||||
|
|
||||||
- name: Lint
|
# Set new cache before 2 digit install
|
||||||
run: npm run format-check
|
- name: Set new tool cache (macOS)
|
||||||
|
if: runner.os == 'macos'
|
||||||
|
run: |
|
||||||
|
echo "DOTNET_INSTALL_DIR=/Users/runner/.dotnet2" >> $GITHUB_ENV
|
||||||
|
- name: Set new tool cache (Ubuntu)
|
||||||
|
if: runner.os == 'linux'
|
||||||
|
run: |
|
||||||
|
echo "DOTNET_INSTALL_DIR=/home/runner/.dotnet2" >> $GITHUB_ENV
|
||||||
|
- name: Set new tool cache (Windows)
|
||||||
|
if: runner.os == 'windows'
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
echo "DOTNET_INSTALL_DIR=$LocalAppData\Microsoft\dotnet2" >> $GITHUB_ENV
|
||||||
|
# 2.0, 3.0, 5.0 needs to be in single quotes to interpret as a string instead of as an integer
|
||||||
|
- name: Setup dotnet '2.0'
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
dotnet-version: '2.0'
|
||||||
|
|
||||||
- name: npm test
|
# Clear cache before .x version install
|
||||||
run: npm test
|
- name: Set new tool cache (macOS)
|
||||||
|
if: runner.os == 'macos'
|
||||||
|
run: |
|
||||||
|
echo "DOTNET_INSTALL_DIR=/Users/runner/.dotnet3" >> $GITHUB_ENV
|
||||||
|
- name: Set new tool cache (Ubuntu)
|
||||||
|
if: runner.os == 'linux'
|
||||||
|
run: |
|
||||||
|
echo "DOTNET_INSTALL_DIR=/home/runner/.dotnet3" >> $GITHUB_ENV
|
||||||
|
- name: Set new tool cache (Windows)
|
||||||
|
if: runner.os == 'windows'
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
echo "DOTNET_INSTALL_DIR=$LocalAppData\Microsoft\dotnet3" >> $GITHUB_ENV
|
||||||
|
- name: Setup dotnet 2.0.x
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
dotnet-version: 2.0.x
|
||||||
|
|
||||||
|
# Clear cache before .* version install
|
||||||
|
- name: Set new tool cache (macOS)
|
||||||
|
if: runner.os == 'macos'
|
||||||
|
run: |
|
||||||
|
echo "DOTNET_INSTALL_DIR=/Users/runner/.dotnet4" >> $GITHUB_ENV
|
||||||
|
- name: Set new tool cache (Ubuntu)
|
||||||
|
if: runner.os == 'linux'
|
||||||
|
run: |
|
||||||
|
echo "DOTNET_INSTALL_DIR=/home/runner/.dotnet4" >> $GITHUB_ENV
|
||||||
|
- name: Set new tool cache (Windows)
|
||||||
|
if: runner.os == 'windows'
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
echo "DOTNET_INSTALL_DIR=$LocalAppData\Microsoft\dotnet4" >> $GITHUB_ENV
|
||||||
|
- name: Setup dotnet 2.0.*
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
dotnet-version: 2.0.*
|
||||||
|
|
||||||
|
test-proxy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: mcr.microsoft.com/dotnet/core/runtime-deps:3.0-bionic
|
||||||
|
options: --dns 127.0.0.1
|
||||||
|
services:
|
||||||
|
squid-proxy:
|
||||||
|
image: datadog/squid:latest
|
||||||
|
ports:
|
||||||
|
- 3128:3128
|
||||||
|
env:
|
||||||
|
https_proxy: http://squid-proxy:3128
|
||||||
|
http_proxy: http://squid-proxy:3128
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Clear tool cache
|
||||||
|
run: rm -rf "/usr/share/dotnet"
|
||||||
|
- name: Install curl
|
||||||
|
run: |
|
||||||
|
apt update
|
||||||
|
apt -y install curl
|
||||||
|
- name: Setup dotnet 3.1.201
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
dotnet-version: 3.1.201
|
||||||
|
source-url: https://api.nuget.org/v3/index.json
|
||||||
|
env:
|
||||||
|
NUGET_AUTH_TOKEN: NOTATOKEN
|
||||||
|
- name: Verify dotnet
|
||||||
|
run: __tests__/verify-dotnet.sh 3.1.201
|
||||||
|
|
||||||
|
test-bypass-proxy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
https_proxy: http://no-such-proxy:3128
|
||||||
|
no_proxy: github.com,dotnetcli.blob.core.windows.net,download.visualstudio.microsoft.com,api.nuget.org,dotnetcli.azureedge.net
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Clear tool cache
|
||||||
|
run: rm -rf "/usr/share/dotnet"
|
||||||
|
- name: Setup dotnet 3.1.201
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
dotnet-version: 3.1.201
|
||||||
|
source-url: https://api.nuget.org/v3/index.json
|
||||||
|
env:
|
||||||
|
NUGET_AUTH_TOKEN: NOTATOKEN
|
||||||
|
- name: Verify dotnet
|
||||||
|
run: __tests__/verify-dotnet.sh 3.1.201
|
||||||
|
|||||||
11
.gitignore
vendored
11
.gitignore
vendored
@@ -1,6 +1,10 @@
|
|||||||
# Explicitly not ignoring node_modules so that they are included in package downloaded by runner
|
# dev dependencies are *not* checked in
|
||||||
!node_modules/
|
global.json
|
||||||
|
lib/
|
||||||
|
node_modules/
|
||||||
__tests__/runner/*
|
__tests__/runner/*
|
||||||
|
__tests__/sample-csproj/bin/
|
||||||
|
__tests__/sample-csproj/obj/
|
||||||
|
|
||||||
# Rest of the file pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
|
# Rest of the file pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
|
||||||
# Logs
|
# Logs
|
||||||
@@ -91,4 +95,5 @@ typings/
|
|||||||
# DynamoDB Local files
|
# DynamoDB Local files
|
||||||
.dynamodb/
|
.dynamodb/
|
||||||
|
|
||||||
.vscode/*
|
# Ignore .vscode files
|
||||||
|
.vscode/
|
||||||
14
.licensed.yml
Normal file
14
.licensed.yml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
sources:
|
||||||
|
npm: true
|
||||||
|
|
||||||
|
allowed:
|
||||||
|
- apache-2.0
|
||||||
|
- bsd-2-clause
|
||||||
|
- bsd-3-clause
|
||||||
|
- isc
|
||||||
|
- mit
|
||||||
|
- cc0-1.0
|
||||||
|
- unlicense
|
||||||
|
|
||||||
|
reviewed:
|
||||||
|
npm:
|
||||||
BIN
.licenses/npm/@actions/core.dep.yml
generated
Normal file
BIN
.licenses/npm/@actions/core.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@actions/exec.dep.yml
generated
Normal file
BIN
.licenses/npm/@actions/exec.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@actions/github.dep.yml
generated
Normal file
BIN
.licenses/npm/@actions/github.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@actions/http-client.dep.yml
generated
Normal file
BIN
.licenses/npm/@actions/http-client.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@actions/io.dep.yml
generated
Normal file
BIN
.licenses/npm/@actions/io.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@octokit/endpoint.dep.yml
generated
Normal file
BIN
.licenses/npm/@octokit/endpoint.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@octokit/graphql.dep.yml
generated
Normal file
BIN
.licenses/npm/@octokit/graphql.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@octokit/request-error.dep.yml
generated
Normal file
BIN
.licenses/npm/@octokit/request-error.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@octokit/request.dep.yml
generated
Normal file
BIN
.licenses/npm/@octokit/request.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@octokit/rest.dep.yml
generated
Normal file
BIN
.licenses/npm/@octokit/rest.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/atob-lite.dep.yml
generated
Normal file
BIN
.licenses/npm/atob-lite.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/before-after-hook.dep.yml
generated
Normal file
BIN
.licenses/npm/before-after-hook.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/btoa-lite.dep.yml
generated
Normal file
BIN
.licenses/npm/btoa-lite.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/cross-spawn.dep.yml
generated
Normal file
BIN
.licenses/npm/cross-spawn.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/deprecation.dep.yml
generated
Normal file
BIN
.licenses/npm/deprecation.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/end-of-stream.dep.yml
generated
Normal file
BIN
.licenses/npm/end-of-stream.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/execa.dep.yml
generated
Normal file
BIN
.licenses/npm/execa.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/fast-xml-parser.dep.yml
generated
Normal file
BIN
.licenses/npm/fast-xml-parser.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/get-stream.dep.yml
generated
Normal file
BIN
.licenses/npm/get-stream.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/is-plain-object.dep.yml
generated
Normal file
BIN
.licenses/npm/is-plain-object.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/is-stream.dep.yml
generated
Normal file
BIN
.licenses/npm/is-stream.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/isexe.dep.yml
generated
Normal file
BIN
.licenses/npm/isexe.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/isobject.dep.yml
generated
Normal file
BIN
.licenses/npm/isobject.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/lodash.get.dep.yml
generated
Normal file
BIN
.licenses/npm/lodash.get.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/lodash.set.dep.yml
generated
Normal file
BIN
.licenses/npm/lodash.set.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/lodash.uniq.dep.yml
generated
Normal file
BIN
.licenses/npm/lodash.uniq.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/macos-release.dep.yml
generated
Normal file
BIN
.licenses/npm/macos-release.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/nice-try.dep.yml
generated
Normal file
BIN
.licenses/npm/nice-try.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/node-fetch.dep.yml
generated
Normal file
BIN
.licenses/npm/node-fetch.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/npm-run-path.dep.yml
generated
Normal file
BIN
.licenses/npm/npm-run-path.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/octokit-pagination-methods.dep.yml
generated
Normal file
BIN
.licenses/npm/octokit-pagination-methods.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/once.dep.yml
generated
Normal file
BIN
.licenses/npm/once.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/os-name.dep.yml
generated
Normal file
BIN
.licenses/npm/os-name.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/p-finally.dep.yml
generated
Normal file
BIN
.licenses/npm/p-finally.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/path-key.dep.yml
generated
Normal file
BIN
.licenses/npm/path-key.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/pump.dep.yml
generated
Normal file
BIN
.licenses/npm/pump.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/semver-5.7.0.dep.yml
generated
Normal file
BIN
.licenses/npm/semver-5.7.0.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/semver-6.3.0.dep.yml
generated
Normal file
BIN
.licenses/npm/semver-6.3.0.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/shebang-command.dep.yml
generated
Normal file
BIN
.licenses/npm/shebang-command.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/shebang-regex.dep.yml
generated
Normal file
BIN
.licenses/npm/shebang-regex.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/signal-exit.dep.yml
generated
Normal file
BIN
.licenses/npm/signal-exit.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/strip-eof.dep.yml
generated
Normal file
BIN
.licenses/npm/strip-eof.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/tunnel.dep.yml
generated
Normal file
BIN
.licenses/npm/tunnel.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/universal-user-agent-2.1.0.dep.yml
generated
Normal file
BIN
.licenses/npm/universal-user-agent-2.1.0.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/universal-user-agent-4.0.0.dep.yml
generated
Normal file
BIN
.licenses/npm/universal-user-agent-4.0.0.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/which.dep.yml
generated
Normal file
BIN
.licenses/npm/which.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/windows-release.dep.yml
generated
Normal file
BIN
.licenses/npm/windows-release.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/wrappy.dep.yml
generated
Normal file
BIN
.licenses/npm/wrappy.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/xmlbuilder.dep.yml
generated
Normal file
BIN
.licenses/npm/xmlbuilder.dep.yml
generated
Normal file
Binary file not shown.
61
README.md
61
README.md
@@ -10,6 +10,12 @@ This action sets up a [dotnet core cli](https://github.com/dotnet/cli) environme
|
|||||||
- registering problem matchers for error output
|
- registering problem matchers for error output
|
||||||
- setting up authentication to private package sources like GitHub Packages
|
- setting up authentication to private package sources like GitHub Packages
|
||||||
|
|
||||||
|
Please Note: GitHub hosted runners have some versions of the .NET SDK
|
||||||
|
preinstalled. Installed versions are subject to change. Please refer to the
|
||||||
|
documentation
|
||||||
|
[software installed on github hosted runners](https://help.github.com/en/actions/reference/software-installed-on-github-hosted-runners)
|
||||||
|
for .NET SDK versions that are currently available.
|
||||||
|
|
||||||
# Usage
|
# Usage
|
||||||
|
|
||||||
See [action.yml](action.yml)
|
See [action.yml](action.yml)
|
||||||
@@ -17,10 +23,10 @@ See [action.yml](action.yml)
|
|||||||
Basic:
|
Basic:
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@master
|
- uses: actions/checkout@main
|
||||||
- uses: actions/setup-dotnet@v1
|
- uses: actions/setup-dotnet@v1
|
||||||
with:
|
with:
|
||||||
dotnet-version: '3.1.100' # SDK Version to use.
|
dotnet-version: '3.1.x' # SDK Version to use; x will use the latest version of the 3.1 channel
|
||||||
- run: dotnet build <my project>
|
- run: dotnet build <my project>
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -28,13 +34,13 @@ Matrix Testing:
|
|||||||
```yaml
|
```yaml
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-16.04
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
dotnet: [ '2.2.103', '3.0.100', '3.1.100' ]
|
dotnet: [ '2.2.103', '3.0', '3.1.x' ]
|
||||||
name: Dotnet ${{ matrix.dotnet }} sample
|
name: Dotnet ${{ matrix.dotnet }} sample
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@master
|
- uses: actions/checkout@v2
|
||||||
- name: Setup dotnet
|
- name: Setup dotnet
|
||||||
uses: actions/setup-dotnet@v1
|
uses: actions/setup-dotnet@v1
|
||||||
with:
|
with:
|
||||||
@@ -42,14 +48,34 @@ jobs:
|
|||||||
- run: dotnet build <my project>
|
- run: dotnet build <my project>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Side by Side Testing:
|
||||||
|
```yaml
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Dotnet Side by Side testing sample
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Setup dotnet
|
||||||
|
uses: actions/setup-dotnet@v1
|
||||||
|
with:
|
||||||
|
dotnet-version: '2.2.103'
|
||||||
|
- name: Setup dotnet
|
||||||
|
uses: actions/setup-dotnet@v1
|
||||||
|
with:
|
||||||
|
dotnet-version: '3.1.x'
|
||||||
|
- run: dotnet build <my project>
|
||||||
|
- run: dotnet test <my project>
|
||||||
|
```
|
||||||
|
|
||||||
Authentication for nuget feeds:
|
Authentication for nuget feeds:
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@master
|
- uses: actions/checkout@v2
|
||||||
# Authenticates packages to push to GPR
|
# Authenticates packages to push to GPR
|
||||||
- uses: actions/setup-dotnet@v1
|
- uses: actions/setup-dotnet@v1
|
||||||
with:
|
with:
|
||||||
dotnet-version: '3.1.100' # SDK Version to use.
|
dotnet-version: '3.1.x' # SDK Version to use.
|
||||||
source-url: https://nuget.pkg.github.com/<owner>/index.json
|
source-url: https://nuget.pkg.github.com/<owner>/index.json
|
||||||
env:
|
env:
|
||||||
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
||||||
@@ -69,6 +95,27 @@ steps:
|
|||||||
run: dotnet nuget push <my project>/bin/Release/*.nupkg
|
run: dotnet nuget push <my project>/bin/Release/*.nupkg
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Environment Variables to use with dotnet
|
||||||
|
|
||||||
|
Some environment variables may be necessary for your particular case or to improve logging. Some examples are listed below, but the full list with complete details can be found here: https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet#environment-variables
|
||||||
|
|
||||||
|
- DOTNET_NOLOGO - removes logo and telemetry message from first run of dotnet cli (default: false)
|
||||||
|
- DOTNET_CLI_TELEMETRY_OPTOUT - opt-out of telemetry being sent to Microsoft (default: false)
|
||||||
|
- DOTNET_MULTILEVEL_LOOKUP - configures whether the global install location is used as a fall-back (default: true)
|
||||||
|
|
||||||
|
Example usage:
|
||||||
|
```yaml
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
DOTNET_NOLOGO: true
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@main
|
||||||
|
- uses: actions/setup-dotnet@v1
|
||||||
|
with:
|
||||||
|
dotnet-version: '3.1.100' # SDK Version to use.
|
||||||
|
```
|
||||||
|
|
||||||
# License
|
# License
|
||||||
|
|
||||||
The scripts and documentation in this project are released under the [MIT License](LICENSE)
|
The scripts and documentation in this project are released under the [MIT License](LICENSE)
|
||||||
|
|||||||
@@ -75,14 +75,17 @@ const azureartifactsnugetorgNuGetConfig: string = `<?xml version="1.0" encoding=
|
|||||||
const nugetConfigFile = path.join(fakeSourcesDirForTesting, '../nuget.config');
|
const nugetConfigFile = path.join(fakeSourcesDirForTesting, '../nuget.config');
|
||||||
|
|
||||||
process.env['GITHUB_REPOSITORY'] = 'OwnerName/repo';
|
process.env['GITHUB_REPOSITORY'] = 'OwnerName/repo';
|
||||||
process.env['RUNNER_TEMP'] = fakeSourcesDirForTesting;
|
|
||||||
import * as auth from '../src/authutil';
|
import * as auth from '../src/authutil';
|
||||||
|
|
||||||
describe('authutil tests', () => {
|
describe('authutil tests', () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
await io.rmRF(fakeSourcesDirForTesting);
|
await io.rmRF(fakeSourcesDirForTesting);
|
||||||
await io.mkdirP(fakeSourcesDirForTesting);
|
await io.mkdirP(fakeSourcesDirForTesting);
|
||||||
}, 100000);
|
}, 30000);
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
await io.rmRF(fakeSourcesDirForTesting);
|
||||||
|
}, 30000);
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
if (fs.existsSync(nugetConfigFile)) {
|
if (fs.existsSync(nugetConfigFile)) {
|
||||||
@@ -95,7 +98,9 @@ describe('authutil tests', () => {
|
|||||||
it('No existing config, sets up a full NuGet.config with URL and user/PAT for GPR', async () => {
|
it('No existing config, sets up a full NuGet.config with URL and user/PAT for GPR', async () => {
|
||||||
process.env['NUGET_AUTH_TOKEN'] = 'TEST_FAKE_AUTH_TOKEN';
|
process.env['NUGET_AUTH_TOKEN'] = 'TEST_FAKE_AUTH_TOKEN';
|
||||||
await auth.configAuthentication(
|
await auth.configAuthentication(
|
||||||
'https://nuget.pkg.github.com/OwnerName/index.json'
|
'https://nuget.pkg.github.com/OwnerName/index.json',
|
||||||
|
'',
|
||||||
|
fakeSourcesDirForTesting
|
||||||
);
|
);
|
||||||
expect(fs.existsSync(nugetConfigFile)).toBe(true);
|
expect(fs.existsSync(nugetConfigFile)).toBe(true);
|
||||||
expect(
|
expect(
|
||||||
@@ -107,7 +112,9 @@ describe('authutil tests', () => {
|
|||||||
let thrown = false;
|
let thrown = false;
|
||||||
try {
|
try {
|
||||||
await auth.configAuthentication(
|
await auth.configAuthentication(
|
||||||
'https://nuget.pkg.github.com/OwnerName/index.json'
|
'https://nuget.pkg.github.com/OwnerName/index.json',
|
||||||
|
'',
|
||||||
|
fakeSourcesDirForTesting
|
||||||
);
|
);
|
||||||
} catch {
|
} catch {
|
||||||
thrown = true;
|
thrown = true;
|
||||||
@@ -119,7 +126,9 @@ describe('authutil tests', () => {
|
|||||||
process.env['NUGET_AUTH_TOKEN'] = 'TEST_FAKE_AUTH_TOKEN';
|
process.env['NUGET_AUTH_TOKEN'] = 'TEST_FAKE_AUTH_TOKEN';
|
||||||
process.env['INPUT_OWNER'] = 'otherorg';
|
process.env['INPUT_OWNER'] = 'otherorg';
|
||||||
await auth.configAuthentication(
|
await auth.configAuthentication(
|
||||||
'https://nuget.pkg.github.com/otherorg/index.json'
|
'https://nuget.pkg.github.com/otherorg/index.json',
|
||||||
|
'',
|
||||||
|
fakeSourcesDirForTesting
|
||||||
);
|
);
|
||||||
expect(fs.existsSync(nugetConfigFile)).toBe(true);
|
expect(fs.existsSync(nugetConfigFile)).toBe(true);
|
||||||
expect(
|
expect(
|
||||||
@@ -137,7 +146,9 @@ describe('authutil tests', () => {
|
|||||||
let thrown = false;
|
let thrown = false;
|
||||||
try {
|
try {
|
||||||
await auth.configAuthentication(
|
await auth.configAuthentication(
|
||||||
'https://nuget.pkg.github.com/OwnerName/index.json'
|
'https://nuget.pkg.github.com/OwnerName/index.json',
|
||||||
|
'',
|
||||||
|
fakeSourcesDirForTesting
|
||||||
);
|
);
|
||||||
} catch {
|
} catch {
|
||||||
thrown = true;
|
thrown = true;
|
||||||
@@ -153,7 +164,9 @@ describe('authutil tests', () => {
|
|||||||
);
|
);
|
||||||
fs.writeFileSync(inputNuGetConfigPath, emptyNuGetConfig);
|
fs.writeFileSync(inputNuGetConfigPath, emptyNuGetConfig);
|
||||||
await auth.configAuthentication(
|
await auth.configAuthentication(
|
||||||
'https://nuget.pkg.github.com/OwnerName/index.json'
|
'https://nuget.pkg.github.com/OwnerName/index.json',
|
||||||
|
'',
|
||||||
|
fakeSourcesDirForTesting
|
||||||
);
|
);
|
||||||
expect(fs.existsSync(nugetConfigFile)).toBe(true);
|
expect(fs.existsSync(nugetConfigFile)).toBe(true);
|
||||||
expect(
|
expect(
|
||||||
@@ -169,7 +182,9 @@ describe('authutil tests', () => {
|
|||||||
);
|
);
|
||||||
fs.writeFileSync(inputNuGetConfigPath, nugetorgNuGetConfig);
|
fs.writeFileSync(inputNuGetConfigPath, nugetorgNuGetConfig);
|
||||||
await auth.configAuthentication(
|
await auth.configAuthentication(
|
||||||
'https://nuget.pkg.github.com/OwnerName/index.json'
|
'https://nuget.pkg.github.com/OwnerName/index.json',
|
||||||
|
'',
|
||||||
|
fakeSourcesDirForTesting
|
||||||
);
|
);
|
||||||
expect(fs.existsSync(nugetConfigFile)).toBe(true);
|
expect(fs.existsSync(nugetConfigFile)).toBe(true);
|
||||||
expect(
|
expect(
|
||||||
@@ -185,7 +200,9 @@ describe('authutil tests', () => {
|
|||||||
);
|
);
|
||||||
fs.writeFileSync(inputNuGetConfigPath, gprNuGetConfig);
|
fs.writeFileSync(inputNuGetConfigPath, gprNuGetConfig);
|
||||||
await auth.configAuthentication(
|
await auth.configAuthentication(
|
||||||
'https://nuget.pkg.github.com/OwnerName/index.json'
|
'https://nuget.pkg.github.com/OwnerName/index.json',
|
||||||
|
'',
|
||||||
|
fakeSourcesDirForTesting
|
||||||
);
|
);
|
||||||
expect(fs.existsSync(nugetConfigFile)).toBe(true);
|
expect(fs.existsSync(nugetConfigFile)).toBe(true);
|
||||||
expect(
|
expect(
|
||||||
@@ -201,7 +218,9 @@ describe('authutil tests', () => {
|
|||||||
);
|
);
|
||||||
fs.writeFileSync(inputNuGetConfigPath, gprnugetorgNuGetConfig);
|
fs.writeFileSync(inputNuGetConfigPath, gprnugetorgNuGetConfig);
|
||||||
await auth.configAuthentication(
|
await auth.configAuthentication(
|
||||||
'https://nuget.pkg.github.com/OwnerName/index.json'
|
'https://nuget.pkg.github.com/OwnerName/index.json',
|
||||||
|
'',
|
||||||
|
fakeSourcesDirForTesting
|
||||||
);
|
);
|
||||||
expect(fs.existsSync(nugetConfigFile)).toBe(true);
|
expect(fs.existsSync(nugetConfigFile)).toBe(true);
|
||||||
expect(
|
expect(
|
||||||
@@ -216,7 +235,11 @@ describe('authutil tests', () => {
|
|||||||
'nuget.config'
|
'nuget.config'
|
||||||
);
|
);
|
||||||
fs.writeFileSync(inputNuGetConfigPath, twogprNuGetConfig);
|
fs.writeFileSync(inputNuGetConfigPath, twogprNuGetConfig);
|
||||||
await auth.configAuthentication('https://nuget.pkg.github.com');
|
await auth.configAuthentication(
|
||||||
|
'https://nuget.pkg.github.com',
|
||||||
|
'',
|
||||||
|
fakeSourcesDirForTesting
|
||||||
|
);
|
||||||
expect(fs.existsSync(nugetConfigFile)).toBe(true);
|
expect(fs.existsSync(nugetConfigFile)).toBe(true);
|
||||||
expect(
|
expect(
|
||||||
fs.readFileSync(nugetConfigFile, {encoding: 'utf8'})
|
fs.readFileSync(nugetConfigFile, {encoding: 'utf8'})
|
||||||
@@ -233,7 +256,9 @@ describe('authutil tests', () => {
|
|||||||
let thrown = false;
|
let thrown = false;
|
||||||
try {
|
try {
|
||||||
await auth.configAuthentication(
|
await auth.configAuthentication(
|
||||||
'https://nuget.pkg.github.com/OwnerName/index.json'
|
'https://nuget.pkg.github.com/OwnerName/index.json',
|
||||||
|
'',
|
||||||
|
fakeSourcesDirForTesting
|
||||||
);
|
);
|
||||||
} catch {
|
} catch {
|
||||||
thrown = true;
|
thrown = true;
|
||||||
@@ -255,7 +280,8 @@ describe('authutil tests', () => {
|
|||||||
fs.writeFileSync(inputNuGetConfigPath, gprNuGetConfig);
|
fs.writeFileSync(inputNuGetConfigPath, gprNuGetConfig);
|
||||||
await auth.configAuthentication(
|
await auth.configAuthentication(
|
||||||
'https://nuget.pkg.github.com/OwnerName/index.json',
|
'https://nuget.pkg.github.com/OwnerName/index.json',
|
||||||
'subfolder/nuget.config'
|
'subfolder/nuget.config',
|
||||||
|
fakeSourcesDirForTesting
|
||||||
);
|
);
|
||||||
expect(fs.existsSync(nugetConfigFile)).toBe(true);
|
expect(fs.existsSync(nugetConfigFile)).toBe(true);
|
||||||
expect(
|
expect(
|
||||||
@@ -271,7 +297,9 @@ describe('authutil tests', () => {
|
|||||||
);
|
);
|
||||||
fs.writeFileSync(inputNuGetConfigPath, azureartifactsNuGetConfig);
|
fs.writeFileSync(inputNuGetConfigPath, azureartifactsNuGetConfig);
|
||||||
await auth.configAuthentication(
|
await auth.configAuthentication(
|
||||||
'https://pkgs.dev.azure.com/amullans/_packaging/GitHubBuilds/nuget/v3/index.json'
|
'https://pkgs.dev.azure.com/amullans/_packaging/GitHubBuilds/nuget/v3/index.json',
|
||||||
|
'',
|
||||||
|
fakeSourcesDirForTesting
|
||||||
);
|
);
|
||||||
expect(fs.existsSync(nugetConfigFile)).toBe(true);
|
expect(fs.existsSync(nugetConfigFile)).toBe(true);
|
||||||
expect(
|
expect(
|
||||||
@@ -287,7 +315,9 @@ describe('authutil tests', () => {
|
|||||||
);
|
);
|
||||||
fs.writeFileSync(inputNuGetConfigPath, azureartifactsnugetorgNuGetConfig);
|
fs.writeFileSync(inputNuGetConfigPath, azureartifactsnugetorgNuGetConfig);
|
||||||
await auth.configAuthentication(
|
await auth.configAuthentication(
|
||||||
'https://pkgs.dev.azure.com/amullans/_packaging/GitHubBuilds/nuget/v3/index.json'
|
'https://pkgs.dev.azure.com/amullans/_packaging/GitHubBuilds/nuget/v3/index.json',
|
||||||
|
'',
|
||||||
|
fakeSourcesDirForTesting
|
||||||
);
|
);
|
||||||
expect(fs.existsSync(nugetConfigFile)).toBe(true);
|
expect(fs.existsSync(nugetConfigFile)).toBe(true);
|
||||||
expect(
|
expect(
|
||||||
@@ -298,7 +328,9 @@ describe('authutil tests', () => {
|
|||||||
it('No existing config, sets up a full NuGet.config with URL and token for other source', async () => {
|
it('No existing config, sets up a full NuGet.config with URL and token for other source', async () => {
|
||||||
process.env['NUGET_AUTH_TOKEN'] = 'TEST_FAKE_AUTH_TOKEN';
|
process.env['NUGET_AUTH_TOKEN'] = 'TEST_FAKE_AUTH_TOKEN';
|
||||||
await auth.configAuthentication(
|
await auth.configAuthentication(
|
||||||
'https://pkgs.dev.azure.com/amullans/_packaging/GitHubBuilds/nuget/v3/index.json'
|
'https://pkgs.dev.azure.com/amullans/_packaging/GitHubBuilds/nuget/v3/index.json',
|
||||||
|
'',
|
||||||
|
fakeSourcesDirForTesting
|
||||||
);
|
);
|
||||||
expect(fs.existsSync(nugetConfigFile)).toBe(true);
|
expect(fs.existsSync(nugetConfigFile)).toBe(true);
|
||||||
expect(
|
expect(
|
||||||
|
|||||||
23
__tests__/csc.test.ts
Normal file
23
__tests__/csc.test.ts
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import fs = require('fs');
|
||||||
|
|
||||||
|
describe('csc tests', () => {
|
||||||
|
it('Valid regular expression', async () => {
|
||||||
|
var cscFile = require('../.github/csc.json');
|
||||||
|
var regex = cscFile['problemMatcher'][0]['pattern'][0]['regexp'];
|
||||||
|
|
||||||
|
console.log(regex);
|
||||||
|
var re = new RegExp(regex);
|
||||||
|
|
||||||
|
// Ideally we would verify that this
|
||||||
|
var stringsToMatch = [
|
||||||
|
'Program.cs(10,79): error CS1002: ; expected [/Users/zacharyeisinger/Documents/repo/setup-dotnet/__tests__/sample-broken-csproj/sample.csproj]',
|
||||||
|
"S:\\Msbuild\\src\\Build\\Evaluation\\ExpressionShredder.cs(33,7): error CS1003: Syntax error, ',' expected [S:\\msbuild\\src\\Build\\Microsoft.Build.csproj > Properties:prop]"
|
||||||
|
];
|
||||||
|
|
||||||
|
stringsToMatch.forEach(string => {
|
||||||
|
var matchStr = string.match(re);
|
||||||
|
console.log(matchStr);
|
||||||
|
expect(matchStr).toEqual(expect.anything());
|
||||||
|
});
|
||||||
|
}, 10000);
|
||||||
|
});
|
||||||
@@ -2,7 +2,7 @@ import io = require('@actions/io');
|
|||||||
import fs = require('fs');
|
import fs = require('fs');
|
||||||
import os = require('os');
|
import os = require('os');
|
||||||
import path = require('path');
|
import path = require('path');
|
||||||
import httpClient = require('typed-rest-client/HttpClient');
|
import hc = require('@actions/http-client');
|
||||||
|
|
||||||
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');
|
||||||
@@ -15,6 +15,10 @@ const IS_WINDOWS = process.platform === 'win32';
|
|||||||
|
|
||||||
describe('installer tests', () => {
|
describe('installer tests', () => {
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
|
process.env.RUNNER_TOOL_CACHE = toolDir;
|
||||||
|
process.env.DOTNET_INSTALL_DIR = toolDir;
|
||||||
|
process.env.RUNNER_TEMP = tempDir;
|
||||||
|
process.env.DOTNET_ROOT = '';
|
||||||
await io.rmRF(toolDir);
|
await io.rmRF(toolDir);
|
||||||
await io.rmRF(tempDir);
|
await io.rmRF(tempDir);
|
||||||
});
|
});
|
||||||
@@ -26,19 +30,40 @@ describe('installer tests', () => {
|
|||||||
} catch {
|
} catch {
|
||||||
console.log('Failed to remove test directories');
|
console.log('Failed to remove test directories');
|
||||||
}
|
}
|
||||||
}, 100000);
|
}, 30000);
|
||||||
|
|
||||||
it('Acquires version of dotnet if no matching version is installed', async () => {
|
it('Acquires version of dotnet if no matching version is installed', async () => {
|
||||||
await getDotnet('2.2.205');
|
await getDotnet('3.1.201');
|
||||||
const dotnetDir = path.join(toolDir, 'dncs', '2.2.205', os.arch());
|
expect(fs.existsSync(path.join(toolDir, 'sdk', '3.1.201'))).toBe(true);
|
||||||
|
|
||||||
expect(fs.existsSync(`${dotnetDir}.complete`)).toBe(true);
|
|
||||||
if (IS_WINDOWS) {
|
if (IS_WINDOWS) {
|
||||||
expect(fs.existsSync(path.join(dotnetDir, 'dotnet.exe'))).toBe(true);
|
expect(fs.existsSync(path.join(toolDir, 'dotnet.exe'))).toBe(true);
|
||||||
} else {
|
} else {
|
||||||
expect(fs.existsSync(path.join(dotnetDir, 'dotnet'))).toBe(true);
|
expect(fs.existsSync(path.join(toolDir, 'dotnet'))).toBe(true);
|
||||||
}
|
}
|
||||||
}, 100000);
|
|
||||||
|
expect(process.env.DOTNET_ROOT).toBeDefined;
|
||||||
|
expect(process.env.PATH).toBeDefined;
|
||||||
|
expect(process.env.DOTNET_ROOT).toBe(toolDir);
|
||||||
|
expect(process.env.PATH?.startsWith(toolDir)).toBe(true);
|
||||||
|
}, 600000); //This needs some time to download on "slower" internet connections
|
||||||
|
|
||||||
|
it('Acquires generic version of dotnet if no matching version is installed', async () => {
|
||||||
|
await getDotnet('3.1');
|
||||||
|
var directory = fs
|
||||||
|
.readdirSync(path.join(toolDir, 'sdk'))
|
||||||
|
.filter(fn => fn.startsWith('3.1.'));
|
||||||
|
expect(directory.length > 0).toBe(true);
|
||||||
|
if (IS_WINDOWS) {
|
||||||
|
expect(fs.existsSync(path.join(toolDir, 'dotnet.exe'))).toBe(true);
|
||||||
|
} else {
|
||||||
|
expect(fs.existsSync(path.join(toolDir, 'dotnet'))).toBe(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
expect(process.env.DOTNET_ROOT).toBeDefined;
|
||||||
|
expect(process.env.PATH).toBeDefined;
|
||||||
|
expect(process.env.DOTNET_ROOT).toBe(toolDir);
|
||||||
|
expect(process.env.PATH?.startsWith(toolDir)).toBe(true);
|
||||||
|
}, 600000); //This needs some time to download on "slower" internet connections
|
||||||
|
|
||||||
it('Throws if no location contains correct dotnet version', async () => {
|
it('Throws if no location contains correct dotnet version', async () => {
|
||||||
let thrown = false;
|
let thrown = false;
|
||||||
@@ -48,40 +73,17 @@ describe('installer tests', () => {
|
|||||||
thrown = true;
|
thrown = true;
|
||||||
}
|
}
|
||||||
expect(thrown).toBe(true);
|
expect(thrown).toBe(true);
|
||||||
}, 100000);
|
}, 30000);
|
||||||
|
|
||||||
it('Uses version of dotnet installed in cache', async () => {
|
|
||||||
const dotnetDir: string = path.join(toolDir, 'dncs', '250.0.0', os.arch());
|
|
||||||
await io.mkdirP(dotnetDir);
|
|
||||||
fs.writeFileSync(`${dotnetDir}.complete`, 'hello');
|
|
||||||
// This will throw if it doesn't find it in the cache (because no such version exists)
|
|
||||||
await getDotnet('250.0.0');
|
|
||||||
return;
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Doesnt use version of dotnet that was only partially installed in cache', async () => {
|
|
||||||
const dotnetDir: string = path.join(toolDir, 'dncs', '251.0.0', os.arch());
|
|
||||||
await io.mkdirP(dotnetDir);
|
|
||||||
let thrown = false;
|
|
||||||
try {
|
|
||||||
// This will throw if it doesn't find it in the cache (because no such version exists)
|
|
||||||
await getDotnet('251.0.0');
|
|
||||||
} catch {
|
|
||||||
thrown = true;
|
|
||||||
}
|
|
||||||
expect(thrown).toBe(true);
|
|
||||||
return;
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Uses an up to date bash download script', async () => {
|
it('Uses an up to date bash download script', async () => {
|
||||||
var httpCallbackClient = new httpClient.HttpClient(
|
const httpCallbackClient = new hc.HttpClient('setup-dotnet-test', [], {
|
||||||
'setup-dotnet-test',
|
allowRetries: true,
|
||||||
[],
|
maxRetries: 3
|
||||||
{}
|
});
|
||||||
);
|
const response: hc.HttpClientResponse = await httpCallbackClient.get(
|
||||||
const response: httpClient.HttpClientResponse = await httpCallbackClient.get(
|
|
||||||
'https://dot.net/v1/dotnet-install.sh'
|
'https://dot.net/v1/dotnet-install.sh'
|
||||||
);
|
);
|
||||||
|
expect(response.message.statusCode).toBe(200);
|
||||||
const upToDateContents: string = await response.readBody();
|
const upToDateContents: string = await response.readBody();
|
||||||
const currentContents: string = fs
|
const currentContents: string = fs
|
||||||
.readFileSync(
|
.readFileSync(
|
||||||
@@ -91,17 +93,17 @@ describe('installer tests', () => {
|
|||||||
expect(normalizeFileContents(currentContents)).toBe(
|
expect(normalizeFileContents(currentContents)).toBe(
|
||||||
normalizeFileContents(upToDateContents)
|
normalizeFileContents(upToDateContents)
|
||||||
);
|
);
|
||||||
}, 100000);
|
}, 30000);
|
||||||
|
|
||||||
it('Uses an up to date powershell download script', async () => {
|
it('Uses an up to date powershell download script', async () => {
|
||||||
var httpCallbackClient = new httpClient.HttpClient(
|
var httpCallbackClient = new hc.HttpClient('setup-dotnet-test', [], {
|
||||||
'setup-dotnet-test',
|
allowRetries: true,
|
||||||
[],
|
maxRetries: 3
|
||||||
{}
|
});
|
||||||
);
|
const response: hc.HttpClientResponse = await httpCallbackClient.get(
|
||||||
const response: httpClient.HttpClientResponse = await httpCallbackClient.get(
|
|
||||||
'https://dot.net/v1/dotnet-install.ps1'
|
'https://dot.net/v1/dotnet-install.ps1'
|
||||||
);
|
);
|
||||||
|
expect(response.message.statusCode).toBe(200);
|
||||||
const upToDateContents: string = await response.readBody();
|
const upToDateContents: string = await response.readBody();
|
||||||
const currentContents: string = fs
|
const currentContents: string = fs
|
||||||
.readFileSync(
|
.readFileSync(
|
||||||
@@ -111,7 +113,7 @@ describe('installer tests', () => {
|
|||||||
expect(normalizeFileContents(currentContents)).toBe(
|
expect(normalizeFileContents(currentContents)).toBe(
|
||||||
normalizeFileContents(upToDateContents)
|
normalizeFileContents(upToDateContents)
|
||||||
);
|
);
|
||||||
}, 100000);
|
}, 30000);
|
||||||
});
|
});
|
||||||
|
|
||||||
function normalizeFileContents(contents: string): string {
|
function normalizeFileContents(contents: string): string {
|
||||||
|
|||||||
15
__tests__/sample-csproj/Program.cs
Normal file
15
__tests__/sample-csproj/Program.cs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace sample_csproj
|
||||||
|
{
|
||||||
|
[TestClass]
|
||||||
|
public class Program
|
||||||
|
{
|
||||||
|
[TestMethod]
|
||||||
|
public void TestMethod1()
|
||||||
|
{
|
||||||
|
Console.WriteLine("Hello, World!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
18
__tests__/sample-csproj/sample.csproj
Normal file
18
__tests__/sample-csproj/sample.csproj
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFrameworks>netcoreapp3.1;netcoreapp2.2</TargetFrameworks>
|
||||||
|
<RootNamespace>sample_csproj</RootNamespace>
|
||||||
|
|
||||||
|
<IsPackable>false</IsPackable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<!-- These packages will be downloaded over the network for testing proxy settings -->
|
||||||
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
|
||||||
|
<PackageReference Include="MSTest.TestAdapter" Version="2.1.0" />
|
||||||
|
<PackageReference Include="MSTest.TestFramework" Version="2.1.0" />
|
||||||
|
<PackageReference Include="coverlet.collector" Version="1.2.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
47
__tests__/setup-dotnet.test.ts
Normal file
47
__tests__/setup-dotnet.test.ts
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
import io = require('@actions/io');
|
||||||
|
import fs = require('fs');
|
||||||
|
import os = require('os');
|
||||||
|
import path = require('path');
|
||||||
|
|
||||||
|
const toolDir = path.join(__dirname, 'runner', 'tools2');
|
||||||
|
const tempDir = path.join(__dirname, 'runner', 'temp2');
|
||||||
|
|
||||||
|
import * as setup from '../src/setup-dotnet';
|
||||||
|
|
||||||
|
const IS_WINDOWS = process.platform === 'win32';
|
||||||
|
|
||||||
|
describe('setup-dotnet tests', () => {
|
||||||
|
beforeAll(async () => {
|
||||||
|
process.env.RUNNER_TOOL_CACHE = toolDir;
|
||||||
|
process.env.DOTNET_INSTALL_DIR = toolDir;
|
||||||
|
process.env.RUNNER_TEMP = tempDir;
|
||||||
|
await io.rmRF(toolDir);
|
||||||
|
await io.rmRF(tempDir);
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(async () => {
|
||||||
|
try {
|
||||||
|
await io.rmRF(path.join(process.cwd(), 'global.json'));
|
||||||
|
await io.rmRF(toolDir);
|
||||||
|
await io.rmRF(tempDir);
|
||||||
|
} catch {
|
||||||
|
console.log('Failed to remove test directories');
|
||||||
|
}
|
||||||
|
}, 30000);
|
||||||
|
|
||||||
|
it('Acquires version of dotnet from global.json if no matching version is installed', async () => {
|
||||||
|
const globalJsonPath = path.join(process.cwd(), 'global.json');
|
||||||
|
const jsonContents = `{${os.EOL}"sdk": {${os.EOL}"version": "3.1.201"${os.EOL}}${os.EOL}}`;
|
||||||
|
if (!fs.existsSync(globalJsonPath)) {
|
||||||
|
fs.writeFileSync(globalJsonPath, jsonContents);
|
||||||
|
}
|
||||||
|
await setup.run();
|
||||||
|
|
||||||
|
expect(fs.existsSync(path.join(toolDir, 'sdk', '3.1.201'))).toBe(true);
|
||||||
|
if (IS_WINDOWS) {
|
||||||
|
expect(fs.existsSync(path.join(toolDir, 'dotnet.exe'))).toBe(true);
|
||||||
|
} else {
|
||||||
|
expect(fs.existsSync(path.join(toolDir, 'dotnet'))).toBe(true);
|
||||||
|
}
|
||||||
|
}, 400000);
|
||||||
|
});
|
||||||
58
__tests__/verify-dotnet.ps1
Executable file
58
__tests__/verify-dotnet.ps1
Executable file
@@ -0,0 +1,58 @@
|
|||||||
|
if (!$args[0])
|
||||||
|
{
|
||||||
|
throw "Must supply dotnet version argument"
|
||||||
|
}
|
||||||
|
|
||||||
|
if (-Not (Test-Path "../nuget.config"))
|
||||||
|
{
|
||||||
|
throw "nuget file not generated correctly"
|
||||||
|
}
|
||||||
|
|
||||||
|
$dotnet = Get-Command dotnet | Select-Object -First 1 | ForEach-Object { $_.Path }
|
||||||
|
Write-Host "Found '$dotnet'"
|
||||||
|
|
||||||
|
$version = & $dotnet --version | Out-String | ForEach-Object { $_.Trim() }
|
||||||
|
Write-Host "Version $version"
|
||||||
|
if ($version -ne $args[0])
|
||||||
|
{
|
||||||
|
Write-Host "PATH='$env:path'"
|
||||||
|
throw "Unexpected version"
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($args[1])
|
||||||
|
{
|
||||||
|
# SDKs are listed on multiple lines with the path afterwards in square brackets
|
||||||
|
$version = & $dotnet --list-sdks | ForEach-Object { $_.SubString(0, $_.IndexOf('[')).Trim() }
|
||||||
|
Write-Host "Version $version"
|
||||||
|
if (-not ($version -contains $args[1]))
|
||||||
|
{
|
||||||
|
Write-Host "PATH='$env:path'"
|
||||||
|
throw "Unexpected version"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "Building sample csproj"
|
||||||
|
& $dotnet build __tests__/sample-csproj/ --no-cache
|
||||||
|
if ($LASTEXITCODE -ne 0)
|
||||||
|
{
|
||||||
|
throw "Unexpected exit code $LASTEXITCODE"
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "Testing compiled app"
|
||||||
|
$sample_output = "$(dotnet test __tests__/sample-csproj/ --no-build)"
|
||||||
|
Write-Host "Sample output: $sample_output"
|
||||||
|
# For Side-by-Side installs we want to run the tests twice, for a single install the tests will run once
|
||||||
|
if ($args[1])
|
||||||
|
{
|
||||||
|
if ($sample_output -notlike "*Test Run Successful.*Test Run Successful.*")
|
||||||
|
{
|
||||||
|
throw "Unexpected output"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($sample_output -notlike "*Test Run Successful.*")
|
||||||
|
{
|
||||||
|
throw "Unexpected output"
|
||||||
|
}
|
||||||
|
}
|
||||||
44
__tests__/verify-dotnet.sh
Executable file
44
__tests__/verify-dotnet.sh
Executable file
@@ -0,0 +1,44 @@
|
|||||||
|
if [ -z "$1" ]; then
|
||||||
|
echo "Must supply dotnet version argument"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f "../nuget.config" ]; then
|
||||||
|
echo "nuget file not generated correctly"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
dotnet_version="$(dotnet --version)"
|
||||||
|
echo "Found dotnet version '$dotnet_version'"
|
||||||
|
if [ -z "$(echo $dotnet_version | grep $1)" ]; then
|
||||||
|
echo "Unexpected version"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$2" ]; then
|
||||||
|
dotnet_version="$(dotnet --list-sdks)"
|
||||||
|
echo "Found dotnet version '$dotnet_version'"
|
||||||
|
if [ -z "$(echo $dotnet_version | grep $2)" ]; then
|
||||||
|
echo "Unexpected version"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Building sample csproj"
|
||||||
|
dotnet build __tests__/sample-csproj/ --no-cache || exit 1
|
||||||
|
|
||||||
|
echo "Testing compiled app"
|
||||||
|
sample_output=$(dotnet test __tests__/sample-csproj/ --no-build)
|
||||||
|
echo "Sample output: $sample_output"
|
||||||
|
# For Side-by-Side installs we want to run the tests twice, for a single install the tests will run once
|
||||||
|
if [ -n "$2" ]; then
|
||||||
|
if [ -z "$(echo $sample_output | grep "Test Run Successful.*Test Run Successful.")" ]; then
|
||||||
|
echo "Unexpected output"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [ -z "$(echo $sample_output | grep "Test Run Successful.")" ]; then
|
||||||
|
echo "Unexpected output"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
17
__tests__/verify-no-unstaged-changes.sh
Executable file
17
__tests__/verify-no-unstaged-changes.sh
Executable file
@@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [[ "$(git status --porcelain)" != "" ]]; then
|
||||||
|
echo ----------------------------------------
|
||||||
|
echo git status
|
||||||
|
echo ----------------------------------------
|
||||||
|
git status
|
||||||
|
echo ----------------------------------------
|
||||||
|
echo git diff
|
||||||
|
echo ----------------------------------------
|
||||||
|
git diff
|
||||||
|
echo ----------------------------------------
|
||||||
|
echo Troubleshooting
|
||||||
|
echo ----------------------------------------
|
||||||
|
echo "::error::Unstaged changes detected. Locally try running: git clean -ffdx && npm ci && npm run pre-checkin"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
90
__tests__/versionutil.test.ts
Normal file
90
__tests__/versionutil.test.ts
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
import each from 'jest-each';
|
||||||
|
import * as installer from '../src/installer';
|
||||||
|
|
||||||
|
describe('version tests', () => {
|
||||||
|
each(['3.1.999', '3.1.101-preview.3']).test(
|
||||||
|
"Exact version '%s' should be the same",
|
||||||
|
vers => {
|
||||||
|
let versInfo = new installer.DotNetVersionInfo(vers);
|
||||||
|
|
||||||
|
expect(versInfo.isExactVersion()).toBe(true);
|
||||||
|
expect(versInfo.version()).toBe(vers);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
each([
|
||||||
|
['3.1.x', '3.1'],
|
||||||
|
['1.1.*', '1.1'],
|
||||||
|
['2.0', '2.0']
|
||||||
|
]).test("Generic version '%s' should be '%s'", (vers, resVers) => {
|
||||||
|
let versInfo = new installer.DotNetVersionInfo(vers);
|
||||||
|
|
||||||
|
expect(versInfo.isExactVersion()).toBe(false);
|
||||||
|
expect(versInfo.version()).toBe(resVers);
|
||||||
|
});
|
||||||
|
|
||||||
|
each([
|
||||||
|
'',
|
||||||
|
'.',
|
||||||
|
'..',
|
||||||
|
' . ',
|
||||||
|
'. ',
|
||||||
|
' .',
|
||||||
|
' . . ',
|
||||||
|
' .. ',
|
||||||
|
' . ',
|
||||||
|
'-1.-1',
|
||||||
|
'-1',
|
||||||
|
'-1.-1.-1',
|
||||||
|
'..3',
|
||||||
|
'1..3',
|
||||||
|
'1..',
|
||||||
|
'.2.3',
|
||||||
|
'.2.x',
|
||||||
|
'1',
|
||||||
|
'2.x',
|
||||||
|
'*.*.1',
|
||||||
|
'*.1',
|
||||||
|
'*.',
|
||||||
|
'1.2.',
|
||||||
|
'1.2.-abc',
|
||||||
|
'a.b',
|
||||||
|
'a.b.c',
|
||||||
|
'a.b.c-preview',
|
||||||
|
' 0 . 1 . 2 '
|
||||||
|
]).test("Malformed version '%s' should throw", vers => {
|
||||||
|
expect(() => new installer.DotNetVersionInfo(vers)).toThrow();
|
||||||
|
});
|
||||||
|
|
||||||
|
each([
|
||||||
|
['3.1.x', '3.1.'],
|
||||||
|
['3.1.*', '3.1.'],
|
||||||
|
['3.1', '3.1.'],
|
||||||
|
['5.0.0-preview.6', '5.0.0-preview.6'],
|
||||||
|
['3.1.201', '3.1.201']
|
||||||
|
]).test(
|
||||||
|
"Resolving version '%s' as '%s'",
|
||||||
|
async (input, expectedVersion) => {
|
||||||
|
const dotnetInstaller = new installer.DotnetCoreInstaller(input);
|
||||||
|
let versInfo = await dotnetInstaller.resolveVersion(
|
||||||
|
new installer.DotNetVersionInfo(input)
|
||||||
|
);
|
||||||
|
console.log(versInfo);
|
||||||
|
|
||||||
|
expect(versInfo.startsWith(expectedVersion));
|
||||||
|
},
|
||||||
|
100000
|
||||||
|
);
|
||||||
|
|
||||||
|
it('Resolving a nonexistent generic version fails', async () => {
|
||||||
|
const dotnetInstaller = new installer.DotnetCoreInstaller('999.1.x');
|
||||||
|
try {
|
||||||
|
await dotnetInstaller.resolveVersion(
|
||||||
|
new installer.DotNetVersionInfo('999.1.x')
|
||||||
|
);
|
||||||
|
fail();
|
||||||
|
} catch {
|
||||||
|
expect(true);
|
||||||
|
}
|
||||||
|
}, 100000);
|
||||||
|
});
|
||||||
10
action.yml
10
action.yml
@@ -4,19 +4,15 @@ author: 'GitHub'
|
|||||||
branding:
|
branding:
|
||||||
icon: play
|
icon: play
|
||||||
color: green
|
color: green
|
||||||
inputs:
|
inputs:
|
||||||
dotnet-version:
|
dotnet-version:
|
||||||
description: 'SDK version to use. Example: 2.2.104'
|
description: 'SDK version to use. Examples: 2.2.104, 3.1, 3.1.x'
|
||||||
source-url:
|
source-url:
|
||||||
description: 'Optional package source for which to set up authentication. Will consult any existing NuGet.config in the root of the repo and provide a temporary NuGet.config using the NUGET_AUTH_TOKEN environment variable as a ClearTextPassword'
|
description: 'Optional package source for which to set up authentication. Will consult any existing NuGet.config in the root of the repo and provide a temporary NuGet.config using the NUGET_AUTH_TOKEN environment variable as a ClearTextPassword'
|
||||||
owner:
|
owner:
|
||||||
description: 'Optional OWNER for using packages from GitHub Package Registry organizations/users other than the current repository''s owner. Only used if a GPR URL is also provided in source-url'
|
description: 'Optional OWNER for using packages from GitHub Package Registry organizations/users other than the current repository''s owner. Only used if a GPR URL is also provided in source-url'
|
||||||
config-file:
|
config-file:
|
||||||
description: 'Optional NuGet.config location, if your NuGet.config isn''t located in the root of the repo.'
|
description: 'Optional NuGet.config location, if your NuGet.config isn''t located in the root of the repo.'
|
||||||
# Deprecated option, do not use. Will not be supported after October 1, 2019
|
|
||||||
version:
|
|
||||||
description: 'Deprecated. Use dotnet-version instead. Will not be supported after October 1, 2019'
|
|
||||||
deprecationMessage: 'The version property will not be supported after October 1, 2019. Use dotnet-version instead'
|
|
||||||
runs:
|
runs:
|
||||||
using: 'node12'
|
using: 'node12'
|
||||||
main: 'lib/setup-dotnet.js'
|
main: 'dist/index.js'
|
||||||
|
|||||||
22055
dist/index.js
vendored
Normal file
22055
dist/index.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -1,17 +1,24 @@
|
|||||||
# Contributors
|
# Contributors
|
||||||
|
|
||||||
|
Thank you for contributing! This action is targetted around setting up the dotnet cli and related sdks for GitHub actions. As part of that we use proxy settings (for self-hosted runners) and set-up nuget authentication for private feeds.
|
||||||
|
|
||||||
# Checkin
|
If you would like to contribute there are a few things to consider:
|
||||||
|
|
||||||
- Do checkin source (src)
|
## Commands to use
|
||||||
- Do checkin build output (lib)
|
|
||||||
- Do checkin runtime node_modules
|
|
||||||
- Do not checkin
|
|
||||||
|
|
||||||
# Adding a dev dependency
|
- npm run build - Compiles the action into a single js file at dist/index.js (Please check in the changes made by this command)
|
||||||
|
- npm run test - Runs all tests under __tests__
|
||||||
|
- npm run format - Runs formatting required to pass the lint test (Please check in the changes made by this command)
|
||||||
|
- npm run update-installers - Updates the install-dotnet scripts in externals (Please check in the changes made by this command)
|
||||||
|
|
||||||
Remember to update .gitignore.
|
## To check in or not to check in
|
||||||
|
|
||||||
# Updating toolkit dependency
|
- Do check in source (src)
|
||||||
|
- Do check in index file (dist)
|
||||||
|
- Do check in updates to install-dotnet scripts (externals)
|
||||||
|
- Do not check in build output (lib)
|
||||||
|
- Do not check in runtime (node_modules)
|
||||||
|
|
||||||
Until released publically, update tgz packages in toolkit
|
## Writing tests
|
||||||
|
|
||||||
|
With any contribution please take time to consider how this can be tested to maintain high quality. Current tests can be found in the folder __tests__ for examples.
|
||||||
|
|||||||
192
externals/get-os-distro.sh
vendored
192
externals/get-os-distro.sh
vendored
@@ -1,192 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
# Copyright (c) .NET Foundation and contributors. All rights reserved.
|
|
||||||
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
||||||
#
|
|
||||||
|
|
||||||
# Stop script on NZEC
|
|
||||||
set -e
|
|
||||||
# Stop script if unbound variable found (use ${var:-} if intentional)
|
|
||||||
set -u
|
|
||||||
# By default cmd1 | cmd2 returns exit code of cmd2 regardless of cmd1 success
|
|
||||||
# This is causing it to fail
|
|
||||||
set -o pipefail
|
|
||||||
|
|
||||||
# Use in the the functions: eval $invocation
|
|
||||||
invocation='say_verbose "Calling: ${yellow:-}${FUNCNAME[0]} ${green:-}$*${normal:-}"'
|
|
||||||
|
|
||||||
# standard output may be used as a return value in the functions
|
|
||||||
# we need a way to write text on the screen in the functions so that
|
|
||||||
# it won't interfere with the return value.
|
|
||||||
# Exposing stream 3 as a pipe to standard output of the script itself
|
|
||||||
exec 3>&1
|
|
||||||
|
|
||||||
say_err() {
|
|
||||||
printf "%b\n" "get-os-distro: Error: $1" >&2
|
|
||||||
}
|
|
||||||
|
|
||||||
# This platform list is finite - if the SDK/Runtime has supported Linux distribution-specific assets,
|
|
||||||
# then and only then should the Linux distribution appear in this list.
|
|
||||||
# Adding a Linux distribution to this list does not imply distribution-specific support.
|
|
||||||
get_legacy_os_name_from_platform() {
|
|
||||||
|
|
||||||
platform="$1"
|
|
||||||
case "$platform" in
|
|
||||||
"centos.7")
|
|
||||||
echo "centos"
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
"debian.8")
|
|
||||||
echo "debian"
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
"fedora.23")
|
|
||||||
echo "fedora.23"
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
"fedora.27")
|
|
||||||
echo "fedora.27"
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
"fedora.24")
|
|
||||||
echo "fedora.24"
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
"opensuse.13.2")
|
|
||||||
echo "opensuse.13.2"
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
"opensuse.42.1")
|
|
||||||
echo "opensuse.42.1"
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
"opensuse.42.3")
|
|
||||||
echo "opensuse.42.3"
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
"rhel.7"*)
|
|
||||||
echo "rhel"
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
"ubuntu.14.04")
|
|
||||||
echo "ubuntu"
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
"ubuntu.16.04")
|
|
||||||
echo "ubuntu.16.04"
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
"ubuntu.16.10")
|
|
||||||
echo "ubuntu.16.10"
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
"ubuntu.18.04")
|
|
||||||
echo "ubuntu.18.04"
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
"alpine.3.4.3")
|
|
||||||
echo "alpine"
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
get_linux_platform_name() {
|
|
||||||
|
|
||||||
if [ -e /etc/os-release ]; then
|
|
||||||
. /etc/os-release
|
|
||||||
echo "$ID.$VERSION_ID"
|
|
||||||
return 0
|
|
||||||
elif [ -e /etc/redhat-release ]; then
|
|
||||||
local redhatRelease=$(</etc/redhat-release)
|
|
||||||
if [[ $redhatRelease == "CentOS release 6."* || $redhatRelease == "Red Hat Enterprise Linux Server release 6."* ]]; then
|
|
||||||
echo "rhel.6"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
say_err "Linux specific platform name and version could not be detected: UName = $uname"
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
get_current_os_name() {
|
|
||||||
|
|
||||||
local uname=$(uname)
|
|
||||||
if [ "$uname" = "Darwin" ]; then
|
|
||||||
echo "osx"
|
|
||||||
return 0
|
|
||||||
elif [ "$uname" = "Linux" ]; then
|
|
||||||
local linux_platform_name
|
|
||||||
linux_platform_name="$(get_linux_platform_name)" || { echo "linux" && return 0 ; }
|
|
||||||
|
|
||||||
if [[ $linux_platform_name == "rhel.6" ]]; then
|
|
||||||
echo "$linux_platform_name"
|
|
||||||
return 0
|
|
||||||
elif [[ $linux_platform_name == alpine* ]]; then
|
|
||||||
echo "linux-musl"
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
echo "linux"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
say_err "OS name could not be detected: UName = $uname"
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
get_legacy_os_name() {
|
|
||||||
|
|
||||||
local uname=$(uname)
|
|
||||||
if [ "$uname" = "Darwin" ]; then
|
|
||||||
echo "osx"
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
if [ -e /etc/os-release ]; then
|
|
||||||
. /etc/os-release
|
|
||||||
os=$(get_legacy_os_name_from_platform "$ID.$VERSION_ID" || echo "")
|
|
||||||
if [ -n "$os" ]; then
|
|
||||||
echo "$os"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
say_err "Distribution specific OS name and version could not be detected: UName = $uname"
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
get_machine_architecture() {
|
|
||||||
|
|
||||||
if command -v uname > /dev/null; then
|
|
||||||
CPUName=$(uname -m)
|
|
||||||
case $CPUName in
|
|
||||||
armv7l)
|
|
||||||
echo "arm"
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
aarch64)
|
|
||||||
echo "arm64"
|
|
||||||
return 0
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Always default to 'x64'
|
|
||||||
echo "x64"
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
osName=$(get_current_os_name || echo "")
|
|
||||||
legacyOsName=$(get_legacy_os_name || echo "")
|
|
||||||
arch=$(get_machine_architecture || echo "")
|
|
||||||
|
|
||||||
primaryName="$osName-$arch"
|
|
||||||
legacyName="$legacyOsName"
|
|
||||||
|
|
||||||
echo "Primary:$primaryName"
|
|
||||||
echo "Legacy:$legacyName"
|
|
||||||
|
|
||||||
if [ -z "$osName" ] && [ -z "$legacyOsName" ];then
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
18
externals/get-os-platform.ps1
vendored
18
externals/get-os-platform.ps1
vendored
@@ -1,18 +0,0 @@
|
|||||||
function Get-Machine-Architecture()
|
|
||||||
{
|
|
||||||
# possible values: AMD64, IA64, x86
|
|
||||||
return $ENV:PROCESSOR_ARCHITECTURE
|
|
||||||
}
|
|
||||||
|
|
||||||
function Get-CLIArchitecture-From-Architecture([string]$Architecture)
|
|
||||||
{
|
|
||||||
switch ($Architecture.ToLower())
|
|
||||||
{
|
|
||||||
{ ($_ -eq "amd64") -or ($_ -eq "x64") } { return "x64" }
|
|
||||||
{ $_ -eq "x86" } { return "x86" }
|
|
||||||
default { throw "Architecture not supported. If you think this is a bug, please report it at https://github.com/dotnet/cli/issues" }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$CLIArchitecture = Get-CLIArchitecture-From-Architecture $(Get-Machine-Architecture)
|
|
||||||
Write-Output "Primary:win-$CLIArchitecture"
|
|
||||||
1597
externals/install-dotnet.ps1
vendored
1597
externals/install-dotnet.ps1
vendored
File diff suppressed because it is too large
Load Diff
13
externals/install-dotnet.sh
vendored
Normal file → Executable file
13
externals/install-dotnet.sh
vendored
Normal file → Executable file
@@ -172,7 +172,7 @@ get_current_os_name() {
|
|||||||
return 0
|
return 0
|
||||||
elif [ "$uname" = "FreeBSD" ]; then
|
elif [ "$uname" = "FreeBSD" ]; then
|
||||||
echo "freebsd"
|
echo "freebsd"
|
||||||
return 0
|
return 0
|
||||||
elif [ "$uname" = "Linux" ]; then
|
elif [ "$uname" = "Linux" ]; then
|
||||||
local linux_platform_name
|
local linux_platform_name
|
||||||
linux_platform_name="$(get_linux_platform_name)" || { echo "linux" && return 0 ; }
|
linux_platform_name="$(get_linux_platform_name)" || { echo "linux" && return 0 ; }
|
||||||
@@ -728,11 +728,12 @@ downloadcurl() {
|
|||||||
# Append feed_credential as late as possible before calling curl to avoid logging feed_credential
|
# Append feed_credential as late as possible before calling curl to avoid logging feed_credential
|
||||||
remote_path="${remote_path}${feed_credential}"
|
remote_path="${remote_path}${feed_credential}"
|
||||||
|
|
||||||
|
local curl_options="--retry 20 --retry-delay 2 --connect-timeout 15 -sSL -f --create-dirs "
|
||||||
local failed=false
|
local failed=false
|
||||||
if [ -z "$out_path" ]; then
|
if [ -z "$out_path" ]; then
|
||||||
curl --retry 10 -sSL -f --create-dirs "$remote_path" || failed=true
|
curl $curl_options "$remote_path" || failed=true
|
||||||
else
|
else
|
||||||
curl --retry 10 -sSL -f --create-dirs -o "$out_path" "$remote_path" || failed=true
|
curl $curl_options -o "$out_path" "$remote_path" || failed=true
|
||||||
fi
|
fi
|
||||||
if [ "$failed" = true ]; then
|
if [ "$failed" = true ]; then
|
||||||
say_verbose "Curl download failed"
|
say_verbose "Curl download failed"
|
||||||
@@ -748,12 +749,12 @@ downloadwget() {
|
|||||||
|
|
||||||
# Append feed_credential as late as possible before calling wget to avoid logging feed_credential
|
# Append feed_credential as late as possible before calling wget to avoid logging feed_credential
|
||||||
remote_path="${remote_path}${feed_credential}"
|
remote_path="${remote_path}${feed_credential}"
|
||||||
|
local wget_options="--tries 20 --waitretry 2 --connect-timeout 15 "
|
||||||
local failed=false
|
local failed=false
|
||||||
if [ -z "$out_path" ]; then
|
if [ -z "$out_path" ]; then
|
||||||
wget -q --tries 10 -O - "$remote_path" || failed=true
|
wget -q $wget_options -O - "$remote_path" || failed=true
|
||||||
else
|
else
|
||||||
wget --tries 10 -O "$out_path" "$remote_path" || failed=true
|
wget $wget_options -O "$out_path" "$remote_path" || failed=true
|
||||||
fi
|
fi
|
||||||
if [ "$failed" = true ]; then
|
if [ "$failed" = true ]; then
|
||||||
say_verbose "Wget download failed"
|
say_verbose "Wget download failed"
|
||||||
|
|||||||
108
lib/authutil.js
108
lib/authutil.js
@@ -1,108 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
|
||||||
if (mod && mod.__esModule) return mod;
|
|
||||||
var result = {};
|
|
||||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
||||||
result["default"] = mod;
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const fs = __importStar(require("fs"));
|
|
||||||
const path = __importStar(require("path"));
|
|
||||||
const core = __importStar(require("@actions/core"));
|
|
||||||
const github = __importStar(require("@actions/github"));
|
|
||||||
const xmlbuilder = __importStar(require("xmlbuilder"));
|
|
||||||
const xmlParser = __importStar(require("fast-xml-parser"));
|
|
||||||
function configAuthentication(feedUrl, existingFileLocation = '') {
|
|
||||||
const existingNuGetConfig = path.resolve(process.env['RUNNER_TEMP'] || process.cwd(), existingFileLocation == '' ? 'nuget.config' : existingFileLocation);
|
|
||||||
const tempNuGetConfig = path.resolve(process.env['RUNNER_TEMP'] || process.cwd(), '../', 'nuget.config');
|
|
||||||
writeFeedToFile(feedUrl, existingNuGetConfig, tempNuGetConfig);
|
|
||||||
}
|
|
||||||
exports.configAuthentication = configAuthentication;
|
|
||||||
function writeFeedToFile(feedUrl, existingFileLocation, tempFileLocation) {
|
|
||||||
console.log(`dotnet-auth: Finding any source references in ${existingFileLocation}, writing a new temporary configuration file with credentials to ${tempFileLocation}`);
|
|
||||||
let xml;
|
|
||||||
let sourceKeys = [];
|
|
||||||
let owner = core.getInput('owner');
|
|
||||||
let sourceUrl = feedUrl;
|
|
||||||
if (!owner) {
|
|
||||||
owner = github.context.repo.owner;
|
|
||||||
}
|
|
||||||
if (!process.env.NUGET_AUTH_TOKEN || process.env.NUGET_AUTH_TOKEN == '') {
|
|
||||||
throw new Error('The NUGET_AUTH_TOKEN environment variable was not provided. In this step, add the following: \r\nenv:\r\n NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}');
|
|
||||||
}
|
|
||||||
if (fs.existsSync(existingFileLocation)) {
|
|
||||||
// get key from existing NuGet.config so NuGet/dotnet can match credentials
|
|
||||||
const curContents = fs.readFileSync(existingFileLocation, 'utf8');
|
|
||||||
var json = xmlParser.parse(curContents, { ignoreAttributes: false });
|
|
||||||
if (typeof json.configuration == 'undefined') {
|
|
||||||
throw new Error(`The provided NuGet.config seems invalid.`);
|
|
||||||
}
|
|
||||||
if (typeof json.configuration.packageSources != 'undefined') {
|
|
||||||
if (typeof json.configuration.packageSources.add != 'undefined') {
|
|
||||||
// file has at least one <add>
|
|
||||||
if (typeof json.configuration.packageSources.add[0] == 'undefined') {
|
|
||||||
// file has only one <add>
|
|
||||||
if (json.configuration.packageSources.add['@_value']
|
|
||||||
.toLowerCase()
|
|
||||||
.includes(feedUrl.toLowerCase())) {
|
|
||||||
let key = json.configuration.packageSources.add['@_key'];
|
|
||||||
sourceKeys.push(key);
|
|
||||||
core.debug(`Found a URL with key ${key}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// file has 2+ <add>
|
|
||||||
for (let i = 0; i < json.configuration.packageSources.add.length; i++) {
|
|
||||||
core.debug(json.configuration.packageSources.add[i]);
|
|
||||||
if (json.configuration.packageSources.add[i]['@_value']
|
|
||||||
.toLowerCase()
|
|
||||||
.includes(feedUrl.toLowerCase())) {
|
|
||||||
let key = json.configuration.packageSources.add[i]['@_key'];
|
|
||||||
sourceKeys.push(key);
|
|
||||||
core.debug(`Found a URL with key ${key}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
xml = xmlbuilder
|
|
||||||
.create('configuration')
|
|
||||||
.ele('config')
|
|
||||||
.ele('add', { key: 'defaultPushSource', value: sourceUrl })
|
|
||||||
.up()
|
|
||||||
.up();
|
|
||||||
if (sourceKeys.length == 0) {
|
|
||||||
let keystring = 'Source';
|
|
||||||
xml = xml
|
|
||||||
.ele('packageSources')
|
|
||||||
.ele('add', { key: keystring, value: sourceUrl })
|
|
||||||
.up()
|
|
||||||
.up();
|
|
||||||
sourceKeys.push(keystring);
|
|
||||||
}
|
|
||||||
xml = xml.ele('packageSourceCredentials');
|
|
||||||
sourceKeys.forEach(key => {
|
|
||||||
if (key.indexOf(' ') > -1) {
|
|
||||||
throw new Error("This action currently can't handle source names with spaces. Remove the space from your repo's NuGet.config and try again.");
|
|
||||||
}
|
|
||||||
xml = xml
|
|
||||||
.ele(key)
|
|
||||||
.ele('add', { key: 'Username', value: owner })
|
|
||||||
.up()
|
|
||||||
.ele('add', {
|
|
||||||
key: 'ClearTextPassword',
|
|
||||||
value: process.env.NUGET_AUTH_TOKEN
|
|
||||||
})
|
|
||||||
.up()
|
|
||||||
.up();
|
|
||||||
});
|
|
||||||
// If NuGet fixes itself such that on Linux it can look for environment variables in the config file (it doesn't seem to work today),
|
|
||||||
// use this for the value above
|
|
||||||
// process.platform == 'win32'
|
|
||||||
// ? '%NUGET_AUTH_TOKEN%'
|
|
||||||
// : '$NUGET_AUTH_TOKEN'
|
|
||||||
var output = xml.end({ pretty: true });
|
|
||||||
fs.writeFileSync(tempFileLocation, output);
|
|
||||||
}
|
|
||||||
312
lib/installer.js
312
lib/installer.js
@@ -1,312 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
||||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
|
||||||
if (mod && mod.__esModule) return mod;
|
|
||||||
var result = {};
|
|
||||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
||||||
result["default"] = mod;
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
// Load tempDirectory before it gets wiped by tool-cache
|
|
||||||
let tempDirectory = process.env['RUNNER_TEMPDIRECTORY'] || '';
|
|
||||||
const core = __importStar(require("@actions/core"));
|
|
||||||
const exec = __importStar(require("@actions/exec"));
|
|
||||||
const io = __importStar(require("@actions/io"));
|
|
||||||
const tc = __importStar(require("@actions/tool-cache"));
|
|
||||||
const httpClient = require("typed-rest-client/HttpClient");
|
|
||||||
const fs_1 = require("fs");
|
|
||||||
const os = __importStar(require("os"));
|
|
||||||
const path = __importStar(require("path"));
|
|
||||||
const semver = __importStar(require("semver"));
|
|
||||||
const IS_WINDOWS = process.platform === 'win32';
|
|
||||||
if (!tempDirectory) {
|
|
||||||
let baseLocation;
|
|
||||||
if (IS_WINDOWS) {
|
|
||||||
// On windows use the USERPROFILE env variable
|
|
||||||
baseLocation = process.env['USERPROFILE'] || 'C:\\';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (process.platform === 'darwin') {
|
|
||||||
baseLocation = '/Users';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
baseLocation = '/home';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
tempDirectory = path.join(baseLocation, 'actions', 'temp');
|
|
||||||
}
|
|
||||||
class DotnetCoreInstaller {
|
|
||||||
constructor(version) {
|
|
||||||
if (semver.valid(semver.clean(version) || '') == null) {
|
|
||||||
throw 'Implicit version not permitted';
|
|
||||||
}
|
|
||||||
this.version = version;
|
|
||||||
this.cachedToolName = 'dncs';
|
|
||||||
this.arch = 'x64';
|
|
||||||
}
|
|
||||||
installDotnet() {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
// Check cache
|
|
||||||
let toolPath;
|
|
||||||
let osSuffixes = yield this.detectMachineOS();
|
|
||||||
let parts = osSuffixes[0].split('-');
|
|
||||||
if (parts.length > 1) {
|
|
||||||
this.arch = parts[1];
|
|
||||||
}
|
|
||||||
toolPath = this.getLocalTool();
|
|
||||||
if (!toolPath) {
|
|
||||||
// download, extract, cache
|
|
||||||
console.log('Getting a download url', this.version);
|
|
||||||
let downloadUrls = yield this.getDownloadUrls(osSuffixes, this.version);
|
|
||||||
toolPath = yield this.downloadAndInstall(downloadUrls);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
console.log('Using cached tool');
|
|
||||||
}
|
|
||||||
// Need to set this so that .NET Core global tools find the right locations.
|
|
||||||
core.exportVariable('DOTNET_ROOT', toolPath);
|
|
||||||
// Prepend the tools path. instructs the agent to prepend for future tasks
|
|
||||||
core.addPath(toolPath);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
getLocalTool() {
|
|
||||||
console.log('Checking tool cache');
|
|
||||||
return tc.find(this.cachedToolName, this.version, this.arch);
|
|
||||||
}
|
|
||||||
detectMachineOS() {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
let osSuffix = [];
|
|
||||||
let output = '';
|
|
||||||
let resultCode = 0;
|
|
||||||
if (IS_WINDOWS) {
|
|
||||||
let escapedScript = path
|
|
||||||
.join(__dirname, '..', 'externals', 'get-os-platform.ps1')
|
|
||||||
.replace(/'/g, "''");
|
|
||||||
let command = `& '${escapedScript}'`;
|
|
||||||
const powershellPath = yield io.which('powershell', true);
|
|
||||||
resultCode = yield exec.exec(`"${powershellPath}"`, [
|
|
||||||
'-NoLogo',
|
|
||||||
'-Sta',
|
|
||||||
'-NoProfile',
|
|
||||||
'-NonInteractive',
|
|
||||||
'-ExecutionPolicy',
|
|
||||||
'Unrestricted',
|
|
||||||
'-Command',
|
|
||||||
command
|
|
||||||
], {
|
|
||||||
listeners: {
|
|
||||||
stdout: (data) => {
|
|
||||||
output += data.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
let scriptPath = path.join(__dirname, '..', 'externals', 'get-os-distro.sh');
|
|
||||||
fs_1.chmodSync(scriptPath, '777');
|
|
||||||
const toolPath = yield io.which(scriptPath, true);
|
|
||||||
resultCode = yield exec.exec(`"${toolPath}"`, [], {
|
|
||||||
listeners: {
|
|
||||||
stdout: (data) => {
|
|
||||||
output += data.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
if (resultCode != 0) {
|
|
||||||
throw `Failed to detect os with result code ${resultCode}. Output: ${output}`;
|
|
||||||
}
|
|
||||||
let index;
|
|
||||||
if ((index = output.indexOf('Primary:')) >= 0) {
|
|
||||||
let primary = output.substr(index + 'Primary:'.length).split(os.EOL)[0];
|
|
||||||
osSuffix.push(primary);
|
|
||||||
}
|
|
||||||
if ((index = output.indexOf('Legacy:')) >= 0) {
|
|
||||||
let legacy = output.substr(index + 'Legacy:'.length).split(os.EOL)[0];
|
|
||||||
osSuffix.push(legacy);
|
|
||||||
}
|
|
||||||
if (osSuffix.length == 0) {
|
|
||||||
throw 'Could not detect platform';
|
|
||||||
}
|
|
||||||
return osSuffix;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
downloadAndInstall(downloadUrls) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
let downloaded = false;
|
|
||||||
let downloadPath = '';
|
|
||||||
for (const url of downloadUrls) {
|
|
||||||
try {
|
|
||||||
downloadPath = yield tc.downloadTool(url);
|
|
||||||
downloaded = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
console.log('Could Not Download', url, JSON.stringify(error));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!downloaded) {
|
|
||||||
throw 'Failed to download package';
|
|
||||||
}
|
|
||||||
// extract
|
|
||||||
console.log('Extracting Package', downloadPath);
|
|
||||||
let extPath = IS_WINDOWS
|
|
||||||
? yield tc.extractZip(downloadPath)
|
|
||||||
: yield tc.extractTar(downloadPath);
|
|
||||||
// cache tool
|
|
||||||
console.log('Caching tool');
|
|
||||||
let cachedDir = yield tc.cacheDir(extPath, this.cachedToolName, this.version, this.arch);
|
|
||||||
console.log('Successfully installed', this.version);
|
|
||||||
return cachedDir;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// OsSuffixes - The suffix which is a part of the file name ex- linux-x64, windows-x86
|
|
||||||
// Type - SDK / Runtime
|
|
||||||
// Version - Version of the SDK/Runtime
|
|
||||||
getDownloadUrls(osSuffixes, version) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
let downloadUrls = [];
|
|
||||||
const httpCallbackClient = new httpClient.HttpClient('actions/setup-dotnet', [], {});
|
|
||||||
const releasesJsonUrl = yield this.getReleasesJsonUrl(httpCallbackClient, version.split('.'));
|
|
||||||
let releasesJSON = yield httpCallbackClient.get(releasesJsonUrl);
|
|
||||||
let releasesInfo = JSON.parse(yield releasesJSON.readBody())['releases'];
|
|
||||||
releasesInfo = releasesInfo.filter((releaseInfo) => {
|
|
||||||
return (releaseInfo['sdk']['version'] === version ||
|
|
||||||
releaseInfo['sdk']['version-display'] === version);
|
|
||||||
});
|
|
||||||
if (releasesInfo.length != 0) {
|
|
||||||
let release = releasesInfo[0];
|
|
||||||
let files = release['sdk']['files'];
|
|
||||||
files = files.filter((file) => {
|
|
||||||
if (file['rid'] == osSuffixes[0] || file['rid'] == osSuffixes[1]) {
|
|
||||||
return (file['url'].endsWith('.zip') || file['url'].endsWith('.tar.gz'));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (files.length > 0) {
|
|
||||||
files.forEach((file) => {
|
|
||||||
downloadUrls.push(file['url']);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
throw `The specified version's download links are not correctly formed in the supported versions document => ${releasesJsonUrl}`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
console.log(`Could not fetch download information for version ${version}`);
|
|
||||||
downloadUrls = yield this.getFallbackDownloadUrls(version);
|
|
||||||
}
|
|
||||||
if (downloadUrls.length == 0) {
|
|
||||||
throw `Could not construct download URL. Please ensure that specified version ${version} is valid.`;
|
|
||||||
}
|
|
||||||
core.debug(`Got download urls ${downloadUrls}`);
|
|
||||||
return downloadUrls;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
getReleasesJsonUrl(httpCallbackClient, versionParts) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
const releasesIndex = yield httpCallbackClient.get(DotNetCoreIndexUrl);
|
|
||||||
let releasesInfo = JSON.parse(yield releasesIndex.readBody())['releases-index'];
|
|
||||||
releasesInfo = releasesInfo.filter((info) => {
|
|
||||||
// channel-version is the first 2 elements of the version (e.g. 2.1), filter out versions that don't match 2.1.x.
|
|
||||||
const sdkParts = info['channel-version'].split('.');
|
|
||||||
if (versionParts.length >= 2 && versionParts[1] != 'x') {
|
|
||||||
return versionParts[0] == sdkParts[0] && versionParts[1] == sdkParts[1];
|
|
||||||
}
|
|
||||||
return versionParts[0] == sdkParts[0];
|
|
||||||
});
|
|
||||||
if (releasesInfo.length === 0) {
|
|
||||||
throw `Could not find info for version ${versionParts.join('.')} at ${DotNetCoreIndexUrl}`;
|
|
||||||
}
|
|
||||||
return releasesInfo[0]['releases.json'];
|
|
||||||
});
|
|
||||||
}
|
|
||||||
getFallbackDownloadUrls(version) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
let primaryUrlSearchString;
|
|
||||||
let legacyUrlSearchString;
|
|
||||||
let output = '';
|
|
||||||
let resultCode = 0;
|
|
||||||
if (IS_WINDOWS) {
|
|
||||||
let escapedScript = path
|
|
||||||
.join(__dirname, '..', 'externals', 'install-dotnet.ps1')
|
|
||||||
.replace(/'/g, "''");
|
|
||||||
let command = `& '${escapedScript}' -Version ${version} -DryRun`;
|
|
||||||
const powershellPath = yield io.which('powershell', true);
|
|
||||||
resultCode = yield exec.exec(`"${powershellPath}"`, [
|
|
||||||
'-NoLogo',
|
|
||||||
'-Sta',
|
|
||||||
'-NoProfile',
|
|
||||||
'-NonInteractive',
|
|
||||||
'-ExecutionPolicy',
|
|
||||||
'Unrestricted',
|
|
||||||
'-Command',
|
|
||||||
command
|
|
||||||
], {
|
|
||||||
listeners: {
|
|
||||||
stdout: (data) => {
|
|
||||||
output += data.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
primaryUrlSearchString = 'dotnet-install: Primary named payload URL: ';
|
|
||||||
legacyUrlSearchString = 'dotnet-install: Legacy named payload URL: ';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
let escapedScript = path
|
|
||||||
.join(__dirname, '..', 'externals', 'install-dotnet.sh')
|
|
||||||
.replace(/'/g, "''");
|
|
||||||
fs_1.chmodSync(escapedScript, '777');
|
|
||||||
const scriptPath = yield io.which(escapedScript, true);
|
|
||||||
resultCode = yield exec.exec(`"${scriptPath}"`, ['--version', version, '--dry-run'], {
|
|
||||||
listeners: {
|
|
||||||
stdout: (data) => {
|
|
||||||
output += data.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
primaryUrlSearchString = 'dotnet-install: Primary named payload URL: ';
|
|
||||||
legacyUrlSearchString = 'dotnet-install: Legacy named payload URL: ';
|
|
||||||
}
|
|
||||||
if (resultCode != 0) {
|
|
||||||
throw `Failed to get download urls with result code ${resultCode}. ${output}`;
|
|
||||||
}
|
|
||||||
let primaryUrl = '';
|
|
||||||
let legacyUrl = '';
|
|
||||||
if (!!output && output.length > 0) {
|
|
||||||
let lines = output.split(os.EOL);
|
|
||||||
// Fallback to \n if initial split doesn't work (not consistent across versions)
|
|
||||||
if (lines.length === 1) {
|
|
||||||
lines = output.split('\n');
|
|
||||||
}
|
|
||||||
if (!!lines && lines.length > 0) {
|
|
||||||
lines.forEach((line) => {
|
|
||||||
if (!line) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var primarySearchStringIndex = line.indexOf(primaryUrlSearchString);
|
|
||||||
if (primarySearchStringIndex > -1) {
|
|
||||||
primaryUrl = line.substring(primarySearchStringIndex + primaryUrlSearchString.length);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var legacySearchStringIndex = line.indexOf(legacyUrlSearchString);
|
|
||||||
if (legacySearchStringIndex > -1) {
|
|
||||||
legacyUrl = line.substring(legacySearchStringIndex + legacyUrlSearchString.length);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return [primaryUrl, legacyUrl];
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
exports.DotnetCoreInstaller = DotnetCoreInstaller;
|
|
||||||
const DotNetCoreIndexUrl = 'https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/releases-index.json';
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
||||||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
var __importStar = (this && this.__importStar) || function (mod) {
|
|
||||||
if (mod && mod.__esModule) return mod;
|
|
||||||
var result = {};
|
|
||||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
||||||
result["default"] = mod;
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const core = __importStar(require("@actions/core"));
|
|
||||||
const installer = __importStar(require("./installer"));
|
|
||||||
const path = __importStar(require("path"));
|
|
||||||
const auth = __importStar(require("./authutil"));
|
|
||||||
function run() {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
try {
|
|
||||||
//
|
|
||||||
// Version is optional. If supplied, install / use from the tool cache
|
|
||||||
// If not supplied then task is still used to setup proxy, auth, etc...
|
|
||||||
//
|
|
||||||
let version = core.getInput('version');
|
|
||||||
if (!version) {
|
|
||||||
version = core.getInput('dotnet-version');
|
|
||||||
}
|
|
||||||
if (version) {
|
|
||||||
const dotnetInstaller = new installer.DotnetCoreInstaller(version);
|
|
||||||
yield dotnetInstaller.installDotnet();
|
|
||||||
}
|
|
||||||
const sourceUrl = core.getInput('source-url');
|
|
||||||
const configFile = core.getInput('config-file');
|
|
||||||
if (sourceUrl) {
|
|
||||||
auth.configAuthentication(sourceUrl, configFile);
|
|
||||||
}
|
|
||||||
// TODO: setup proxy from runner proxy config
|
|
||||||
const matchersPath = path.join(__dirname, '..', '.github');
|
|
||||||
console.log(`##[add-matcher]${path.join(matchersPath, 'csc.json')}`);
|
|
||||||
}
|
|
||||||
catch (error) {
|
|
||||||
core.setFailed(error.message);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
run();
|
|
||||||
15
node_modules/.bin/semver
generated
vendored
15
node_modules/.bin/semver
generated
vendored
@@ -1,15 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
||||||
|
|
||||||
case `uname` in
|
|
||||||
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -x "$basedir/node" ]; then
|
|
||||||
"$basedir/node" "$basedir/../semver/bin/semver.js" "$@"
|
|
||||||
ret=$?
|
|
||||||
else
|
|
||||||
node "$basedir/../semver/bin/semver.js" "$@"
|
|
||||||
ret=$?
|
|
||||||
fi
|
|
||||||
exit $ret
|
|
||||||
7
node_modules/.bin/semver.cmd
generated
vendored
7
node_modules/.bin/semver.cmd
generated
vendored
@@ -1,7 +0,0 @@
|
|||||||
@IF EXIST "%~dp0\node.exe" (
|
|
||||||
"%~dp0\node.exe" "%~dp0\..\semver\bin\semver.js" %*
|
|
||||||
) ELSE (
|
|
||||||
@SETLOCAL
|
|
||||||
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
|
||||||
node "%~dp0\..\semver\bin\semver.js" %*
|
|
||||||
)
|
|
||||||
15
node_modules/.bin/uuid
generated
vendored
15
node_modules/.bin/uuid
generated
vendored
@@ -1,15 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
||||||
|
|
||||||
case `uname` in
|
|
||||||
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -x "$basedir/node" ]; then
|
|
||||||
"$basedir/node" "$basedir/../uuid/bin/uuid" "$@"
|
|
||||||
ret=$?
|
|
||||||
else
|
|
||||||
node "$basedir/../uuid/bin/uuid" "$@"
|
|
||||||
ret=$?
|
|
||||||
fi
|
|
||||||
exit $ret
|
|
||||||
7
node_modules/.bin/uuid.cmd
generated
vendored
7
node_modules/.bin/uuid.cmd
generated
vendored
@@ -1,7 +0,0 @@
|
|||||||
@IF EXIST "%~dp0\node.exe" (
|
|
||||||
"%~dp0\node.exe" "%~dp0\..\uuid\bin\uuid" %*
|
|
||||||
) ELSE (
|
|
||||||
@SETLOCAL
|
|
||||||
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
|
||||||
node "%~dp0\..\uuid\bin\uuid" %*
|
|
||||||
)
|
|
||||||
15
node_modules/.bin/which
generated
vendored
15
node_modules/.bin/which
generated
vendored
@@ -1,15 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
||||||
|
|
||||||
case `uname` in
|
|
||||||
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -x "$basedir/node" ]; then
|
|
||||||
"$basedir/node" "$basedir/../which/bin/which" "$@"
|
|
||||||
ret=$?
|
|
||||||
else
|
|
||||||
node "$basedir/../which/bin/which" "$@"
|
|
||||||
ret=$?
|
|
||||||
fi
|
|
||||||
exit $ret
|
|
||||||
7
node_modules/.bin/which.cmd
generated
vendored
7
node_modules/.bin/which.cmd
generated
vendored
@@ -1,7 +0,0 @@
|
|||||||
@IF EXIST "%~dp0\node.exe" (
|
|
||||||
"%~dp0\node.exe" "%~dp0\..\which\bin\which" %*
|
|
||||||
) ELSE (
|
|
||||||
@SETLOCAL
|
|
||||||
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
|
||||||
node "%~dp0\..\which\bin\which" %*
|
|
||||||
)
|
|
||||||
15
node_modules/.bin/xml2js
generated
vendored
15
node_modules/.bin/xml2js
generated
vendored
@@ -1,15 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
|
||||||
|
|
||||||
case `uname` in
|
|
||||||
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [ -x "$basedir/node" ]; then
|
|
||||||
"$basedir/node" "$basedir/../fast-xml-parser/cli.js" "$@"
|
|
||||||
ret=$?
|
|
||||||
else
|
|
||||||
node "$basedir/../fast-xml-parser/cli.js" "$@"
|
|
||||||
ret=$?
|
|
||||||
fi
|
|
||||||
exit $ret
|
|
||||||
7
node_modules/.bin/xml2js.cmd
generated
vendored
7
node_modules/.bin/xml2js.cmd
generated
vendored
@@ -1,7 +0,0 @@
|
|||||||
@IF EXIST "%~dp0\node.exe" (
|
|
||||||
"%~dp0\node.exe" "%~dp0\..\fast-xml-parser\cli.js" %*
|
|
||||||
) ELSE (
|
|
||||||
@SETLOCAL
|
|
||||||
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
|
||||||
node "%~dp0\..\fast-xml-parser\cli.js" %*
|
|
||||||
)
|
|
||||||
140
node_modules/@actions/core/README.md
generated
vendored
140
node_modules/@actions/core/README.md
generated
vendored
@@ -1,140 +0,0 @@
|
|||||||
# `@actions/core`
|
|
||||||
|
|
||||||
> Core functions for setting results, logging, registering secrets and exporting variables across actions
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
### Import the package
|
|
||||||
|
|
||||||
```js
|
|
||||||
// javascript
|
|
||||||
const core = require('@actions/core');
|
|
||||||
|
|
||||||
// typescript
|
|
||||||
import * as core from '@actions/core';
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Inputs/Outputs
|
|
||||||
|
|
||||||
Action inputs can be read with `getInput`. Outputs can be set with `setOutput` which makes them available to be mapped into inputs of other actions to ensure they are decoupled.
|
|
||||||
|
|
||||||
```js
|
|
||||||
const myInput = core.getInput('inputName', { required: true });
|
|
||||||
|
|
||||||
core.setOutput('outputKey', 'outputVal');
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Exporting variables
|
|
||||||
|
|
||||||
Since each step runs in a separate process, you can use `exportVariable` to add it to this step and future steps environment blocks.
|
|
||||||
|
|
||||||
```js
|
|
||||||
core.exportVariable('envVar', 'Val');
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Setting a secret
|
|
||||||
|
|
||||||
Setting a secret registers the secret with the runner to ensure it is masked in logs.
|
|
||||||
|
|
||||||
```js
|
|
||||||
core.setSecret('myPassword');
|
|
||||||
```
|
|
||||||
|
|
||||||
#### PATH Manipulation
|
|
||||||
|
|
||||||
To make a tool's path available in the path for the remainder of the job (without altering the machine or containers state), use `addPath`. The runner will prepend the path given to the jobs PATH.
|
|
||||||
|
|
||||||
```js
|
|
||||||
core.addPath('/path/to/mytool');
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Exit codes
|
|
||||||
|
|
||||||
You should use this library to set the failing exit code for your action. If status is not set and the script runs to completion, that will lead to a success.
|
|
||||||
|
|
||||||
```js
|
|
||||||
const core = require('@actions/core');
|
|
||||||
|
|
||||||
try {
|
|
||||||
// Do stuff
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
// setFailed logs the message and sets a failing exit code
|
|
||||||
core.setFailed(`Action failed with error ${err}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
Note that `setNeutral` is not yet implemented in actions V2 but equivalent functionality is being planned.
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Logging
|
|
||||||
|
|
||||||
Finally, this library provides some utilities for logging. Note that debug logging is hidden from the logs by default. This behavior can be toggled by enabling the [Step Debug Logs](../../docs/action-debugging.md#step-debug-logs).
|
|
||||||
|
|
||||||
```js
|
|
||||||
const core = require('@actions/core');
|
|
||||||
|
|
||||||
const myInput = core.getInput('input');
|
|
||||||
try {
|
|
||||||
core.debug('Inside try block');
|
|
||||||
|
|
||||||
if (!myInput) {
|
|
||||||
core.warning('myInput was not set');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Do stuff
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
core.error(`Error ${err}, action may still succeed though`);
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
This library can also wrap chunks of output in foldable groups.
|
|
||||||
|
|
||||||
```js
|
|
||||||
const core = require('@actions/core')
|
|
||||||
|
|
||||||
// Manually wrap output
|
|
||||||
core.startGroup('Do some function')
|
|
||||||
doSomeFunction()
|
|
||||||
core.endGroup()
|
|
||||||
|
|
||||||
// Wrap an asynchronous function call
|
|
||||||
const result = await core.group('Do something async', async () => {
|
|
||||||
const response = await doSomeHTTPRequest()
|
|
||||||
return response
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Action state
|
|
||||||
|
|
||||||
You can use this library to save state and get state for sharing information between a given wrapper action:
|
|
||||||
|
|
||||||
**action.yml**
|
|
||||||
```yaml
|
|
||||||
name: 'Wrapper action sample'
|
|
||||||
inputs:
|
|
||||||
name:
|
|
||||||
default: 'GitHub'
|
|
||||||
runs:
|
|
||||||
using: 'node12'
|
|
||||||
main: 'main.js'
|
|
||||||
post: 'cleanup.js'
|
|
||||||
```
|
|
||||||
|
|
||||||
In action's `main.js`:
|
|
||||||
|
|
||||||
```js
|
|
||||||
const core = require('@actions/core');
|
|
||||||
|
|
||||||
core.saveState("pidToKill", 12345);
|
|
||||||
```
|
|
||||||
|
|
||||||
In action's `cleanup.js`:
|
|
||||||
```js
|
|
||||||
const core = require('@actions/core');
|
|
||||||
|
|
||||||
var pid = core.getState("pidToKill");
|
|
||||||
|
|
||||||
process.kill(pid);
|
|
||||||
```
|
|
||||||
16
node_modules/@actions/core/lib/command.d.ts
generated
vendored
16
node_modules/@actions/core/lib/command.d.ts
generated
vendored
@@ -1,16 +0,0 @@
|
|||||||
interface CommandProperties {
|
|
||||||
[key: string]: string;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Commands
|
|
||||||
*
|
|
||||||
* Command Format:
|
|
||||||
* ##[name key=value;key=value]message
|
|
||||||
*
|
|
||||||
* Examples:
|
|
||||||
* ##[warning]This is the user warning message
|
|
||||||
* ##[set-secret name=mypassword]definitelyNotAPassword!
|
|
||||||
*/
|
|
||||||
export declare function issueCommand(command: string, properties: CommandProperties, message: string): void;
|
|
||||||
export declare function issue(name: string, message?: string): void;
|
|
||||||
export {};
|
|
||||||
66
node_modules/@actions/core/lib/command.js
generated
vendored
66
node_modules/@actions/core/lib/command.js
generated
vendored
@@ -1,66 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const os = require("os");
|
|
||||||
/**
|
|
||||||
* Commands
|
|
||||||
*
|
|
||||||
* Command Format:
|
|
||||||
* ##[name key=value;key=value]message
|
|
||||||
*
|
|
||||||
* Examples:
|
|
||||||
* ##[warning]This is the user warning message
|
|
||||||
* ##[set-secret name=mypassword]definitelyNotAPassword!
|
|
||||||
*/
|
|
||||||
function issueCommand(command, properties, message) {
|
|
||||||
const cmd = new Command(command, properties, message);
|
|
||||||
process.stdout.write(cmd.toString() + os.EOL);
|
|
||||||
}
|
|
||||||
exports.issueCommand = issueCommand;
|
|
||||||
function issue(name, message = '') {
|
|
||||||
issueCommand(name, {}, message);
|
|
||||||
}
|
|
||||||
exports.issue = issue;
|
|
||||||
const CMD_STRING = '::';
|
|
||||||
class Command {
|
|
||||||
constructor(command, properties, message) {
|
|
||||||
if (!command) {
|
|
||||||
command = 'missing.command';
|
|
||||||
}
|
|
||||||
this.command = command;
|
|
||||||
this.properties = properties;
|
|
||||||
this.message = message;
|
|
||||||
}
|
|
||||||
toString() {
|
|
||||||
let cmdStr = CMD_STRING + this.command;
|
|
||||||
if (this.properties && Object.keys(this.properties).length > 0) {
|
|
||||||
cmdStr += ' ';
|
|
||||||
for (const key in this.properties) {
|
|
||||||
if (this.properties.hasOwnProperty(key)) {
|
|
||||||
const val = this.properties[key];
|
|
||||||
if (val) {
|
|
||||||
// safely append the val - avoid blowing up when attempting to
|
|
||||||
// call .replace() if message is not a string for some reason
|
|
||||||
cmdStr += `${key}=${escape(`${val || ''}`)},`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
cmdStr += CMD_STRING;
|
|
||||||
// safely append the message - avoid blowing up when attempting to
|
|
||||||
// call .replace() if message is not a string for some reason
|
|
||||||
const message = `${this.message || ''}`;
|
|
||||||
cmdStr += escapeData(message);
|
|
||||||
return cmdStr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function escapeData(s) {
|
|
||||||
return s.replace(/\r/g, '%0D').replace(/\n/g, '%0A');
|
|
||||||
}
|
|
||||||
function escape(s) {
|
|
||||||
return s
|
|
||||||
.replace(/\r/g, '%0D')
|
|
||||||
.replace(/\n/g, '%0A')
|
|
||||||
.replace(/]/g, '%5D')
|
|
||||||
.replace(/;/g, '%3B');
|
|
||||||
}
|
|
||||||
//# sourceMappingURL=command.js.map
|
|
||||||
1
node_modules/@actions/core/lib/command.js.map
generated
vendored
1
node_modules/@actions/core/lib/command.js.map
generated
vendored
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"command.js","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":";;AAAA,yBAAwB;AAQxB;;;;;;;;;GASG;AACH,SAAgB,YAAY,CAC1B,OAAe,EACf,UAA6B,EAC7B,OAAe;IAEf,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;IACrD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;AAC/C,CAAC;AAPD,oCAOC;AAED,SAAgB,KAAK,CAAC,IAAY,EAAE,UAAkB,EAAE;IACtD,YAAY,CAAC,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;AACjC,CAAC;AAFD,sBAEC;AAED,MAAM,UAAU,GAAG,IAAI,CAAA;AAEvB,MAAM,OAAO;IAKX,YAAY,OAAe,EAAE,UAA6B,EAAE,OAAe;QACzE,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO,GAAG,iBAAiB,CAAA;SAC5B;QAED,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;IAED,QAAQ;QACN,IAAI,MAAM,GAAG,UAAU,GAAG,IAAI,CAAC,OAAO,CAAA;QAEtC,IAAI,IAAI,CAAC,UAAU,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;YAC9D,MAAM,IAAI,GAAG,CAAA;YACb,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,UAAU,EAAE;gBACjC,IAAI,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;oBACvC,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;oBAChC,IAAI,GAAG,EAAE;wBACP,8DAA8D;wBAC9D,6DAA6D;wBAC7D,MAAM,IAAI,GAAG,GAAG,IAAI,MAAM,CAAC,GAAG,GAAG,IAAI,EAAE,EAAE,CAAC,GAAG,CAAA;qBAC9C;iBACF;aACF;SACF;QAED,MAAM,IAAI,UAAU,CAAA;QAEpB,kEAAkE;QAClE,6DAA6D;QAC7D,MAAM,OAAO,GAAG,GAAG,IAAI,CAAC,OAAO,IAAI,EAAE,EAAE,CAAA;QACvC,MAAM,IAAI,UAAU,CAAC,OAAO,CAAC,CAAA;QAE7B,OAAO,MAAM,CAAA;IACf,CAAC;CACF;AAED,SAAS,UAAU,CAAC,CAAS;IAC3B,OAAO,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;AACtD,CAAC;AAED,SAAS,MAAM,CAAC,CAAS;IACvB,OAAO,CAAC;SACL,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;AACzB,CAAC"}
|
|
||||||
112
node_modules/@actions/core/lib/core.d.ts
generated
vendored
112
node_modules/@actions/core/lib/core.d.ts
generated
vendored
@@ -1,112 +0,0 @@
|
|||||||
/**
|
|
||||||
* Interface for getInput options
|
|
||||||
*/
|
|
||||||
export interface InputOptions {
|
|
||||||
/** Optional. Whether the input is required. If required and not present, will throw. Defaults to false */
|
|
||||||
required?: boolean;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* The code to exit an action
|
|
||||||
*/
|
|
||||||
export declare enum ExitCode {
|
|
||||||
/**
|
|
||||||
* A code indicating that the action was successful
|
|
||||||
*/
|
|
||||||
Success = 0,
|
|
||||||
/**
|
|
||||||
* A code indicating that the action was a failure
|
|
||||||
*/
|
|
||||||
Failure = 1
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Sets env variable for this action and future actions in the job
|
|
||||||
* @param name the name of the variable to set
|
|
||||||
* @param val the value of the variable
|
|
||||||
*/
|
|
||||||
export declare function exportVariable(name: string, val: string): void;
|
|
||||||
/**
|
|
||||||
* Registers a secret which will get masked from logs
|
|
||||||
* @param secret value of the secret
|
|
||||||
*/
|
|
||||||
export declare function setSecret(secret: string): void;
|
|
||||||
/**
|
|
||||||
* Prepends inputPath to the PATH (for this action and future actions)
|
|
||||||
* @param inputPath
|
|
||||||
*/
|
|
||||||
export declare function addPath(inputPath: string): void;
|
|
||||||
/**
|
|
||||||
* Gets the value of an input. The value is also trimmed.
|
|
||||||
*
|
|
||||||
* @param name name of the input to get
|
|
||||||
* @param options optional. See InputOptions.
|
|
||||||
* @returns string
|
|
||||||
*/
|
|
||||||
export declare function getInput(name: string, options?: InputOptions): string;
|
|
||||||
/**
|
|
||||||
* Sets the value of an output.
|
|
||||||
*
|
|
||||||
* @param name name of the output to set
|
|
||||||
* @param value value to store
|
|
||||||
*/
|
|
||||||
export declare function setOutput(name: string, value: string): void;
|
|
||||||
/**
|
|
||||||
* Sets the action status to failed.
|
|
||||||
* When the action exits it will be with an exit code of 1
|
|
||||||
* @param message add error issue message
|
|
||||||
*/
|
|
||||||
export declare function setFailed(message: string): void;
|
|
||||||
/**
|
|
||||||
* Writes debug message to user log
|
|
||||||
* @param message debug message
|
|
||||||
*/
|
|
||||||
export declare function debug(message: string): void;
|
|
||||||
/**
|
|
||||||
* Adds an error issue
|
|
||||||
* @param message error issue message
|
|
||||||
*/
|
|
||||||
export declare function error(message: string): void;
|
|
||||||
/**
|
|
||||||
* Adds an warning issue
|
|
||||||
* @param message warning issue message
|
|
||||||
*/
|
|
||||||
export declare function warning(message: string): void;
|
|
||||||
/**
|
|
||||||
* Writes info to log with console.log.
|
|
||||||
* @param message info message
|
|
||||||
*/
|
|
||||||
export declare function info(message: string): void;
|
|
||||||
/**
|
|
||||||
* Begin an output group.
|
|
||||||
*
|
|
||||||
* Output until the next `groupEnd` will be foldable in this group
|
|
||||||
*
|
|
||||||
* @param name The name of the output group
|
|
||||||
*/
|
|
||||||
export declare function startGroup(name: string): void;
|
|
||||||
/**
|
|
||||||
* End an output group.
|
|
||||||
*/
|
|
||||||
export declare function endGroup(): void;
|
|
||||||
/**
|
|
||||||
* Wrap an asynchronous function call in a group.
|
|
||||||
*
|
|
||||||
* Returns the same type as the function itself.
|
|
||||||
*
|
|
||||||
* @param name The name of the group
|
|
||||||
* @param fn The function to wrap in the group
|
|
||||||
*/
|
|
||||||
export declare function group<T>(name: string, fn: () => Promise<T>): Promise<T>;
|
|
||||||
/**
|
|
||||||
* Saves state for current action, the state can only be retrieved by this action's post job execution.
|
|
||||||
*
|
|
||||||
* @param name name of the state to store
|
|
||||||
* @param value value to store
|
|
||||||
*/
|
|
||||||
export declare function saveState(name: string, value: string): void;
|
|
||||||
/**
|
|
||||||
* Gets the value of an state set by this action's main execution.
|
|
||||||
*
|
|
||||||
* @param name name of the state to get
|
|
||||||
* @returns string
|
|
||||||
*/
|
|
||||||
export declare function getState(name: string): string;
|
|
||||||
195
node_modules/@actions/core/lib/core.js
generated
vendored
195
node_modules/@actions/core/lib/core.js
generated
vendored
@@ -1,195 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const command_1 = require("./command");
|
|
||||||
const os = require("os");
|
|
||||||
const path = require("path");
|
|
||||||
/**
|
|
||||||
* The code to exit an action
|
|
||||||
*/
|
|
||||||
var ExitCode;
|
|
||||||
(function (ExitCode) {
|
|
||||||
/**
|
|
||||||
* A code indicating that the action was successful
|
|
||||||
*/
|
|
||||||
ExitCode[ExitCode["Success"] = 0] = "Success";
|
|
||||||
/**
|
|
||||||
* A code indicating that the action was a failure
|
|
||||||
*/
|
|
||||||
ExitCode[ExitCode["Failure"] = 1] = "Failure";
|
|
||||||
})(ExitCode = exports.ExitCode || (exports.ExitCode = {}));
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
// Variables
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* Sets env variable for this action and future actions in the job
|
|
||||||
* @param name the name of the variable to set
|
|
||||||
* @param val the value of the variable
|
|
||||||
*/
|
|
||||||
function exportVariable(name, val) {
|
|
||||||
process.env[name] = val;
|
|
||||||
command_1.issueCommand('set-env', { name }, val);
|
|
||||||
}
|
|
||||||
exports.exportVariable = exportVariable;
|
|
||||||
/**
|
|
||||||
* Registers a secret which will get masked from logs
|
|
||||||
* @param secret value of the secret
|
|
||||||
*/
|
|
||||||
function setSecret(secret) {
|
|
||||||
command_1.issueCommand('add-mask', {}, secret);
|
|
||||||
}
|
|
||||||
exports.setSecret = setSecret;
|
|
||||||
/**
|
|
||||||
* Prepends inputPath to the PATH (for this action and future actions)
|
|
||||||
* @param inputPath
|
|
||||||
*/
|
|
||||||
function addPath(inputPath) {
|
|
||||||
command_1.issueCommand('add-path', {}, inputPath);
|
|
||||||
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
|
|
||||||
}
|
|
||||||
exports.addPath = addPath;
|
|
||||||
/**
|
|
||||||
* Gets the value of an input. The value is also trimmed.
|
|
||||||
*
|
|
||||||
* @param name name of the input to get
|
|
||||||
* @param options optional. See InputOptions.
|
|
||||||
* @returns string
|
|
||||||
*/
|
|
||||||
function getInput(name, options) {
|
|
||||||
const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || '';
|
|
||||||
if (options && options.required && !val) {
|
|
||||||
throw new Error(`Input required and not supplied: ${name}`);
|
|
||||||
}
|
|
||||||
return val.trim();
|
|
||||||
}
|
|
||||||
exports.getInput = getInput;
|
|
||||||
/**
|
|
||||||
* Sets the value of an output.
|
|
||||||
*
|
|
||||||
* @param name name of the output to set
|
|
||||||
* @param value value to store
|
|
||||||
*/
|
|
||||||
function setOutput(name, value) {
|
|
||||||
command_1.issueCommand('set-output', { name }, value);
|
|
||||||
}
|
|
||||||
exports.setOutput = setOutput;
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
// Results
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* Sets the action status to failed.
|
|
||||||
* When the action exits it will be with an exit code of 1
|
|
||||||
* @param message add error issue message
|
|
||||||
*/
|
|
||||||
function setFailed(message) {
|
|
||||||
process.exitCode = ExitCode.Failure;
|
|
||||||
error(message);
|
|
||||||
}
|
|
||||||
exports.setFailed = setFailed;
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
// Logging Commands
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* Writes debug message to user log
|
|
||||||
* @param message debug message
|
|
||||||
*/
|
|
||||||
function debug(message) {
|
|
||||||
command_1.issueCommand('debug', {}, message);
|
|
||||||
}
|
|
||||||
exports.debug = debug;
|
|
||||||
/**
|
|
||||||
* Adds an error issue
|
|
||||||
* @param message error issue message
|
|
||||||
*/
|
|
||||||
function error(message) {
|
|
||||||
command_1.issue('error', message);
|
|
||||||
}
|
|
||||||
exports.error = error;
|
|
||||||
/**
|
|
||||||
* Adds an warning issue
|
|
||||||
* @param message warning issue message
|
|
||||||
*/
|
|
||||||
function warning(message) {
|
|
||||||
command_1.issue('warning', message);
|
|
||||||
}
|
|
||||||
exports.warning = warning;
|
|
||||||
/**
|
|
||||||
* Writes info to log with console.log.
|
|
||||||
* @param message info message
|
|
||||||
*/
|
|
||||||
function info(message) {
|
|
||||||
process.stdout.write(message + os.EOL);
|
|
||||||
}
|
|
||||||
exports.info = info;
|
|
||||||
/**
|
|
||||||
* Begin an output group.
|
|
||||||
*
|
|
||||||
* Output until the next `groupEnd` will be foldable in this group
|
|
||||||
*
|
|
||||||
* @param name The name of the output group
|
|
||||||
*/
|
|
||||||
function startGroup(name) {
|
|
||||||
command_1.issue('group', name);
|
|
||||||
}
|
|
||||||
exports.startGroup = startGroup;
|
|
||||||
/**
|
|
||||||
* End an output group.
|
|
||||||
*/
|
|
||||||
function endGroup() {
|
|
||||||
command_1.issue('endgroup');
|
|
||||||
}
|
|
||||||
exports.endGroup = endGroup;
|
|
||||||
/**
|
|
||||||
* Wrap an asynchronous function call in a group.
|
|
||||||
*
|
|
||||||
* Returns the same type as the function itself.
|
|
||||||
*
|
|
||||||
* @param name The name of the group
|
|
||||||
* @param fn The function to wrap in the group
|
|
||||||
*/
|
|
||||||
function group(name, fn) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
startGroup(name);
|
|
||||||
let result;
|
|
||||||
try {
|
|
||||||
result = yield fn();
|
|
||||||
}
|
|
||||||
finally {
|
|
||||||
endGroup();
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.group = group;
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
// Wrapper action state
|
|
||||||
//-----------------------------------------------------------------------
|
|
||||||
/**
|
|
||||||
* Saves state for current action, the state can only be retrieved by this action's post job execution.
|
|
||||||
*
|
|
||||||
* @param name name of the state to store
|
|
||||||
* @param value value to store
|
|
||||||
*/
|
|
||||||
function saveState(name, value) {
|
|
||||||
command_1.issueCommand('save-state', { name }, value);
|
|
||||||
}
|
|
||||||
exports.saveState = saveState;
|
|
||||||
/**
|
|
||||||
* Gets the value of an state set by this action's main execution.
|
|
||||||
*
|
|
||||||
* @param name name of the state to get
|
|
||||||
* @returns string
|
|
||||||
*/
|
|
||||||
function getState(name) {
|
|
||||||
return process.env[`STATE_${name}`] || '';
|
|
||||||
}
|
|
||||||
exports.getState = getState;
|
|
||||||
//# sourceMappingURL=core.js.map
|
|
||||||
1
node_modules/@actions/core/lib/core.js.map
generated
vendored
1
node_modules/@actions/core/lib/core.js.map
generated
vendored
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,uCAA6C;AAE7C,yBAAwB;AACxB,6BAA4B;AAU5B;;GAEG;AACH,IAAY,QAUX;AAVD,WAAY,QAAQ;IAClB;;OAEG;IACH,6CAAW,CAAA;IAEX;;OAEG;IACH,6CAAW,CAAA;AACb,CAAC,EAVW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAUnB;AAED,yEAAyE;AACzE,YAAY;AACZ,yEAAyE;AAEzE;;;;GAIG;AACH,SAAgB,cAAc,CAAC,IAAY,EAAE,GAAW;IACtD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAA;IACvB,sBAAY,CAAC,SAAS,EAAE,EAAC,IAAI,EAAC,EAAE,GAAG,CAAC,CAAA;AACtC,CAAC;AAHD,wCAGC;AAED;;;GAGG;AACH,SAAgB,SAAS,CAAC,MAAc;IACtC,sBAAY,CAAC,UAAU,EAAE,EAAE,EAAE,MAAM,CAAC,CAAA;AACtC,CAAC;AAFD,8BAEC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,SAAiB;IACvC,sBAAY,CAAC,UAAU,EAAE,EAAE,EAAE,SAAS,CAAC,CAAA;IACvC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,GAAG,SAAS,GAAG,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAA;AAC7E,CAAC;AAHD,0BAGC;AAED;;;;;;GAMG;AACH,SAAgB,QAAQ,CAAC,IAAY,EAAE,OAAsB;IAC3D,MAAM,GAAG,GACP,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,IAAI,EAAE,CAAA;IACrE,IAAI,OAAO,IAAI,OAAO,CAAC,QAAQ,IAAI,CAAC,GAAG,EAAE;QACvC,MAAM,IAAI,KAAK,CAAC,oCAAoC,IAAI,EAAE,CAAC,CAAA;KAC5D;IAED,OAAO,GAAG,CAAC,IAAI,EAAE,CAAA;AACnB,CAAC;AARD,4BAQC;AAED;;;;;GAKG;AACH,SAAgB,SAAS,CAAC,IAAY,EAAE,KAAa;IACnD,sBAAY,CAAC,YAAY,EAAE,EAAC,IAAI,EAAC,EAAE,KAAK,CAAC,CAAA;AAC3C,CAAC;AAFD,8BAEC;AAED,yEAAyE;AACzE,UAAU;AACV,yEAAyE;AAEzE;;;;GAIG;AACH,SAAgB,SAAS,CAAC,OAAe;IACvC,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAA;IACnC,KAAK,CAAC,OAAO,CAAC,CAAA;AAChB,CAAC;AAHD,8BAGC;AAED,yEAAyE;AACzE,mBAAmB;AACnB,yEAAyE;AAEzE;;;GAGG;AACH,SAAgB,KAAK,CAAC,OAAe;IACnC,sBAAY,CAAC,OAAO,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;AACpC,CAAC;AAFD,sBAEC;AAED;;;GAGG;AACH,SAAgB,KAAK,CAAC,OAAe;IACnC,eAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;AACzB,CAAC;AAFD,sBAEC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,OAAe;IACrC,eAAK,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;AAC3B,CAAC;AAFD,0BAEC;AAED;;;GAGG;AACH,SAAgB,IAAI,CAAC,OAAe;IAClC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;AACxC,CAAC;AAFD,oBAEC;AAED;;;;;;GAMG;AACH,SAAgB,UAAU,CAAC,IAAY;IACrC,eAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;AACtB,CAAC;AAFD,gCAEC;AAED;;GAEG;AACH,SAAgB,QAAQ;IACtB,eAAK,CAAC,UAAU,CAAC,CAAA;AACnB,CAAC;AAFD,4BAEC;AAED;;;;;;;GAOG;AACH,SAAsB,KAAK,CAAI,IAAY,EAAE,EAAoB;;QAC/D,UAAU,CAAC,IAAI,CAAC,CAAA;QAEhB,IAAI,MAAS,CAAA;QAEb,IAAI;YACF,MAAM,GAAG,MAAM,EAAE,EAAE,CAAA;SACpB;gBAAS;YACR,QAAQ,EAAE,CAAA;SACX;QAED,OAAO,MAAM,CAAA;IACf,CAAC;CAAA;AAZD,sBAYC;AAED,yEAAyE;AACzE,uBAAuB;AACvB,yEAAyE;AAEzE;;;;;GAKG;AACH,SAAgB,SAAS,CAAC,IAAY,EAAE,KAAa;IACnD,sBAAY,CAAC,YAAY,EAAE,EAAC,IAAI,EAAC,EAAE,KAAK,CAAC,CAAA;AAC3C,CAAC;AAFD,8BAEC;AAED;;;;;GAKG;AACH,SAAgB,QAAQ,CAAC,IAAY;IACnC,OAAO,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,IAAI,EAAE,CAAA;AAC3C,CAAC;AAFD,4BAEC"}
|
|
||||||
66
node_modules/@actions/core/package.json
generated
vendored
66
node_modules/@actions/core/package.json
generated
vendored
@@ -1,66 +0,0 @@
|
|||||||
{
|
|
||||||
"_from": "@actions/core@1.2.0",
|
|
||||||
"_id": "@actions/core@1.2.0",
|
|
||||||
"_inBundle": false,
|
|
||||||
"_integrity": "sha512-ZKdyhlSlyz38S6YFfPnyNgCDZuAF2T0Qv5eHflNWytPS8Qjvz39bZFMry9Bb/dpSnqWcNeav5yM2CTYpJeY+Dw==",
|
|
||||||
"_location": "/@actions/core",
|
|
||||||
"_phantomChildren": {},
|
|
||||||
"_requested": {
|
|
||||||
"type": "version",
|
|
||||||
"registry": true,
|
|
||||||
"raw": "@actions/core@1.2.0",
|
|
||||||
"name": "@actions/core",
|
|
||||||
"escapedName": "@actions%2fcore",
|
|
||||||
"scope": "@actions",
|
|
||||||
"rawSpec": "1.2.0",
|
|
||||||
"saveSpec": null,
|
|
||||||
"fetchSpec": "1.2.0"
|
|
||||||
},
|
|
||||||
"_requiredBy": [
|
|
||||||
"#USER",
|
|
||||||
"/",
|
|
||||||
"/@actions/tool-cache"
|
|
||||||
],
|
|
||||||
"_resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.0.tgz",
|
|
||||||
"_shasum": "aa5f52b26c362c821d41557e599371a42f6c0b3d",
|
|
||||||
"_spec": "@actions/core@1.2.0",
|
|
||||||
"_where": "C:\\Users\\Stanley\\Projects\\GitHub\\setup-dotnet",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/actions/toolkit/issues"
|
|
||||||
},
|
|
||||||
"bundleDependencies": false,
|
|
||||||
"deprecated": false,
|
|
||||||
"description": "Actions core lib",
|
|
||||||
"devDependencies": {
|
|
||||||
"@types/node": "^12.0.2"
|
|
||||||
},
|
|
||||||
"directories": {
|
|
||||||
"lib": "lib",
|
|
||||||
"test": "__tests__"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"lib"
|
|
||||||
],
|
|
||||||
"homepage": "https://github.com/actions/toolkit/tree/master/packages/core",
|
|
||||||
"keywords": [
|
|
||||||
"github",
|
|
||||||
"actions",
|
|
||||||
"core"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"main": "lib/core.js",
|
|
||||||
"name": "@actions/core",
|
|
||||||
"publishConfig": {
|
|
||||||
"access": "public"
|
|
||||||
},
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://github.com/actions/toolkit.git",
|
|
||||||
"directory": "packages/core"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"test": "echo \"Error: run tests from root\" && exit 1",
|
|
||||||
"tsc": "tsc"
|
|
||||||
},
|
|
||||||
"version": "1.2.0"
|
|
||||||
}
|
|
||||||
57
node_modules/@actions/exec/README.md
generated
vendored
57
node_modules/@actions/exec/README.md
generated
vendored
@@ -1,57 +0,0 @@
|
|||||||
# `@actions/exec`
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
#### Basic
|
|
||||||
|
|
||||||
You can use this package to execute your tools on the command line in a cross platform way:
|
|
||||||
|
|
||||||
```js
|
|
||||||
const exec = require('@actions/exec');
|
|
||||||
|
|
||||||
await exec.exec('node index.js');
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Args
|
|
||||||
|
|
||||||
You can also pass in arg arrays:
|
|
||||||
|
|
||||||
```js
|
|
||||||
const exec = require('@actions/exec');
|
|
||||||
|
|
||||||
await exec.exec('node', ['index.js', 'foo=bar']);
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Output/options
|
|
||||||
|
|
||||||
Capture output or specify [other options](https://github.com/actions/toolkit/blob/d9347d4ab99fd507c0b9104b2cf79fb44fcc827d/packages/exec/src/interfaces.ts#L5):
|
|
||||||
|
|
||||||
```js
|
|
||||||
const exec = require('@actions/exec');
|
|
||||||
|
|
||||||
let myOutput = '';
|
|
||||||
let myError = '';
|
|
||||||
|
|
||||||
const options = {};
|
|
||||||
options.listeners = {
|
|
||||||
stdout: (data: Buffer) => {
|
|
||||||
myOutput += data.toString();
|
|
||||||
},
|
|
||||||
stderr: (data: Buffer) => {
|
|
||||||
myError += data.toString();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
options.cwd = './lib';
|
|
||||||
|
|
||||||
await exec.exec('node', ['index.js', 'foo=bar'], options);
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Exec tools not in the PATH
|
|
||||||
|
|
||||||
You can specify the full path for tools not in the PATH:
|
|
||||||
|
|
||||||
```js
|
|
||||||
const exec = require('@actions/exec');
|
|
||||||
|
|
||||||
await exec.exec('"/path/to/my-tool"', ['arg1']);
|
|
||||||
```
|
|
||||||
12
node_modules/@actions/exec/lib/exec.d.ts
generated
vendored
12
node_modules/@actions/exec/lib/exec.d.ts
generated
vendored
@@ -1,12 +0,0 @@
|
|||||||
import * as im from './interfaces';
|
|
||||||
/**
|
|
||||||
* Exec a command.
|
|
||||||
* Output will be streamed to the live console.
|
|
||||||
* Returns promise with return code
|
|
||||||
*
|
|
||||||
* @param commandLine command to execute (can include additional args). Must be correctly escaped.
|
|
||||||
* @param args optional arguments for tool. Escaping is handled by the lib.
|
|
||||||
* @param options optional exec options. See ExecOptions
|
|
||||||
* @returns Promise<number> exit code
|
|
||||||
*/
|
|
||||||
export declare function exec(commandLine: string, args?: string[], options?: im.ExecOptions): Promise<number>;
|
|
||||||
37
node_modules/@actions/exec/lib/exec.js
generated
vendored
37
node_modules/@actions/exec/lib/exec.js
generated
vendored
@@ -1,37 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
const tr = require("./toolrunner");
|
|
||||||
/**
|
|
||||||
* Exec a command.
|
|
||||||
* Output will be streamed to the live console.
|
|
||||||
* Returns promise with return code
|
|
||||||
*
|
|
||||||
* @param commandLine command to execute (can include additional args). Must be correctly escaped.
|
|
||||||
* @param args optional arguments for tool. Escaping is handled by the lib.
|
|
||||||
* @param options optional exec options. See ExecOptions
|
|
||||||
* @returns Promise<number> exit code
|
|
||||||
*/
|
|
||||||
function exec(commandLine, args, options) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
const commandArgs = tr.argStringToArray(commandLine);
|
|
||||||
if (commandArgs.length === 0) {
|
|
||||||
throw new Error(`Parameter 'commandLine' cannot be null or empty.`);
|
|
||||||
}
|
|
||||||
// Path to tool to execute should be first arg
|
|
||||||
const toolPath = commandArgs[0];
|
|
||||||
args = commandArgs.slice(1).concat(args || []);
|
|
||||||
const runner = new tr.ToolRunner(toolPath, args, options);
|
|
||||||
return runner.exec();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
exports.exec = exec;
|
|
||||||
//# sourceMappingURL=exec.js.map
|
|
||||||
1
node_modules/@actions/exec/lib/exec.js.map
generated
vendored
1
node_modules/@actions/exec/lib/exec.js.map
generated
vendored
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"exec.js","sourceRoot":"","sources":["../src/exec.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,mCAAkC;AAElC;;;;;;;;;GASG;AACH,SAAsB,IAAI,CACxB,WAAmB,EACnB,IAAe,EACf,OAAwB;;QAExB,MAAM,WAAW,GAAG,EAAE,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAA;QACpD,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;YAC5B,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAA;SACpE;QACD,8CAA8C;QAC9C,MAAM,QAAQ,GAAG,WAAW,CAAC,CAAC,CAAC,CAAA;QAC/B,IAAI,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC,CAAA;QAC9C,MAAM,MAAM,GAAkB,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,CAAA;QACxE,OAAO,MAAM,CAAC,IAAI,EAAE,CAAA;IACtB,CAAC;CAAA;AAdD,oBAcC"}
|
|
||||||
35
node_modules/@actions/exec/lib/interfaces.d.ts
generated
vendored
35
node_modules/@actions/exec/lib/interfaces.d.ts
generated
vendored
@@ -1,35 +0,0 @@
|
|||||||
/// <reference types="node" />
|
|
||||||
import * as stream from 'stream';
|
|
||||||
/**
|
|
||||||
* Interface for exec options
|
|
||||||
*/
|
|
||||||
export interface ExecOptions {
|
|
||||||
/** optional working directory. defaults to current */
|
|
||||||
cwd?: string;
|
|
||||||
/** optional envvar dictionary. defaults to current process's env */
|
|
||||||
env?: {
|
|
||||||
[key: string]: string;
|
|
||||||
};
|
|
||||||
/** optional. defaults to false */
|
|
||||||
silent?: boolean;
|
|
||||||
/** optional out stream to use. Defaults to process.stdout */
|
|
||||||
outStream?: stream.Writable;
|
|
||||||
/** optional err stream to use. Defaults to process.stderr */
|
|
||||||
errStream?: stream.Writable;
|
|
||||||
/** optional. whether to skip quoting/escaping arguments if needed. defaults to false. */
|
|
||||||
windowsVerbatimArguments?: boolean;
|
|
||||||
/** optional. whether to fail if output to stderr. defaults to false */
|
|
||||||
failOnStdErr?: boolean;
|
|
||||||
/** optional. defaults to failing on non zero. ignore will not fail leaving it up to the caller */
|
|
||||||
ignoreReturnCode?: boolean;
|
|
||||||
/** optional. How long in ms to wait for STDIO streams to close after the exit event of the process before terminating. defaults to 10000 */
|
|
||||||
delay?: number;
|
|
||||||
/** optional. Listeners for output. Callback functions that will be called on these events */
|
|
||||||
listeners?: {
|
|
||||||
stdout?: (data: Buffer) => void;
|
|
||||||
stderr?: (data: Buffer) => void;
|
|
||||||
stdline?: (data: string) => void;
|
|
||||||
errline?: (data: string) => void;
|
|
||||||
debug?: (data: string) => void;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
3
node_modules/@actions/exec/lib/interfaces.js
generated
vendored
3
node_modules/@actions/exec/lib/interfaces.js
generated
vendored
@@ -1,3 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
|
||||||
//# sourceMappingURL=interfaces.js.map
|
|
||||||
1
node_modules/@actions/exec/lib/interfaces.js.map
generated
vendored
1
node_modules/@actions/exec/lib/interfaces.js.map
generated
vendored
@@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":""}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user