mirror of
https://github.com/actions/setup-dotnet.git
synced 2026-03-22 14:42:20 +08:00
Compare commits
88 Commits
tool-confi
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a66eefa2bf | ||
|
|
c2fa09f4bd | ||
|
|
02574b18e2 | ||
|
|
16c7b3c2fa | ||
|
|
131b410979 | ||
|
|
baa11fbfe1 | ||
|
|
24ec4f204b | ||
|
|
4c100cb5e4 | ||
|
|
25328d894d | ||
|
|
937b8dd381 | ||
|
|
2016bd2012 | ||
|
|
21e81f65dd | ||
|
|
740310365d | ||
|
|
d4c94342e5 | ||
|
|
5c125af7da | ||
|
|
87c6e11776 | ||
|
|
06a5327ecf | ||
|
|
e8e5b8203e | ||
|
|
bf4cd79173 | ||
|
|
4ddad1c881 | ||
|
|
0f55b457d2 | ||
|
|
267870a9c4 | ||
|
|
67a3573c9a | ||
|
|
83c0c1a6c8 | ||
|
|
3951f0dfe7 | ||
|
|
4849e736f1 | ||
|
|
3e76c4dc41 | ||
|
|
91b379339b | ||
|
|
4b37d22250 | ||
|
|
f9d0f6282c | ||
|
|
87b7050bc5 | ||
|
|
e4c228a841 | ||
|
|
3e891b0cb6 | ||
|
|
2e0b25913c | ||
|
|
29640e4139 | ||
|
|
cbeba61921 | ||
|
|
344ba5f715 | ||
|
|
9be03d3dab | ||
|
|
dbebe359e4 | ||
|
|
6bd8b7f777 | ||
|
|
5d1464d5da | ||
|
|
3e6b9fe393 | ||
|
|
769316e2e4 | ||
|
|
4d6c8fcf3c | ||
|
|
2216f56ae1 | ||
|
|
736bc6dea6 | ||
|
|
f5526c2d1b | ||
|
|
4dba25fa31 | ||
|
|
ada8800330 | ||
|
|
e1749123a8 | ||
|
|
a6be55a915 | ||
|
|
9b40770825 | ||
|
|
48277343a5 | ||
|
|
70fa3206c9 | ||
|
|
7ed547ca75 | ||
|
|
b5ebe9e10a | ||
|
|
89f1766d87 | ||
|
|
d1c99df34e | ||
|
|
faa708d00b | ||
|
|
ea6d1c26e7 | ||
|
|
9471c5df0b | ||
|
|
6eb2af61b6 | ||
|
|
8f71719d12 | ||
|
|
3cdb09485a | ||
|
|
6019612129 | ||
|
|
addb470701 | ||
|
|
820f30d332 | ||
|
|
427804d76a | ||
|
|
89b480a0df | ||
|
|
defac2491f | ||
|
|
916aec40c9 | ||
|
|
3447fd6a9f | ||
|
|
916351aac9 | ||
|
|
1ad2e312fa | ||
|
|
e3f84b8f7a | ||
|
|
2785e21d5e | ||
|
|
80a318b8b8 | ||
|
|
eb0b7f8852 | ||
|
|
5c7ae4f903 | ||
|
|
b7461a1b69 | ||
|
|
cce8e1bad1 | ||
|
|
df506c2d9c | ||
|
|
abf9166e44 | ||
|
|
7e164d3c3b | ||
|
|
3dfe2673eb | ||
|
|
aa85432603 | ||
|
|
6d92b9bd53 | ||
|
|
dd32dd730c |
22
.github/dependabot.yml
vendored
Normal file
22
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
# To get started with Dependabot version updates, you'll need to specify which
|
||||
# package ecosystems to update and where the package manifests are located.
|
||||
# Please see the documentation for all configuration options:
|
||||
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
|
||||
|
||||
version: 2
|
||||
updates:
|
||||
# Enable version updates for npm
|
||||
- package-ecosystem: 'npm'
|
||||
# Look for `package.json` and `lock` files in the `root` directory
|
||||
directory: '/'
|
||||
# Check the npm registry for updates every day (weekdays)
|
||||
schedule:
|
||||
interval: 'weekly'
|
||||
|
||||
# Enable version updates for GitHub Actions
|
||||
- package-ecosystem: 'github-actions'
|
||||
# Workflow files stored in the default location of `.github/workflows`
|
||||
# You don't need to specify `/.github/workflows` for `directory`. You can use `directory: "/"`.
|
||||
directory: '/'
|
||||
schedule:
|
||||
interval: 'weekly'
|
||||
2
.github/workflows/basic-validation.yml
vendored
2
.github/workflows/basic-validation.yml
vendored
@@ -15,3 +15,5 @@ jobs:
|
||||
call-basic-validation:
|
||||
name: Basic validation
|
||||
uses: actions/reusable-workflows/.github/workflows/basic-validation.yml@main
|
||||
with:
|
||||
node-version: '24'
|
||||
|
||||
2
.github/workflows/check-dist.yml
vendored
2
.github/workflows/check-dist.yml
vendored
@@ -15,3 +15,5 @@ jobs:
|
||||
call-check-dist:
|
||||
name: Check dist/
|
||||
uses: actions/reusable-workflows/.github/workflows/check-dist.yml@main
|
||||
with:
|
||||
node-version: '24'
|
||||
|
||||
475
.github/workflows/e2e-tests.yml
vendored
475
.github/workflows/e2e-tests.yml
vendored
@@ -17,176 +17,229 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
|
||||
operating-system:
|
||||
[
|
||||
ubuntu-22.04,
|
||||
ubuntu-latest,
|
||||
windows-latest,
|
||||
macos-latest,
|
||||
macos-15-intel
|
||||
]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v6
|
||||
- name: Clear toolcache
|
||||
shell: pwsh
|
||||
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
|
||||
- name: Setup dotnet 2.2.402, 3.1.404 and 3.0.x
|
||||
- name: Setup dotnet 8.0.416, 8.0.x, 9.0.308 and 10.0.101
|
||||
uses: ./
|
||||
with:
|
||||
dotnet-version: |
|
||||
2.2.402
|
||||
3.1.404
|
||||
3.0.x
|
||||
8.0.416
|
||||
8.0.x
|
||||
9.0.308
|
||||
10.0.101
|
||||
- name: Verify dotnet
|
||||
shell: pwsh
|
||||
run: __tests__/verify-dotnet.ps1 -Patterns "^2.2.402$", "^3.1.404$", "^3.0"
|
||||
|
||||
run: __tests__/verify-dotnet.ps1 -Patterns "^8.0.416$", "^9.0.308$", "^10.0.101$", "^8.0"
|
||||
test-setup-full-version:
|
||||
runs-on: ${{ matrix.operating-system }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
|
||||
operating-system:
|
||||
[
|
||||
ubuntu-22.04,
|
||||
ubuntu-latest,
|
||||
windows-latest,
|
||||
macos-latest,
|
||||
macos-15-intel
|
||||
]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v6
|
||||
- name: Clear toolcache
|
||||
shell: pwsh
|
||||
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
|
||||
# Side-by-side install of 2.2 and 3.1 used for the test project
|
||||
- name: Setup dotnet 2.2.402
|
||||
# Side-by-side install of 9.0 and 10.0 used for the test project
|
||||
- name: Setup dotnet 9.0.308
|
||||
uses: ./
|
||||
with:
|
||||
dotnet-version: 2.2.402
|
||||
- name: Setup dotnet 3.1.201
|
||||
dotnet-version: 9.0.308
|
||||
- name: Setup dotnet 10.0.101
|
||||
uses: ./
|
||||
with:
|
||||
dotnet-version: 3.1.201
|
||||
dotnet-version: 10.0.101
|
||||
# We are including this variable 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
|
||||
shell: pwsh
|
||||
run: __tests__/verify-dotnet.ps1 -Patterns "^3.1.201$", "^2.2.402$" -CheckNugetConfig
|
||||
|
||||
run: __tests__/verify-dotnet.ps1 -Patterns "^10.0.101$", "^9.0.308$" -CheckNugetConfig
|
||||
test-setup-without-patch-version:
|
||||
runs-on: ${{ matrix.operating-system }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
|
||||
operating-system:
|
||||
[
|
||||
ubuntu-22.04,
|
||||
ubuntu-latest,
|
||||
windows-latest,
|
||||
macos-latest,
|
||||
macos-15-intel
|
||||
]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v6
|
||||
- name: Clear toolcache
|
||||
shell: pwsh
|
||||
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
|
||||
# 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 '3.1'
|
||||
# 9.0, 10.0 needs to be in single quotes to interpret as a string instead of as an integer
|
||||
- name: Setup dotnet '9.0'
|
||||
uses: ./
|
||||
with:
|
||||
dotnet-version: '3.1'
|
||||
- name: Setup dotnet '2.2'
|
||||
dotnet-version: '9.0'
|
||||
- name: Setup dotnet '10.0'
|
||||
uses: ./
|
||||
with:
|
||||
dotnet-version: '2.2'
|
||||
dotnet-version: '10.0'
|
||||
- name: Verify dotnet
|
||||
shell: pwsh
|
||||
run: __tests__/verify-dotnet.ps1 -Patterns "^3.1", "^2.2"
|
||||
|
||||
run: __tests__/verify-dotnet.ps1 -Patterns "^9.0", "^10.0"
|
||||
test-setup-prerelease-version:
|
||||
runs-on: ${{ matrix.operating-system }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
|
||||
operating-system:
|
||||
[
|
||||
ubuntu-22.04,
|
||||
ubuntu-latest,
|
||||
windows-latest,
|
||||
macos-latest,
|
||||
macos-15-intel
|
||||
]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v6
|
||||
- name: Clear toolcache
|
||||
shell: pwsh
|
||||
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
|
||||
- name: Setup dotnet '3.1.100-preview1-014459'
|
||||
- name: Setup dotnet '10.0.100-preview.7.25380.108'
|
||||
uses: ./
|
||||
with:
|
||||
dotnet-version: '3.1.100-preview1-014459'
|
||||
dotnet-version: '10.0.100-preview.7.25380.108'
|
||||
- name: Verify dotnet
|
||||
shell: pwsh
|
||||
run: __tests__/verify-dotnet.ps1 -Patterns "3.1.100-preview1-014459"
|
||||
|
||||
run: __tests__/verify-dotnet.ps1 -Patterns "10.0.100-preview.7.25380.108"
|
||||
test-setup-latest-patch-version:
|
||||
runs-on: ${{ matrix.operating-system }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
|
||||
operating-system:
|
||||
[
|
||||
ubuntu-22.04,
|
||||
ubuntu-latest,
|
||||
windows-latest,
|
||||
macos-latest,
|
||||
macos-15-intel
|
||||
]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v6
|
||||
- name: Clear toolcache
|
||||
shell: pwsh
|
||||
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
|
||||
- name: Setup dotnet 3.1.x
|
||||
- name: Setup dotnet 9.0.x
|
||||
uses: ./
|
||||
with:
|
||||
dotnet-version: 3.1.x
|
||||
- name: Setup dotnet 2.2.X
|
||||
dotnet-version: 9.0.x
|
||||
- name: Setup dotnet 10.0.X
|
||||
uses: ./
|
||||
with:
|
||||
dotnet-version: 2.2.X
|
||||
dotnet-version: 10.0.X
|
||||
- name: Verify dotnet
|
||||
shell: pwsh
|
||||
run: __tests__/verify-dotnet.ps1 -Patterns "^2.2", "^3.1"
|
||||
run: __tests__/verify-dotnet.ps1 -Patterns "^9.0", "^10.0"
|
||||
|
||||
test-ABCxx-syntax:
|
||||
runs-on: ${{ matrix.operating-system }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
|
||||
operating-system:
|
||||
[
|
||||
ubuntu-22.04,
|
||||
ubuntu-latest,
|
||||
windows-latest,
|
||||
macos-latest,
|
||||
macos-15-intel
|
||||
]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v6
|
||||
- name: Clear toolcache
|
||||
shell: pwsh
|
||||
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
|
||||
|
||||
- name: Setup dotnet 6.0.4xx
|
||||
- name: Setup dotnet 10.0.1xx
|
||||
uses: ./
|
||||
with:
|
||||
dotnet-version: '6.0.4xx'
|
||||
dotnet-version: '10.0.1xx'
|
||||
- name: Verify dotnet
|
||||
shell: pwsh
|
||||
run: __tests__/verify-dotnet.ps1 -Patterns "^6\.0\.4\d{2}"
|
||||
run: __tests__/verify-dotnet.ps1 -Patterns "^10\.0\.1\d{2}"
|
||||
|
||||
test-setup-with-wildcard:
|
||||
runs-on: ${{ matrix.operating-system }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
|
||||
operating-system:
|
||||
[
|
||||
ubuntu-22.04,
|
||||
ubuntu-latest,
|
||||
windows-latest,
|
||||
macos-latest,
|
||||
macos-15-intel
|
||||
]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v6
|
||||
- name: Clear toolcache
|
||||
shell: pwsh
|
||||
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
|
||||
- name: Setup dotnet 3.1.*
|
||||
- name: Setup dotnet 9.0.*
|
||||
uses: ./
|
||||
with:
|
||||
dotnet-version: 3.1.*
|
||||
- name: Setup dotnet 2.2.*
|
||||
dotnet-version: 9.0.*
|
||||
- name: Setup dotnet 10.0.*
|
||||
uses: ./
|
||||
with:
|
||||
dotnet-version: 2.2.*
|
||||
dotnet-version: 10.0.*
|
||||
- name: Verify dotnet
|
||||
shell: pwsh
|
||||
run: __tests__/verify-dotnet.ps1 -Patterns "^3.1", "^2.2"
|
||||
run: __tests__/verify-dotnet.ps1 -Patterns "^9.0", "^10.0"
|
||||
|
||||
test-setup-global-json-specified-and-version:
|
||||
runs-on: ${{ matrix.operating-system }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
|
||||
operating-system:
|
||||
[
|
||||
ubuntu-22.04,
|
||||
ubuntu-latest,
|
||||
windows-latest,
|
||||
macos-latest,
|
||||
macos-15-intel
|
||||
]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v6
|
||||
- name: Clear toolcache
|
||||
shell: pwsh
|
||||
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
|
||||
@@ -194,25 +247,32 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir subdirectory
|
||||
echo '{"sdk":{"version": "2.2.207","rollForward": "latestFeature"}}' > ./subdirectory/global.json
|
||||
echo '{"sdk":{"version": "9.0.308","rollForward": "latestFeature"}}' > ./subdirectory/global.json
|
||||
- name: Setup dotnet
|
||||
uses: ./
|
||||
with:
|
||||
dotnet-version: 3.1
|
||||
dotnet-version: '10.0'
|
||||
global-json-file: ./subdirectory/global.json
|
||||
- name: Verify dotnet
|
||||
shell: pwsh
|
||||
run: __tests__/verify-dotnet.ps1 -Patterns "^2.2", "^3.1"
|
||||
run: __tests__/verify-dotnet.ps1 -Patterns "^9.0", "^10.0"
|
||||
|
||||
test-setup-global-json-only:
|
||||
runs-on: ${{ matrix.operating-system }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
|
||||
operating-system:
|
||||
[
|
||||
ubuntu-22.04,
|
||||
ubuntu-latest,
|
||||
windows-latest,
|
||||
macos-latest,
|
||||
macos-15-intel
|
||||
]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v6
|
||||
- name: Clear toolcache
|
||||
shell: pwsh
|
||||
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
|
||||
@@ -220,55 +280,175 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir subdirectory
|
||||
echo '{"sdk":{"version": "2.2.207","rollForward": "latestFeature"}}' > ./subdirectory/global.json
|
||||
echo '{"sdk":{"version": "10.0.101","rollForward": "latestFeature"}}' > ./subdirectory/global.json
|
||||
- name: Setup dotnet
|
||||
uses: ./
|
||||
with:
|
||||
global-json-file: ./subdirectory/global.json
|
||||
- name: Verify dotnet
|
||||
shell: pwsh
|
||||
run: __tests__/verify-dotnet.ps1 -Patterns "^2.2"
|
||||
run: __tests__/verify-dotnet.ps1 -Patterns "^10.0"
|
||||
|
||||
test-global-json-with-comments:
|
||||
runs-on: ${{ matrix.operating-system }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
operating-system:
|
||||
[
|
||||
ubuntu-22.04,
|
||||
ubuntu-latest,
|
||||
windows-latest,
|
||||
macos-latest,
|
||||
macos-15-intel
|
||||
]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
- name: Clear toolcache
|
||||
shell: pwsh
|
||||
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
|
||||
- name: Write global.json
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir subdirectory
|
||||
echo '/* should support comments */ {"sdk":{"version": "10.0.101","rollForward": "latestFeature"}} // should support comments' > ./subdirectory/global.json
|
||||
- name: Setup dotnet
|
||||
uses: ./
|
||||
with:
|
||||
global-json-file: ./subdirectory/global.json
|
||||
- name: Verify dotnet
|
||||
shell: pwsh
|
||||
run: __tests__/verify-dotnet.ps1 -Patterns "^10.0"
|
||||
|
||||
test-setup-with-dotnet-quality:
|
||||
runs-on: ${{ matrix.operating-system }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
|
||||
operating-system:
|
||||
[
|
||||
ubuntu-22.04,
|
||||
ubuntu-latest,
|
||||
windows-latest,
|
||||
macos-latest,
|
||||
macos-15-intel
|
||||
]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v6
|
||||
- name: Clear toolcache
|
||||
shell: pwsh
|
||||
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
|
||||
|
||||
- name: Setup dotnet 7.0 with preview quality
|
||||
- name: Setup dotnet 10.0 with preview quality
|
||||
uses: ./
|
||||
with:
|
||||
dotnet-version: '7.0'
|
||||
dotnet-version: '10.0'
|
||||
dotnet-quality: 'preview'
|
||||
- name: Verify dotnet
|
||||
shell: pwsh
|
||||
run: __tests__/verify-dotnet.ps1 -Patterns "^7\.0\.\d+-"
|
||||
run: __tests__/verify-dotnet.ps1 -Patterns "^10\.0\.\d+-"
|
||||
|
||||
test-setup-with-cache:
|
||||
runs-on: ${{ matrix.operating-system }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
operating-system:
|
||||
[
|
||||
ubuntu-22.04,
|
||||
ubuntu-latest,
|
||||
windows-latest,
|
||||
macos-latest,
|
||||
macos-15-intel
|
||||
]
|
||||
env:
|
||||
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
- name: Clear toolcache
|
||||
shell: pwsh
|
||||
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
|
||||
- name: Copy NuGet lock file to root
|
||||
shell: bash
|
||||
run: cp ./__tests__/e2e-test-csproj/packages.lock.json ./packages.lock.json
|
||||
- name: Setup .NET Core 10.0
|
||||
id: setup-dotnet
|
||||
uses: ./
|
||||
with:
|
||||
dotnet-version: '10.0'
|
||||
cache: true
|
||||
- name: Verify Cache
|
||||
if: steps.setup-dotnet.outputs.cache-hit == 'true'
|
||||
shell: bash
|
||||
run: if [[ -e ${NUGET_PACKAGES} ]]; then exit 0; else exit 1; fi
|
||||
- name: Verify dotnet
|
||||
shell: pwsh
|
||||
run: __tests__/verify-dotnet.ps1 -Patterns "^10.0"
|
||||
|
||||
test-setup-with-cache-dependency-path:
|
||||
runs-on: ${{ matrix.operating-system }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
operating-system:
|
||||
[
|
||||
ubuntu-22.04,
|
||||
ubuntu-latest,
|
||||
windows-latest,
|
||||
macos-latest,
|
||||
macos-15-intel
|
||||
]
|
||||
env:
|
||||
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
- name: Clear toolcache
|
||||
shell: pwsh
|
||||
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
|
||||
- name: Setup .NET Core 10.0
|
||||
id: setup-dotnet
|
||||
uses: ./
|
||||
with:
|
||||
dotnet-version: '10.0'
|
||||
cache: true
|
||||
cache-dependency-path: './__tests__/e2e-test-csproj/packages.lock.json'
|
||||
- name: Verify Cache
|
||||
if: steps.setup-dotnet.outputs.cache-hit == 'true'
|
||||
shell: bash
|
||||
run: if [[ -e ${NUGET_PACKAGES} ]]; then exit 0; else exit 1; fi
|
||||
- name: Verify dotnet
|
||||
shell: pwsh
|
||||
run: __tests__/verify-dotnet.ps1 -Patterns "^10.0"
|
||||
|
||||
test-dotnet-version-output-during-single-version-installation:
|
||||
runs-on: ${{ matrix.operating-system }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
|
||||
operating-system:
|
||||
[
|
||||
ubuntu-22.04,
|
||||
ubuntu-latest,
|
||||
windows-latest,
|
||||
macos-latest,
|
||||
macos-15-intel
|
||||
]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v6
|
||||
- name: Clear toolcache
|
||||
shell: pwsh
|
||||
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
|
||||
|
||||
- name: Setup dotnet 6.0.401
|
||||
- name: Setup dotnet 10.0.101
|
||||
uses: ./
|
||||
id: step1
|
||||
with:
|
||||
dotnet-version: '6.0.401'
|
||||
dotnet-version: '10.0.101'
|
||||
|
||||
- name: Verify value of the dotnet-version output
|
||||
shell: pwsh
|
||||
@@ -282,33 +462,40 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
|
||||
operating-system:
|
||||
[
|
||||
ubuntu-22.04,
|
||||
ubuntu-latest,
|
||||
windows-latest,
|
||||
macos-latest,
|
||||
macos-15-intel
|
||||
]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v6
|
||||
- name: Clear toolcache
|
||||
shell: pwsh
|
||||
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
|
||||
|
||||
- name: Setup dotnet 6.0.401, 5.0.408, 7.0.100-rc.1.22431.12
|
||||
- name: Setup dotnet 8.0.402, 9.0.308, 10.0.101
|
||||
uses: ./
|
||||
id: step2
|
||||
with:
|
||||
dotnet-version: |
|
||||
7.0.100-rc.1.22431.12
|
||||
6.0.401
|
||||
5.0.408
|
||||
10.0.101
|
||||
9.0.308
|
||||
8.0.402
|
||||
|
||||
- name: Verify value of the dotnet-version output
|
||||
shell: pwsh
|
||||
run: |
|
||||
$version = "7.0.100-rc.1.22431.12"
|
||||
$version = "10.0.101"
|
||||
if (-not ($version -eq '${{steps.step2.outputs.dotnet-version}}')) { throw "Unexpected output value" }
|
||||
|
||||
test-proxy:
|
||||
runs-on: ubuntu-latest
|
||||
runs-on: ubuntu-22.04
|
||||
container:
|
||||
image: ubuntu:latest
|
||||
image: mcr.microsoft.com/devcontainers/dotnet:10.0
|
||||
options: --dns 127.0.0.1
|
||||
services:
|
||||
squid-proxy:
|
||||
@@ -320,49 +507,145 @@ jobs:
|
||||
http_proxy: http://squid-proxy:3128
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Install Powershell
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y wget apt-transport-https software-properties-common
|
||||
wget -q "https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb"
|
||||
dpkg -i packages-microsoft-prod.deb
|
||||
rm packages-microsoft-prod.deb
|
||||
apt-get update
|
||||
apt-get install -y powershell
|
||||
uses: actions/checkout@v6
|
||||
- name: Clear toolcache
|
||||
shell: pwsh
|
||||
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
|
||||
- name: Setup dotnet 6.0
|
||||
- name: Setup dotnet 10.0
|
||||
uses: ./
|
||||
with:
|
||||
dotnet-version: 6.0
|
||||
dotnet-version: 10.0
|
||||
source-url: https://api.nuget.org/v3/index.json
|
||||
env:
|
||||
NUGET_AUTH_TOKEN: NOTATOKEN
|
||||
- name: Verify dotnet
|
||||
shell: pwsh
|
||||
run: |
|
||||
__tests__/verify-dotnet.ps1 -Patterns "^6.0" -CheckNugetConfig
|
||||
__tests__/verify-dotnet.ps1 -Patterns "^10.0" -CheckNugetConfig
|
||||
|
||||
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
|
||||
no_proxy: github.com,download.visualstudio.microsoft.com,api.nuget.org,builds.dotnet.microsoft.com,ci.dot.net
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v6
|
||||
- name: Clear toolcache
|
||||
shell: pwsh
|
||||
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
|
||||
- name: Setup dotnet 3.1.201
|
||||
- name: Setup dotnet 10.0.101
|
||||
uses: ./
|
||||
with:
|
||||
dotnet-version: 3.1.201
|
||||
dotnet-version: 10.0.101
|
||||
source-url: https://api.nuget.org/v3/index.json
|
||||
env:
|
||||
NUGET_AUTH_TOKEN: NOTATOKEN
|
||||
- name: Verify dotnet
|
||||
shell: pwsh
|
||||
run: __tests__/verify-dotnet.ps1 -Patterns "^3.1.201$" -CheckNugetConfig
|
||||
run: __tests__/verify-dotnet.ps1 -Patterns "^10.0.101$" -CheckNugetConfig
|
||||
|
||||
test-sequential-version-installation:
|
||||
runs-on: ${{ matrix.operating-system }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
operating-system:
|
||||
[
|
||||
ubuntu-22.04,
|
||||
ubuntu-latest,
|
||||
windows-latest,
|
||||
macos-latest,
|
||||
macos-15-intel
|
||||
]
|
||||
lower-version: ['9.0.308']
|
||||
higher-version: ['10.0.101']
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
- name: Clear toolcache
|
||||
shell: pwsh
|
||||
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
|
||||
# Install one version, use it for something, then switch to next version
|
||||
- name: Setup dotnet (lower version)
|
||||
uses: ./
|
||||
with:
|
||||
dotnet-version: ${{ matrix.lower-version }}
|
||||
- name: Verify dotnet (lower version)
|
||||
shell: pwsh
|
||||
run: __tests__/verify-dotnet.ps1 -Patterns "^${{ matrix.lower-version }}$"
|
||||
- name: Setup dotnet (higher version)
|
||||
uses: ./
|
||||
with:
|
||||
dotnet-version: ${{ matrix.higher-version }}
|
||||
- name: Verify dotnet (higher version)
|
||||
shell: pwsh
|
||||
run: __tests__/verify-dotnet.ps1 -Patterns "^${{ matrix.lower-version }}$", "^${{ matrix.higher-version }}$"
|
||||
|
||||
test-setup-with-workloads-input:
|
||||
runs-on: ${{ matrix.operating-system }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
operating-system:
|
||||
[ubuntu-latest, windows-latest, macos-15-intel, macos-latest]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
- name: Clear toolcache
|
||||
shell: pwsh
|
||||
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
|
||||
|
||||
- name: Setup dotnet 9.0 with workloads
|
||||
uses: ./
|
||||
id: setup-dotnet
|
||||
with:
|
||||
dotnet-version: '9.0'
|
||||
workloads: wasm-tools
|
||||
- name: Verify workload
|
||||
shell: pwsh
|
||||
run: |
|
||||
$output = dotnet workload list | Out-String
|
||||
Write-Host "Workload list output:"
|
||||
Write-Host $output
|
||||
if ($output -notmatch "wasm-tools") {
|
||||
throw "Expected workload 'wasm-tools' not found"
|
||||
}
|
||||
- name: Verify dotnet
|
||||
shell: pwsh
|
||||
run: __tests__/verify-dotnet.ps1 -Patterns "^9\.0"
|
||||
|
||||
test-setup-with-architecture-input:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [macos-latest, ubuntu-latest, windows-latest]
|
||||
arch: [x64, arm64]
|
||||
exclude:
|
||||
- os: windows-latest
|
||||
arch: arm64
|
||||
- os: ubuntu-latest
|
||||
arch: arm64
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Clear toolcache
|
||||
shell: pwsh
|
||||
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
|
||||
|
||||
- name: Setup dotnet (${{ matrix.arch }})
|
||||
uses: ./
|
||||
with:
|
||||
dotnet-version: |
|
||||
8.0.416
|
||||
8.0.x
|
||||
9.0.308
|
||||
10.0.101
|
||||
architecture: ${{ matrix.arch }}
|
||||
|
||||
- name: Verify dotnet
|
||||
shell: pwsh
|
||||
run: __tests__/verify-dotnet.ps1 -Patterns "^8.0.416$", "^9.0.308$", "^10.0.101$", "^8.0"
|
||||
|
||||
20
.github/workflows/publish-immutable-actions.yml
vendored
Normal file
20
.github/workflows/publish-immutable-actions.yml
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
name: 'Publish Immutable Action Version'
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: Checking out
|
||||
uses: actions/checkout@v6
|
||||
- name: Publish
|
||||
id: publish
|
||||
uses: actions/publish-immutable-action@v0.0.4
|
||||
@@ -23,7 +23,7 @@ jobs:
|
||||
steps:
|
||||
- name: Update the ${{ env.TAG_NAME }} tag
|
||||
id: update-major-tag
|
||||
uses: actions/publish-action@v0.2.2
|
||||
uses: actions/publish-action@v0.4.0
|
||||
with:
|
||||
source-tag: ${{ env.TAG_NAME }}
|
||||
slack-webhook: ${{ secrets.SLACK_WEBHOOK }}
|
||||
|
||||
13
.github/workflows/test-dotnet.yml
vendored
13
.github/workflows/test-dotnet.yml
vendored
@@ -17,11 +17,18 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
|
||||
dotnet-version: ['2.1', '2.2', '3.0', '3.1', '5.0', '6.0', '7.0', '8.0']
|
||||
operating-system:
|
||||
[
|
||||
ubuntu-latest,
|
||||
ubuntu-22.04,
|
||||
windows-latest,
|
||||
macos-15-intel,
|
||||
macos-latest
|
||||
]
|
||||
dotnet-version: ['8.0', '9.0', '10.0']
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v6
|
||||
- name: Clear toolcache
|
||||
shell: pwsh
|
||||
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
|
||||
|
||||
@@ -3,6 +3,7 @@ sources:
|
||||
|
||||
allowed:
|
||||
- apache-2.0
|
||||
- 0bsd
|
||||
- bsd-2-clause
|
||||
- bsd-3-clause
|
||||
- isc
|
||||
@@ -11,4 +12,5 @@ allowed:
|
||||
- unlicense
|
||||
|
||||
reviewed:
|
||||
npm:
|
||||
npm:
|
||||
- sax # ISC + MIT
|
||||
|
||||
Binary file not shown.
Binary file not shown.
BIN
.licenses/npm/@actions/core-2.0.1.dep.yml
generated
Normal file
BIN
.licenses/npm/@actions/core-2.0.1.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@actions/exec-2.0.0.dep.yml
generated
Normal file
BIN
.licenses/npm/@actions/exec-2.0.0.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@actions/github.dep.yml
generated
BIN
.licenses/npm/@actions/github.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@actions/glob.dep.yml
generated
Normal file
BIN
.licenses/npm/@actions/glob.dep.yml
generated
Normal file
Binary file not shown.
Binary file not shown.
BIN
.licenses/npm/@actions/http-client-3.0.0.dep.yml
generated
Normal file
BIN
.licenses/npm/@actions/http-client-3.0.0.dep.yml
generated
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
.licenses/npm/@azure/abort-controller-1.1.0.dep.yml
generated
Normal file
BIN
.licenses/npm/@azure/abort-controller-1.1.0.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@azure/abort-controller-2.1.2.dep.yml
generated
Normal file
BIN
.licenses/npm/@azure/abort-controller-2.1.2.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@azure/core-auth.dep.yml
generated
Normal file
BIN
.licenses/npm/@azure/core-auth.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@azure/core-client.dep.yml
generated
Normal file
BIN
.licenses/npm/@azure/core-client.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@azure/core-http-compat.dep.yml
generated
Normal file
BIN
.licenses/npm/@azure/core-http-compat.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@azure/core-lro.dep.yml
generated
Normal file
BIN
.licenses/npm/@azure/core-lro.dep.yml
generated
Normal file
Binary file not shown.
Binary file not shown.
BIN
.licenses/npm/@azure/core-rest-pipeline.dep.yml
generated
Normal file
BIN
.licenses/npm/@azure/core-rest-pipeline.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@azure/core-tracing.dep.yml
generated
Normal file
BIN
.licenses/npm/@azure/core-tracing.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@azure/core-util.dep.yml
generated
Normal file
BIN
.licenses/npm/@azure/core-util.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@azure/core-xml.dep.yml
generated
Normal file
BIN
.licenses/npm/@azure/core-xml.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@azure/logger.dep.yml
generated
Normal file
BIN
.licenses/npm/@azure/logger.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@azure/storage-blob.dep.yml
generated
Normal file
BIN
.licenses/npm/@azure/storage-blob.dep.yml
generated
Normal file
Binary file not shown.
Binary file not shown.
BIN
.licenses/npm/@fastify/busboy.dep.yml
generated
Normal file
BIN
.licenses/npm/@fastify/busboy.dep.yml
generated
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
.licenses/npm/@octokit/endpoint.dep.yml
generated
BIN
.licenses/npm/@octokit/endpoint.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@octokit/graphql.dep.yml
generated
BIN
.licenses/npm/@octokit/graphql.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@octokit/openapi-types-19.0.2.dep.yml
generated
Normal file
BIN
.licenses/npm/@octokit/openapi-types-19.0.2.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@octokit/openapi-types-20.0.0.dep.yml
generated
Normal file
BIN
.licenses/npm/@octokit/openapi-types-20.0.0.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@octokit/openapi-types-24.2.0.dep.yml
generated
Normal file
BIN
.licenses/npm/@octokit/openapi-types-24.2.0.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@octokit/plugin-paginate-rest.dep.yml
generated
Normal file
BIN
.licenses/npm/@octokit/plugin-paginate-rest.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@octokit/plugin-rest-endpoint-methods.dep.yml
generated
Normal file
BIN
.licenses/npm/@octokit/plugin-rest-endpoint-methods.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@octokit/request-error.dep.yml
generated
BIN
.licenses/npm/@octokit/request-error.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@octokit/request.dep.yml
generated
BIN
.licenses/npm/@octokit/request.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/@octokit/types-12.3.0.dep.yml
generated
Normal file
BIN
.licenses/npm/@octokit/types-12.3.0.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@octokit/types-12.6.0.dep.yml
generated
Normal file
BIN
.licenses/npm/@octokit/types-12.6.0.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@octokit/types-13.10.0.dep.yml
generated
Normal file
BIN
.licenses/npm/@octokit/types-13.10.0.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@protobuf-ts/runtime-rpc.dep.yml
generated
Normal file
BIN
.licenses/npm/@protobuf-ts/runtime-rpc.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@protobuf-ts/runtime.dep.yml
generated
Normal file
BIN
.licenses/npm/@protobuf-ts/runtime.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/@typespec/ts-http-runtime.dep.yml
generated
Normal file
BIN
.licenses/npm/@typespec/ts-http-runtime.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/agent-base.dep.yml
generated
Normal file
BIN
.licenses/npm/agent-base.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/atob-lite.dep.yml
generated
BIN
.licenses/npm/atob-lite.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/balanced-match.dep.yml
generated
Normal file
BIN
.licenses/npm/balanced-match.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/before-after-hook.dep.yml
generated
BIN
.licenses/npm/before-after-hook.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/brace-expansion.dep.yml
generated
Normal file
BIN
.licenses/npm/brace-expansion.dep.yml
generated
Normal file
Binary file not shown.
Binary file not shown.
BIN
.licenses/npm/cross-spawn.dep.yml
generated
BIN
.licenses/npm/cross-spawn.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/debug.dep.yml
generated
Normal file
BIN
.licenses/npm/debug.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/events.dep.yml
generated
Normal file
BIN
.licenses/npm/events.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/fast-xml-parser.dep.yml
generated
BIN
.licenses/npm/fast-xml-parser.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/get-stream.dep.yml
generated
BIN
.licenses/npm/get-stream.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/http-proxy-agent.dep.yml
generated
Normal file
BIN
.licenses/npm/http-proxy-agent.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/https-proxy-agent.dep.yml
generated
Normal file
BIN
.licenses/npm/https-proxy-agent.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/is-plain-object.dep.yml
generated
BIN
.licenses/npm/is-plain-object.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/is-stream.dep.yml
generated
BIN
.licenses/npm/is-stream.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/isobject.dep.yml
generated
BIN
.licenses/npm/isobject.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/json5.dep.yml
generated
Normal file
BIN
.licenses/npm/json5.dep.yml
generated
Normal file
Binary file not shown.
BIN
.licenses/npm/lodash.get.dep.yml
generated
BIN
.licenses/npm/lodash.get.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/lodash.set.dep.yml
generated
BIN
.licenses/npm/lodash.set.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/lodash.uniq.dep.yml
generated
BIN
.licenses/npm/lodash.uniq.dep.yml
generated
Binary file not shown.
Binary file not shown.
BIN
.licenses/npm/macos-release.dep.yml
generated
BIN
.licenses/npm/macos-release.dep.yml
generated
Binary file not shown.
Binary file not shown.
BIN
.licenses/npm/tr46.dep.yml → .licenses/npm/ms.dep.yml
generated
BIN
.licenses/npm/tr46.dep.yml → .licenses/npm/ms.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/node-fetch.dep.yml
generated
BIN
.licenses/npm/node-fetch.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/npm-run-path.dep.yml
generated
BIN
.licenses/npm/npm-run-path.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/octokit-pagination-methods.dep.yml
generated
BIN
.licenses/npm/octokit-pagination-methods.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/os-name.dep.yml
generated
BIN
.licenses/npm/os-name.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/p-finally.dep.yml
generated
BIN
.licenses/npm/p-finally.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/path-key.dep.yml
generated
BIN
.licenses/npm/path-key.dep.yml
generated
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
.licenses/npm/shebang-command.dep.yml
generated
BIN
.licenses/npm/shebang-command.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/shebang-regex.dep.yml
generated
BIN
.licenses/npm/shebang-regex.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/signal-exit.dep.yml
generated
BIN
.licenses/npm/signal-exit.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/strip-eof.dep.yml
generated
BIN
.licenses/npm/strip-eof.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/strnum.dep.yml
generated
BIN
.licenses/npm/strnum.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/tslib.dep.yml
generated
Normal file
BIN
.licenses/npm/tslib.dep.yml
generated
Normal file
Binary file not shown.
Binary file not shown.
BIN
.licenses/npm/universal-user-agent-4.0.0.dep.yml
generated
BIN
.licenses/npm/universal-user-agent-4.0.0.dep.yml
generated
Binary file not shown.
Binary file not shown.
BIN
.licenses/npm/webidl-conversions.dep.yml
generated
BIN
.licenses/npm/webidl-conversions.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/windows-release.dep.yml
generated
BIN
.licenses/npm/windows-release.dep.yml
generated
Binary file not shown.
BIN
.licenses/npm/yallist.dep.yml
generated
Normal file
BIN
.licenses/npm/yallist.dep.yml
generated
Normal file
Binary file not shown.
224
README.md
224
README.md
@@ -12,9 +12,16 @@ This action sets up a [.NET CLI](https://github.com/dotnet/sdk) environment for
|
||||
> **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://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-software)
|
||||
[Software installed on github hosted runners](https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#supported-software)
|
||||
for .NET SDK versions that are currently available.
|
||||
|
||||
## Breaking changes in V5
|
||||
|
||||
- Upgraded action from node20 to node24
|
||||
> Make sure your runner is on version v2.327.1 or later to ensure compatibility with this release. see [Release Notes](https://github.com/actions/runner/releases/tag/v2.327.1)
|
||||
|
||||
For more details, see the full release notes on the [release page](https://github.com/actions/setup-dotnet/releases/tag/v5.0.0)
|
||||
|
||||
## Usage
|
||||
|
||||
See [action.yml](action.yml)
|
||||
@@ -22,36 +29,53 @@ See [action.yml](action.yml)
|
||||
**Basic**:
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-dotnet@v3
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
dotnet-version: '3.1.x'
|
||||
dotnet-version: '8.0.x'
|
||||
- run: dotnet build <my project>
|
||||
```
|
||||
> **Warning**: Unless a concrete version is specified in the [`global.json`](https://learn.microsoft.com/en-us/dotnet/core/tools/global-json) file, **_the latest .NET version installed on the runner (including preinstalled versions) will be used [by default](https://learn.microsoft.com/en-us/dotnet/core/versions/selection#the-sdk-uses-the-latest-installed-version)_**. Please refer to the [documentation](https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-software) for the currently preinstalled .NET SDK versions.
|
||||
> **Warning**: Unless a concrete version is specified in the [`global.json`](https://learn.microsoft.com/en-us/dotnet/core/tools/global-json) file, **_the latest .NET version installed on the runner (including preinstalled versions) will be used [by default](https://learn.microsoft.com/en-us/dotnet/core/versions/selection#the-sdk-uses-the-latest-installed-version)_**. Please refer to the [documentation](https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#supported-software) for the currently preinstalled .NET SDK versions.
|
||||
|
||||
**Multiple version installation**:
|
||||
```yml
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v6
|
||||
- name: Setup dotnet
|
||||
uses: actions/setup-dotnet@v3
|
||||
uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
dotnet-version: |
|
||||
3.1.x
|
||||
5.0.x
|
||||
8.0.x
|
||||
9.0.x
|
||||
- run: dotnet build <my project>
|
||||
```
|
||||
## Supported version syntax
|
||||
|
||||
The `dotnet-version` input supports following syntax:
|
||||
|
||||
- **A.B.C** (e.g 6.0.400, 7.0.100-preview.7.22377.5) - installs exact version of .NET SDK
|
||||
- **A.B** or **A.B.x** (e.g. 3.1, 3.1.x) - installs the latest patch version of .NET SDK on the channel `3.1`, including prerelease versions (preview, rc)
|
||||
- **A** or **A.x** (e.g. 3, 3.x) - installs the latest minor version of the specified major tag, including prerelease versions (preview, rc)
|
||||
- **A.B.Cxx** (e.g. 6.0.4xx) - available since `.NET 5.0` release. Installs the latest version of the specific SDK release, including prerelease versions (preview, rc).
|
||||
- **A.B.C** (e.g 9.0.308, 10.0.100-preview.1.25120.13) - installs exact version of .NET SDK
|
||||
- **A.B** or **A.B.x** (e.g. 8.0, 8.0.x) - installs the latest patch version of .NET SDK on the channel `8.0`, including prerelease versions (preview, rc)
|
||||
- **A** or **A.x** (e.g. 8, 8.x) - installs the latest minor version of the specified major tag, including prerelease versions (preview, rc)
|
||||
- **A.B.Cxx** (e.g. 8.0.4xx) - available since `.NET 5.0` release. Installs the latest version of the specific SDK release, including prerelease versions (preview, rc).
|
||||
|
||||
|
||||
## Using the `architecture` input
|
||||
Using the architecture input, it is possible to specify the required .NET SDK architecture. Possible values: `x64`, `x86`, `arm64`, `amd64`, `arm`, `s390x`, `ppc64le`, `riscv64`. If the input is not specified, the architecture defaults to the host OS architecture (not all of the architectures are available on all platforms).
|
||||
|
||||
**Example: Install multiple SDK versions for a specific architecture**
|
||||
```yml
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- name: Setup dotnet (x86)
|
||||
uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
dotnet-version: |
|
||||
8.0.x
|
||||
9.0.x
|
||||
architecture: x86
|
||||
- run: dotnet build <my project>
|
||||
```
|
||||
|
||||
## Using the `dotnet-quality` input
|
||||
This input sets up the action to install the latest build of the specified quality in the channel. The possible values of `dotnet-quality` are: **daily**, **signed**, **validated**, **preview**, **ga**.
|
||||
|
||||
@@ -59,10 +83,10 @@ This input sets up the action to install the latest build of the specified quali
|
||||
|
||||
```yml
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-dotnet@v3
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
dotnet-version: '6.0.x'
|
||||
dotnet-version: '8.0.x'
|
||||
dotnet-quality: 'preview'
|
||||
- run: dotnet build <my project>
|
||||
```
|
||||
@@ -74,14 +98,71 @@ steps:
|
||||
|
||||
```yml
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-dotnet@v3
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
global-json-file: csharp/global.json
|
||||
- run: dotnet build <my project>
|
||||
working-directory: csharp
|
||||
```
|
||||
|
||||
## Caching NuGet Packages
|
||||
The action has a built-in functionality for caching and restoring dependencies. It uses [toolkit/cache](https://github.com/actions/toolkit/tree/main/packages/cache) under the hood for caching global packages data but requires less configuration settings. The `cache` input is optional, and caching is turned off by default.
|
||||
|
||||
The action searches for [NuGet Lock files](https://learn.microsoft.com/nuget/consume-packages/package-references-in-project-files#locking-dependencies) (`packages.lock.json`) in the repository root, calculates their hash and uses it as a part of the cache key. If lock file does not exist, this action throws error. Use `cache-dependency-path` for cases when multiple dependency files are used, or they are located in different subdirectories.
|
||||
|
||||
> **Warning**: Caching NuGet packages is available since .NET SDK 2.1.500 and 2.2.100 as the NuGet lock file [is available](https://learn.microsoft.com/nuget/consume-packages/package-references-in-project-files#locking-dependencies) only for NuGet 4.9 and above.
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
dotnet-version: 8.x
|
||||
cache: true
|
||||
- run: dotnet restore --locked-mode
|
||||
```
|
||||
|
||||
> **Note**: This action will only restore `global-packages` folder, so you will probably get the [NU1403](https://learn.microsoft.com/nuget/reference/errors-and-warnings/nu1403) error when running `dotnet restore`.
|
||||
> To avoid this, you can use [`DisableImplicitNuGetFallbackFolder`](https://github.com/dotnet/reproducible-builds/blob/abfe986832aa28597d3340b92469d1a702013d23/Documentation/Reproducible-MSBuild/Techniques/DisableImplicitNuGetFallbackFolder.md) option.
|
||||
|
||||
```xml
|
||||
<PropertyGroup>
|
||||
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder>
|
||||
</PropertyGroup>
|
||||
```
|
||||
|
||||
### Reduce caching size
|
||||
|
||||
> **Note**: Use [`NUGET_PACKAGES`](https://learn.microsoft.com/nuget/reference/cli-reference/cli-ref-environment-variables) environment variable if available. Some action runners already has huge libraries. (ex. Xamarin)
|
||||
|
||||
```yaml
|
||||
env:
|
||||
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
dotnet-version: 8.x
|
||||
cache: true
|
||||
- run: dotnet restore --locked-mode
|
||||
```
|
||||
|
||||
### Caching NuGet packages in monorepos
|
||||
|
||||
```yaml
|
||||
env:
|
||||
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
dotnet-version: 8.x
|
||||
cache: true
|
||||
cache-dependency-path: subdir/packages.lock.json
|
||||
- run: dotnet restore --locked-mode
|
||||
```
|
||||
|
||||
## Matrix Testing
|
||||
Using `setup-dotnet` it's possible to use [matrix syntax](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix) to install several versions of .NET SDK:
|
||||
```yml
|
||||
@@ -90,12 +171,12 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
dotnet: [ '2.1.x', '3.1.x', '5.0.x' ]
|
||||
dotnet: [ '8.0.x', '9.0.x', '10.0.x' ]
|
||||
name: Dotnet ${{ matrix.dotnet }} sample
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v6
|
||||
- name: Setup dotnet
|
||||
uses: actions/setup-dotnet@v3
|
||||
uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
dotnet-version: ${{ matrix.dotnet }}
|
||||
- name: Execute dotnet
|
||||
@@ -110,12 +191,12 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
dotnet: [ '2.1.x', '3.1.x', '5.0.x' ]
|
||||
dotnet: [ '8.0.x', '9.0.x', '10.0.x' ]
|
||||
name: Dotnet ${{ matrix.dotnet }} sample
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v6
|
||||
- name: Setup dotnet
|
||||
uses: actions/setup-dotnet@v3
|
||||
uses: actions/setup-dotnet@v5
|
||||
id: stepid
|
||||
with:
|
||||
dotnet-version: ${{ matrix.dotnet }}
|
||||
@@ -124,15 +205,16 @@ jobs:
|
||||
- name: Execute dotnet
|
||||
run: dotnet build <my project>
|
||||
```
|
||||
>**Note**: When generating a temporary `global.json` within your workflow on Windows, ensure the command is executed using a shell such as PowerShell Core (`pwsh`) or `bash` (where supported) to avoid formatting inconsistencies that could cause .NET commands to fail.
|
||||
## Setting up authentication for nuget feeds
|
||||
|
||||
### Github Package Registry (GPR)
|
||||
```yml
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-dotnet@v3
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
dotnet-version: '3.1.x'
|
||||
dotnet-version: '8.0.x'
|
||||
source-url: https://nuget.pkg.github.com/<owner>/index.json
|
||||
env:
|
||||
NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
||||
@@ -145,7 +227,7 @@ steps:
|
||||
|
||||
### Azure Artifacts
|
||||
```yml
|
||||
- uses: actions/setup-dotnet@v3
|
||||
- uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
source-url: https://pkgs.dev.azure.com/<your-organization>/_packaging/<your-feed-name>/nuget/v3/index.json
|
||||
env:
|
||||
@@ -156,9 +238,9 @@ steps:
|
||||
|
||||
### nuget.org
|
||||
```yml
|
||||
- uses: actions/setup-dotnet@v3
|
||||
- uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
dotnet-version: 3.1.x
|
||||
dotnet-version: 8.0.x
|
||||
- name: Publish the package to nuget.org
|
||||
run: dotnet nuget push */bin/Release/*.nupkg -k $NUGET_AUTH_TOKEN -s https://api.nuget.org/v3/index.json
|
||||
env:
|
||||
@@ -166,6 +248,22 @@ steps:
|
||||
```
|
||||
> **Note**: It's the only way to push a package to nuget.org feed for macOS/Linux machines due to API key config store limitations.
|
||||
|
||||
## Using the `workloads` input
|
||||
The `workloads` input allows you to install .NET workloads as part of the SDK setup. Workloads provide additional platform tools and dependencies for frameworks. This action automatically runs `dotnet workload update` before installing the specified workloads to ensure manifests are refreshed and existing workloads are updated to their latest compatible versions.
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- name: Setup .NET with workloads
|
||||
uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
dotnet-version: '9.0.x'
|
||||
workloads: workload1, workload2 # Specify the workloads required for the project, such as wasm-tools, maui, etc.
|
||||
- run: dotnet build <my project>
|
||||
```
|
||||
|
||||
> **Note**: Ensure workloads are compatible with your runner's OS, architecture, and .NET SDK version before enabling workload installation. Some workloads may require additional installation time due to large toolchain downloads.
|
||||
|
||||
# Outputs and environment variables
|
||||
|
||||
## Outputs
|
||||
@@ -179,11 +277,11 @@ Using the **dotnet-version** output it's possible to get the installed by the ac
|
||||
In case of a single version installation, the `dotnet-version` output contains the version that is installed by the action.
|
||||
|
||||
```yaml
|
||||
- uses: actions/setup-dotnet@v3
|
||||
- uses: actions/setup-dotnet@v5
|
||||
id: stepid
|
||||
with:
|
||||
dotnet-version: 3.1.422
|
||||
- run: echo '${{ steps.stepid.outputs.dotnet-version }}' # outputs 3.1.422
|
||||
dotnet-version: 8.0.416
|
||||
- run: echo '${{ steps.stepid.outputs.dotnet-version }}' # outputs 8.0.416
|
||||
```
|
||||
|
||||
**Multiple version installation**
|
||||
@@ -191,29 +289,32 @@ In case of a single version installation, the `dotnet-version` output contains t
|
||||
In case of a multiple version installation, the `dotnet-version` output contains the latest version that is installed by the action.
|
||||
|
||||
```yaml
|
||||
- uses: actions/setup-dotnet@v3
|
||||
- uses: actions/setup-dotnet@v5
|
||||
id: stepid
|
||||
with:
|
||||
dotnet-version: |
|
||||
3.1.422
|
||||
5.0.408
|
||||
- run: echo '${{ steps.stepid.outputs.dotnet-version }}' # outputs 5.0.408
|
||||
8.0.416
|
||||
9.0.308
|
||||
- run: echo '${{ steps.stepid.outputs.dotnet-version }}' # outputs 9.0.308
|
||||
```
|
||||
**Installation from global.json**
|
||||
|
||||
When the `dotnet-version` input is used along with the `global-json-file` input, the `dotnet-version` output contains the version resolved from the `global.json`.
|
||||
|
||||
```yaml
|
||||
- uses: actions/setup-dotnet@v3
|
||||
- uses: actions/setup-dotnet@v5
|
||||
id: stepid
|
||||
with:
|
||||
dotnet-version: |
|
||||
3.1.422
|
||||
5.0.408
|
||||
global-json-file: "./global.json" # contains version 2.2.207
|
||||
- run: echo '${{ steps.stepid.outputs.dotnet-version }}' # outputs 2.2.207
|
||||
9.0.308
|
||||
10.0.101
|
||||
global-json-file: "./global.json" # contains version 8.0.416
|
||||
- run: echo '${{ steps.stepid.outputs.dotnet-version }}' # outputs 8.0.416
|
||||
```
|
||||
|
||||
### `cache-hit`
|
||||
A boolean value to indicate an exact match was found for the cache key (follows [actions/cache](https://github.com/actions/cache#outputs))
|
||||
|
||||
## Environment variables
|
||||
|
||||
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
|
||||
@@ -224,25 +325,44 @@ Some environment variables may be necessary for your particular case or to impro
|
||||
| DOTNET_NOLOGO |Removes logo and telemetry message from first run of dotnet cli|*false*|
|
||||
| DOTNET_CLI_TELEMETRY_OPTOUT |Opt-out of telemetry being sent to Microsoft|*false*|
|
||||
| DOTNET_MULTILEVEL_LOOKUP |Configures whether the global install location is used as a fall-back|*true*|
|
||||
| NUGET_PACKAGES |Configures a path to the [NuGet `global-packages` folder](https://learn.microsoft.com/nuget/consume-packages/managing-the-global-packages-and-cache-folders)|*default value for each OS* |
|
||||
|
||||
The default value of the `DOTNET_INSTALL_DIR` environment variable depends on the operation system which is used on a runner:
|
||||
| **Operation system** | **Default value** |
|
||||
| ----------- | ----------- |
|
||||
| **Windows** | `C:\Program Files\dotnet` |
|
||||
| **Ubuntu** | `/usr/share/dotnet` |
|
||||
| **macOS** | `/Users/runner/.dotnet` |
|
||||
The default values of the `DOTNET_INSTALL_DIR` and `NUGET_PACKAGES` environment variables depend on the operation system which is used on a runner:
|
||||
| **Operation system** | `DOTNET_INSTALL_DIR` | `NUGET_PACKAGES` |
|
||||
| ----------- | ----------- | ----------- |
|
||||
| **Windows** | `C:\Program Files\dotnet` | `%userprofile%\.nuget\packages` |
|
||||
| **Ubuntu** | `/usr/share/dotnet` | `~/.nuget/packages` |
|
||||
| **macOS** | `/Users/runner/.dotnet` | `~/.nuget/packages` |
|
||||
|
||||
**Example usage**:
|
||||
**Example usage of environment variable**:
|
||||
```yml
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
DOTNET_INSTALL_DIR: "path/to/directory"
|
||||
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
|
||||
steps:
|
||||
- uses: actions/checkout@main
|
||||
- uses: actions/setup-dotnet@v3
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-dotnet@v5
|
||||
with:
|
||||
dotnet-version: '3.1.x'
|
||||
dotnet-version: '8.0.x'
|
||||
cache: true
|
||||
```
|
||||
You can also set `DOTNET_INSTALL_DIR` to a value based on runtime variables, such as `$HOME/.dotnet` or `${{ runner.temp }}/.dotnet` before the `setup-dotnet` step:
|
||||
|
||||
```yml
|
||||
- name: Set DOTNET_INSTALL_DIR
|
||||
run: echo "DOTNET_INSTALL_DIR=$HOME/.dotnet" >> $GITHUB_ENV
|
||||
```
|
||||
> **Note**: On some self-hosted or large Linux runners, installing .NET under the default `/usr/share/dotnet` location may fail due to insufficient permissions. To ensure successful installation, set `DOTNET_INSTALL_DIR` to a user-writable path.
|
||||
|
||||
## Recommended permissions
|
||||
|
||||
When using the `setup-dotnet` action in your GitHub Actions workflow, it is recommended to set the following permissions to ensure proper functionality:
|
||||
|
||||
```yaml
|
||||
permissions:
|
||||
contents: read # access to check out code and install dependencies
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
@@ -1,184 +1,184 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`authutil tests existing config not in repo root, sets up a partial NuGet.config user/PAT for GPR 1`] = `
|
||||
"<?xml version=\\"1.0\\"?>
|
||||
"<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<config>
|
||||
<add key=\\"defaultPushSource\\" value=\\"https://nuget.pkg.github.com/OwnerName/index.json\\"/>
|
||||
<add key="defaultPushSource" value="https://nuget.pkg.github.com/OwnerName/index.json"/>
|
||||
</config>
|
||||
<packageSourceCredentials>
|
||||
<GPR>
|
||||
<add key=\\"Username\\" value=\\"OwnerName\\"/>
|
||||
<add key=\\"ClearTextPassword\\" value=\\"TEST_FAKE_AUTH_TOKEN\\"/>
|
||||
<add key="Username" value="OwnerName"/>
|
||||
<add key="ClearTextPassword" value="TEST_FAKE_AUTH_TOKEN"/>
|
||||
</GPR>
|
||||
</packageSourceCredentials>
|
||||
</configuration>"
|
||||
`;
|
||||
|
||||
exports[`authutil tests existing config w/ Azure Artifacts source and NuGet.org, sets up a partial NuGet.config user/PAT for GPR 1`] = `
|
||||
"<?xml version=\\"1.0\\"?>
|
||||
"<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<config>
|
||||
<add key=\\"defaultPushSource\\" value=\\"https://pkgs.dev.azure.com/amullans/_packaging/GitHubBuilds/nuget/v3/index.json\\"/>
|
||||
<add key="defaultPushSource" value="https://pkgs.dev.azure.com/amullans/_packaging/GitHubBuilds/nuget/v3/index.json"/>
|
||||
</config>
|
||||
<packageSourceCredentials>
|
||||
<AzureArtifacts>
|
||||
<add key=\\"Username\\" value=\\"OwnerName\\"/>
|
||||
<add key=\\"ClearTextPassword\\" value=\\"TEST_FAKE_AUTH_TOKEN\\"/>
|
||||
<add key="Username" value="OwnerName"/>
|
||||
<add key="ClearTextPassword" value="TEST_FAKE_AUTH_TOKEN"/>
|
||||
</AzureArtifacts>
|
||||
</packageSourceCredentials>
|
||||
</configuration>"
|
||||
`;
|
||||
|
||||
exports[`authutil tests existing config w/ GPR source and NuGet.org, sets up a partial NuGet.config user/PAT for GPR 1`] = `
|
||||
"<?xml version=\\"1.0\\"?>
|
||||
"<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<config>
|
||||
<add key=\\"defaultPushSource\\" value=\\"https://nuget.pkg.github.com/OwnerName/index.json\\"/>
|
||||
<add key="defaultPushSource" value="https://nuget.pkg.github.com/OwnerName/index.json"/>
|
||||
</config>
|
||||
<packageSourceCredentials>
|
||||
<GPR>
|
||||
<add key=\\"Username\\" value=\\"OwnerName\\"/>
|
||||
<add key=\\"ClearTextPassword\\" value=\\"TEST_FAKE_AUTH_TOKEN\\"/>
|
||||
<add key="Username" value="OwnerName"/>
|
||||
<add key="ClearTextPassword" value="TEST_FAKE_AUTH_TOKEN"/>
|
||||
</GPR>
|
||||
</packageSourceCredentials>
|
||||
</configuration>"
|
||||
`;
|
||||
|
||||
exports[`authutil tests existing config w/ no GPR sources, sets up a full NuGet.config with URL and user/PAT for GPR 1`] = `
|
||||
"<?xml version=\\"1.0\\"?>
|
||||
"<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<config>
|
||||
<add key=\\"defaultPushSource\\" value=\\"https://nuget.pkg.github.com/OwnerName/index.json\\"/>
|
||||
<add key="defaultPushSource" value="https://nuget.pkg.github.com/OwnerName/index.json"/>
|
||||
</config>
|
||||
<packageSources>
|
||||
<add key=\\"Source\\" value=\\"https://nuget.pkg.github.com/OwnerName/index.json\\"/>
|
||||
<add key="Source" value="https://nuget.pkg.github.com/OwnerName/index.json"/>
|
||||
</packageSources>
|
||||
<packageSourceCredentials>
|
||||
<Source>
|
||||
<add key=\\"Username\\" value=\\"OwnerName\\"/>
|
||||
<add key=\\"ClearTextPassword\\" value=\\"TEST_FAKE_AUTH_TOKEN\\"/>
|
||||
<add key="Username" value="OwnerName"/>
|
||||
<add key="ClearTextPassword" value="TEST_FAKE_AUTH_TOKEN"/>
|
||||
</Source>
|
||||
</packageSourceCredentials>
|
||||
</configuration>"
|
||||
`;
|
||||
|
||||
exports[`authutil tests existing config w/ no sources, sets up a full NuGet.config with URL and user/PAT for GPR 1`] = `
|
||||
"<?xml version=\\"1.0\\"?>
|
||||
"<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<config>
|
||||
<add key=\\"defaultPushSource\\" value=\\"https://nuget.pkg.github.com/OwnerName/index.json\\"/>
|
||||
<add key="defaultPushSource" value="https://nuget.pkg.github.com/OwnerName/index.json"/>
|
||||
</config>
|
||||
<packageSources>
|
||||
<add key=\\"Source\\" value=\\"https://nuget.pkg.github.com/OwnerName/index.json\\"/>
|
||||
<add key="Source" value="https://nuget.pkg.github.com/OwnerName/index.json"/>
|
||||
</packageSources>
|
||||
<packageSourceCredentials>
|
||||
<Source>
|
||||
<add key=\\"Username\\" value=\\"OwnerName\\"/>
|
||||
<add key=\\"ClearTextPassword\\" value=\\"TEST_FAKE_AUTH_TOKEN\\"/>
|
||||
<add key="Username" value="OwnerName"/>
|
||||
<add key="ClearTextPassword" value="TEST_FAKE_AUTH_TOKEN"/>
|
||||
</Source>
|
||||
</packageSourceCredentials>
|
||||
</configuration>"
|
||||
`;
|
||||
|
||||
exports[`authutil tests existing config w/ only Azure Artifacts source, sets up a partial NuGet.config user/PAT for GPR 1`] = `
|
||||
"<?xml version=\\"1.0\\"?>
|
||||
"<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<config>
|
||||
<add key=\\"defaultPushSource\\" value=\\"https://pkgs.dev.azure.com/amullans/_packaging/GitHubBuilds/nuget/v3/index.json\\"/>
|
||||
<add key="defaultPushSource" value="https://pkgs.dev.azure.com/amullans/_packaging/GitHubBuilds/nuget/v3/index.json"/>
|
||||
</config>
|
||||
<packageSourceCredentials>
|
||||
<AzureArtifacts>
|
||||
<add key=\\"Username\\" value=\\"OwnerName\\"/>
|
||||
<add key=\\"ClearTextPassword\\" value=\\"TEST_FAKE_AUTH_TOKEN\\"/>
|
||||
<add key="Username" value="OwnerName"/>
|
||||
<add key="ClearTextPassword" value="TEST_FAKE_AUTH_TOKEN"/>
|
||||
</AzureArtifacts>
|
||||
</packageSourceCredentials>
|
||||
</configuration>"
|
||||
`;
|
||||
|
||||
exports[`authutil tests existing config w/ only GPR source, sets up a partial NuGet.config user/PAT for GPR 1`] = `
|
||||
"<?xml version=\\"1.0\\"?>
|
||||
"<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<config>
|
||||
<add key=\\"defaultPushSource\\" value=\\"https://nuget.pkg.github.com/OwnerName/index.json\\"/>
|
||||
<add key="defaultPushSource" value="https://nuget.pkg.github.com/OwnerName/index.json"/>
|
||||
</config>
|
||||
<packageSourceCredentials>
|
||||
<GPR>
|
||||
<add key=\\"Username\\" value=\\"OwnerName\\"/>
|
||||
<add key=\\"ClearTextPassword\\" value=\\"TEST_FAKE_AUTH_TOKEN\\"/>
|
||||
<add key="Username" value="OwnerName"/>
|
||||
<add key="ClearTextPassword" value="TEST_FAKE_AUTH_TOKEN"/>
|
||||
</GPR>
|
||||
</packageSourceCredentials>
|
||||
</configuration>"
|
||||
`;
|
||||
|
||||
exports[`authutil tests existing config w/ two GPR sources, sets up a partial NuGet.config user/PAT for GPR 1`] = `
|
||||
"<?xml version=\\"1.0\\"?>
|
||||
"<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<config>
|
||||
<add key=\\"defaultPushSource\\" value=\\"https://nuget.pkg.github.com\\"/>
|
||||
<add key="defaultPushSource" value="https://nuget.pkg.github.com"/>
|
||||
</config>
|
||||
<packageSourceCredentials>
|
||||
<GPR-GitHub>
|
||||
<add key=\\"Username\\" value=\\"OwnerName\\"/>
|
||||
<add key=\\"ClearTextPassword\\" value=\\"TEST_FAKE_AUTH_TOKEN\\"/>
|
||||
<add key="Username" value="OwnerName"/>
|
||||
<add key="ClearTextPassword" value="TEST_FAKE_AUTH_TOKEN"/>
|
||||
</GPR-GitHub>
|
||||
<GPR-Actions>
|
||||
<add key=\\"Username\\" value=\\"OwnerName\\"/>
|
||||
<add key=\\"ClearTextPassword\\" value=\\"TEST_FAKE_AUTH_TOKEN\\"/>
|
||||
<add key="Username" value="OwnerName"/>
|
||||
<add key="ClearTextPassword" value="TEST_FAKE_AUTH_TOKEN"/>
|
||||
</GPR-Actions>
|
||||
</packageSourceCredentials>
|
||||
</configuration>"
|
||||
`;
|
||||
|
||||
exports[`authutil tests no existing config, sets up a full NuGet.config with URL and other owner/PAT for GPR 1`] = `
|
||||
"<?xml version=\\"1.0\\"?>
|
||||
"<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<config>
|
||||
<add key=\\"defaultPushSource\\" value=\\"https://nuget.pkg.github.com/otherorg/index.json\\"/>
|
||||
<add key="defaultPushSource" value="https://nuget.pkg.github.com/otherorg/index.json"/>
|
||||
</config>
|
||||
<packageSources>
|
||||
<add key=\\"Source\\" value=\\"https://nuget.pkg.github.com/otherorg/index.json\\"/>
|
||||
<add key="Source" value="https://nuget.pkg.github.com/otherorg/index.json"/>
|
||||
</packageSources>
|
||||
<packageSourceCredentials>
|
||||
<Source>
|
||||
<add key=\\"Username\\" value=\\"otherorg\\"/>
|
||||
<add key=\\"ClearTextPassword\\" value=\\"TEST_FAKE_AUTH_TOKEN\\"/>
|
||||
<add key="Username" value="otherorg"/>
|
||||
<add key="ClearTextPassword" value="TEST_FAKE_AUTH_TOKEN"/>
|
||||
</Source>
|
||||
</packageSourceCredentials>
|
||||
</configuration>"
|
||||
`;
|
||||
|
||||
exports[`authutil tests no existing config, sets up a full NuGet.config with URL and token for other source 1`] = `
|
||||
"<?xml version=\\"1.0\\"?>
|
||||
"<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<config>
|
||||
<add key=\\"defaultPushSource\\" value=\\"https://pkgs.dev.azure.com/amullans/_packaging/GitHubBuilds/nuget/v3/index.json\\"/>
|
||||
<add key="defaultPushSource" value="https://pkgs.dev.azure.com/amullans/_packaging/GitHubBuilds/nuget/v3/index.json"/>
|
||||
</config>
|
||||
<packageSources>
|
||||
<add key=\\"Source\\" value=\\"https://pkgs.dev.azure.com/amullans/_packaging/GitHubBuilds/nuget/v3/index.json\\"/>
|
||||
<add key="Source" value="https://pkgs.dev.azure.com/amullans/_packaging/GitHubBuilds/nuget/v3/index.json"/>
|
||||
</packageSources>
|
||||
<packageSourceCredentials>
|
||||
<Source>
|
||||
<add key=\\"Username\\" value=\\"OwnerName\\"/>
|
||||
<add key=\\"ClearTextPassword\\" value=\\"TEST_FAKE_AUTH_TOKEN\\"/>
|
||||
<add key="Username" value="OwnerName"/>
|
||||
<add key="ClearTextPassword" value="TEST_FAKE_AUTH_TOKEN"/>
|
||||
</Source>
|
||||
</packageSourceCredentials>
|
||||
</configuration>"
|
||||
`;
|
||||
|
||||
exports[`authutil tests no existing config, sets up a full NuGet.config with URL and user/PAT for GPR 1`] = `
|
||||
"<?xml version=\\"1.0\\"?>
|
||||
"<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<config>
|
||||
<add key=\\"defaultPushSource\\" value=\\"https://nuget.pkg.github.com/OwnerName/index.json\\"/>
|
||||
<add key="defaultPushSource" value="https://nuget.pkg.github.com/OwnerName/index.json"/>
|
||||
</config>
|
||||
<packageSources>
|
||||
<add key=\\"Source\\" value=\\"https://nuget.pkg.github.com/OwnerName/index.json\\"/>
|
||||
<add key="Source" value="https://nuget.pkg.github.com/OwnerName/index.json"/>
|
||||
</packageSources>
|
||||
<packageSourceCredentials>
|
||||
<Source>
|
||||
<add key=\\"Username\\" value=\\"OwnerName\\"/>
|
||||
<add key=\\"ClearTextPassword\\" value=\\"TEST_FAKE_AUTH_TOKEN\\"/>
|
||||
<add key="Username" value="OwnerName"/>
|
||||
<add key="ClearTextPassword" value="TEST_FAKE_AUTH_TOKEN"/>
|
||||
</Source>
|
||||
</packageSourceCredentials>
|
||||
</configuration>"
|
||||
|
||||
101
__tests__/cache-restore.test.ts
Normal file
101
__tests__/cache-restore.test.ts
Normal file
@@ -0,0 +1,101 @@
|
||||
import {readdir} from 'node:fs/promises';
|
||||
import * as cache from '@actions/cache';
|
||||
import * as core from '@actions/core';
|
||||
import * as glob from '@actions/glob';
|
||||
import {restoreCache} from '../src/cache-restore';
|
||||
import {getNuGetFolderPath} from '../src/cache-utils';
|
||||
import {lockFilePatterns} from '../src/constants';
|
||||
|
||||
jest.mock('node:fs/promises');
|
||||
jest.mock('@actions/cache');
|
||||
jest.mock('@actions/core');
|
||||
jest.mock('@actions/glob');
|
||||
jest.mock('../src/cache-utils');
|
||||
|
||||
describe('cache-restore tests', () => {
|
||||
describe.each(lockFilePatterns)('restoreCache("%s")', lockFilePattern => {
|
||||
/** Store original process.env.GITHUB_WORKSPACE */
|
||||
let githubWorkspace: string | undefined;
|
||||
beforeAll(() => {
|
||||
githubWorkspace = process.env.GITHUB_WORKSPACE;
|
||||
jest.mocked(getNuGetFolderPath).mockResolvedValue({
|
||||
'global-packages': 'global-packages',
|
||||
'http-cache': 'http-cache',
|
||||
temp: 'temp',
|
||||
'plugins-cache': 'plugins-cache'
|
||||
});
|
||||
});
|
||||
beforeEach(() => {
|
||||
process.env.GITHUB_WORKSPACE = './';
|
||||
jest.mocked(glob.hashFiles).mockClear();
|
||||
jest.mocked(core.saveState).mockClear();
|
||||
jest.mocked(core.setOutput).mockClear();
|
||||
jest.mocked(cache.restoreCache).mockClear();
|
||||
});
|
||||
afterEach(() => (process.env.GITHUB_WORKSPACE = githubWorkspace));
|
||||
|
||||
it('throws error when lock file is not found', async () => {
|
||||
jest.mocked(glob.hashFiles).mockResolvedValue('');
|
||||
|
||||
await expect(restoreCache(lockFilePattern)).rejects.toThrow();
|
||||
|
||||
expect(jest.mocked(core.saveState)).not.toHaveBeenCalled();
|
||||
expect(jest.mocked(core.setOutput)).not.toHaveBeenCalled();
|
||||
expect(jest.mocked(cache.restoreCache)).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('does not call core.saveState("CACHE_RESULT") when cache.restoreCache() returns falsy', async () => {
|
||||
jest.mocked(glob.hashFiles).mockResolvedValue('hash');
|
||||
jest.mocked(cache.restoreCache).mockResolvedValue(undefined);
|
||||
|
||||
await restoreCache(lockFilePattern);
|
||||
|
||||
const expectedKey = `dotnet-cache-${process.env.RUNNER_OS}-hash`;
|
||||
expect(jest.mocked(core.saveState)).toHaveBeenCalledWith(
|
||||
'CACHE_KEY',
|
||||
expectedKey
|
||||
);
|
||||
expect(jest.mocked(core.saveState)).not.toHaveBeenCalledWith(
|
||||
'CACHE_RESULT',
|
||||
expectedKey
|
||||
);
|
||||
expect(jest.mocked(core.setOutput)).toHaveBeenCalledWith(
|
||||
'cache-hit',
|
||||
false
|
||||
);
|
||||
});
|
||||
|
||||
it('calls core.saveState("CACHE_RESULT") when cache.restoreCache() returns key', async () => {
|
||||
const expectedKey = `dotnet-cache-${process.env.RUNNER_OS}-hash`;
|
||||
jest.mocked(glob.hashFiles).mockResolvedValue('hash');
|
||||
jest.mocked(cache.restoreCache).mockResolvedValue(expectedKey);
|
||||
|
||||
await restoreCache(lockFilePattern);
|
||||
|
||||
expect(jest.mocked(core.saveState)).toHaveBeenCalledWith(
|
||||
'CACHE_KEY',
|
||||
expectedKey
|
||||
);
|
||||
expect(jest.mocked(core.saveState)).toHaveBeenCalledWith(
|
||||
'CACHE_RESULT',
|
||||
expectedKey
|
||||
);
|
||||
expect(jest.mocked(core.setOutput)).toHaveBeenCalledWith(
|
||||
'cache-hit',
|
||||
true
|
||||
);
|
||||
});
|
||||
|
||||
it('calls glob.hashFiles("/packages.lock.json") if cacheDependencyPath is falsy', async () => {
|
||||
const expectedKey = `dotnet-cache-${process.env.RUNNER_OS}-hash`;
|
||||
jest.mocked(glob.hashFiles).mockResolvedValue('hash');
|
||||
jest.mocked(cache.restoreCache).mockResolvedValue(expectedKey);
|
||||
jest.mocked(readdir).mockResolvedValue([lockFilePattern] as any);
|
||||
|
||||
await restoreCache('');
|
||||
|
||||
expect(jest.mocked(glob.hashFiles)).not.toHaveBeenCalledWith('');
|
||||
expect(jest.mocked(glob.hashFiles)).toHaveBeenCalledWith(lockFilePattern);
|
||||
});
|
||||
});
|
||||
});
|
||||
87
__tests__/cache-save.test.ts
Normal file
87
__tests__/cache-save.test.ts
Normal file
@@ -0,0 +1,87 @@
|
||||
import * as cache from '@actions/cache';
|
||||
import * as core from '@actions/core';
|
||||
import fs from 'node:fs';
|
||||
import {run} from '../src/cache-save';
|
||||
import {getNuGetFolderPath} from '../src/cache-utils';
|
||||
|
||||
jest.mock('@actions/cache');
|
||||
jest.mock('@actions/core');
|
||||
jest.mock('node:fs');
|
||||
jest.mock('../src/cache-utils');
|
||||
|
||||
describe('cache-save tests', () => {
|
||||
beforeAll(() => {
|
||||
jest.mocked(getNuGetFolderPath).mockResolvedValue({
|
||||
'global-packages': 'global-packages',
|
||||
'http-cache': 'http-cache',
|
||||
temp: 'temp',
|
||||
'plugins-cache': 'plugins-cache'
|
||||
});
|
||||
});
|
||||
beforeEach(() => {
|
||||
jest.mocked(core.setFailed).mockClear();
|
||||
jest.mocked(core.getState).mockClear();
|
||||
jest.mocked(core.setOutput).mockClear();
|
||||
jest.mocked(cache.saveCache).mockClear();
|
||||
jest.mocked(fs.existsSync).mockClear();
|
||||
});
|
||||
|
||||
it('does not save cache when inputs:cache === false', async () => {
|
||||
jest.mocked(core.getBooleanInput).mockReturnValue(false);
|
||||
|
||||
await run();
|
||||
|
||||
expect(jest.mocked(core.setFailed)).not.toHaveBeenCalled();
|
||||
expect(jest.mocked(core.getState)).not.toHaveBeenCalled();
|
||||
expect(jest.mocked(fs.existsSync)).not.toHaveBeenCalled();
|
||||
expect(jest.mocked(cache.saveCache)).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('does not save cache when core.getState("CACHE_KEY") returns ""', async () => {
|
||||
jest.mocked(core.getBooleanInput).mockReturnValue(true);
|
||||
jest.mocked(core.getState).mockReturnValue('');
|
||||
|
||||
await run();
|
||||
|
||||
expect(jest.mocked(core.setFailed)).not.toHaveBeenCalled();
|
||||
expect(jest.mocked(core.getState)).toHaveBeenCalledTimes(2);
|
||||
expect(jest.mocked(fs.existsSync)).not.toHaveBeenCalled();
|
||||
expect(jest.mocked(cache.saveCache)).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('throws Error when cachePath not exists', async () => {
|
||||
jest.mocked(core.getBooleanInput).mockReturnValue(true);
|
||||
jest.mocked(core.getState).mockReturnValue('cache-key');
|
||||
jest.mocked(fs.existsSync).mockReturnValue(false);
|
||||
|
||||
await run();
|
||||
|
||||
expect(jest.mocked(core.setFailed)).toHaveBeenCalled();
|
||||
expect(jest.mocked(core.getState)).toHaveBeenCalledTimes(2);
|
||||
expect(jest.mocked(cache.saveCache)).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('does not save cache when state.CACHE_KEY === state.CACHE_RESULT', async () => {
|
||||
jest.mocked(core.getBooleanInput).mockReturnValue(true);
|
||||
jest.mocked(core.getState).mockReturnValue('cache-key');
|
||||
jest.mocked(fs.existsSync).mockReturnValue(true);
|
||||
|
||||
await run();
|
||||
|
||||
expect(jest.mocked(core.setFailed)).not.toHaveBeenCalled();
|
||||
expect(jest.mocked(core.getState)).toHaveBeenCalledTimes(2);
|
||||
expect(jest.mocked(cache.saveCache)).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('saves cache when state.CACHE_KEY !== state.CACHE_RESULT', async () => {
|
||||
jest.mocked(core.getBooleanInput).mockReturnValue(true);
|
||||
jest.mocked(core.getState).mockImplementation(s => s);
|
||||
jest.mocked(fs.existsSync).mockReturnValue(true);
|
||||
|
||||
await run();
|
||||
|
||||
expect(jest.mocked(core.setFailed)).not.toHaveBeenCalled();
|
||||
expect(jest.mocked(core.getState)).toHaveBeenCalledTimes(2);
|
||||
expect(jest.mocked(cache.saveCache)).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
122
__tests__/cache-utils.test.ts
Normal file
122
__tests__/cache-utils.test.ts
Normal file
@@ -0,0 +1,122 @@
|
||||
import * as cache from '@actions/cache';
|
||||
import * as exec from '@actions/exec';
|
||||
|
||||
import {getNuGetFolderPath, isCacheFeatureAvailable} from '../src/cache-utils';
|
||||
|
||||
jest.mock('@actions/cache');
|
||||
jest.mock('@actions/core');
|
||||
jest.mock('@actions/exec');
|
||||
|
||||
describe('cache-utils tests', () => {
|
||||
describe('getNuGetFolderPath()', () => {
|
||||
it.each([
|
||||
[
|
||||
`
|
||||
http-cache: /home/codespace/.local/share/NuGet/v3-cache
|
||||
global-packages: /var/nuget
|
||||
temp: /tmp/NuGetScratch
|
||||
plugins-cache: /home/codespace/.local/share/NuGet/plugins-cache
|
||||
`,
|
||||
{
|
||||
'http-cache': '/home/codespace/.local/share/NuGet/v3-cache',
|
||||
'global-packages': '/var/nuget',
|
||||
temp: '/tmp/NuGetScratch',
|
||||
'plugins-cache': '/home/codespace/.local/share/NuGet/plugins-cache'
|
||||
}
|
||||
],
|
||||
[
|
||||
`
|
||||
http-cache: /home/codespace/.local/share/NuGet/v3-cache
|
||||
global-packages: /var/nuget
|
||||
temp: /tmp/NuGetScratch
|
||||
plugins-cache: /home/codespace/.local/share/NuGet/plugins-cache
|
||||
`,
|
||||
{
|
||||
'http-cache': '/home/codespace/.local/share/NuGet/v3-cache',
|
||||
'global-packages': '/var/nuget',
|
||||
temp: '/tmp/NuGetScratch',
|
||||
'plugins-cache': '/home/codespace/.local/share/NuGet/plugins-cache'
|
||||
}
|
||||
],
|
||||
[
|
||||
`
|
||||
http-cache: C:\\Users\\user\\AppData\\Local\\NuGet\\v3-cache
|
||||
global-packages: C:\\Users\\user\\.nuget\\packages\\
|
||||
temp: C:\\Users\\user\\AppData\\Local\\Temp\\NuGetScratch
|
||||
plugins-cache: C:\\Users\\user\\AppData\\Local\\NuGet\\plugins-cache
|
||||
`,
|
||||
{
|
||||
'http-cache': 'C:\\Users\\user\\AppData\\Local\\NuGet\\v3-cache',
|
||||
'global-packages': 'C:\\Users\\user\\.nuget\\packages\\',
|
||||
temp: 'C:\\Users\\user\\AppData\\Local\\Temp\\NuGetScratch',
|
||||
'plugins-cache':
|
||||
'C:\\Users\\user\\AppData\\Local\\NuGet\\plugins-cache'
|
||||
}
|
||||
],
|
||||
[
|
||||
`
|
||||
http-cache: C:\\Users\\user\\AppData\\Local\\NuGet\\v3-cache
|
||||
global-packages: C:\\Users\\user\\.nuget\\packages\\
|
||||
temp: C:\\Users\\user\\AppData\\Local\\Temp\\NuGetScratch
|
||||
plugins-cache: C:\\Users\\user\\AppData\\Local\\NuGet\\plugins-cache
|
||||
`,
|
||||
{
|
||||
'http-cache': 'C:\\Users\\user\\AppData\\Local\\NuGet\\v3-cache',
|
||||
'global-packages': 'C:\\Users\\user\\.nuget\\packages\\',
|
||||
temp: 'C:\\Users\\user\\AppData\\Local\\Temp\\NuGetScratch',
|
||||
'plugins-cache':
|
||||
'C:\\Users\\user\\AppData\\Local\\NuGet\\plugins-cache'
|
||||
}
|
||||
]
|
||||
])('(stdout: "%s") returns %p', async (stdout, expected) => {
|
||||
jest
|
||||
.mocked(exec.getExecOutput)
|
||||
.mockResolvedValue({stdout, stderr: '', exitCode: 0});
|
||||
const pathes = await getNuGetFolderPath();
|
||||
expect(pathes).toStrictEqual(expected);
|
||||
});
|
||||
|
||||
it.each([
|
||||
`
|
||||
error: An invalid local resource name was provided. Provide one of the following values: http-cache, temp, global-packages, all.
|
||||
Usage: dotnet nuget locals [arguments] [options]
|
||||
Arguments:
|
||||
Cache Location(s) Specifies the cache location(s) to list or clear.
|
||||
<all | http-cache | global-packages | temp>
|
||||
Options:
|
||||
-h|--help Show help information
|
||||
--force-english-output Forces the application to run using an invariant, English-based culture.
|
||||
-c|--clear Clear the selected local resources or cache location(s).
|
||||
-l|--list List the selected local resources or cache location(s).
|
||||
`,
|
||||
'bash: dotnet: command not found',
|
||||
''
|
||||
])('(stderr: "%s", exitCode: 1) throws Error', async stderr => {
|
||||
jest
|
||||
.mocked(exec.getExecOutput)
|
||||
.mockResolvedValue({stdout: '', stderr, exitCode: 1});
|
||||
await expect(getNuGetFolderPath()).rejects.toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
describe.each(['', 'https://github.com/', 'https://example.com/'])(
|
||||
'isCacheFeatureAvailable()',
|
||||
url => {
|
||||
// Save & Restore env
|
||||
let serverUrlEnv: string | undefined;
|
||||
beforeAll(() => (serverUrlEnv = process.env['GITHUB_SERVER_URL']));
|
||||
beforeEach(() => (process.env['GITHUB_SERVER_URL'] = url));
|
||||
afterEach(() => (process.env['GITHUB_SERVER_URL'] = serverUrlEnv));
|
||||
|
||||
it('returns true when cache.isFeatureAvailable() === true', () => {
|
||||
jest.mocked(cache.isFeatureAvailable).mockReturnValue(true);
|
||||
expect(isCacheFeatureAvailable()).toBe(true);
|
||||
});
|
||||
|
||||
it('returns false when cache.isFeatureAvailable() === false', () => {
|
||||
jest.mocked(cache.isFeatureAvailable).mockReturnValue(false);
|
||||
expect(isCacheFeatureAvailable()).toBe(false);
|
||||
});
|
||||
}
|
||||
);
|
||||
});
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user