diff --git a/.github/workflows/basic-validation.yml b/.github/workflows/basic-validation.yml index 4bcf16ca5..f77a24015 100644 --- a/.github/workflows/basic-validation.yml +++ b/.github/workflows/basic-validation.yml @@ -5,9 +5,6 @@ on: paths-ignore: - '**.md' push: - branches: - - main - - releases/* paths-ignore: - '**.md' diff --git a/.github/workflows/check-dist.yml b/.github/workflows/check-dist.yml index 30aa2210d..587d9896f 100644 --- a/.github/workflows/check-dist.yml +++ b/.github/workflows/check-dist.yml @@ -2,8 +2,6 @@ name: Check dist/ on: push: - branches: - - main paths-ignore: - '**.md' pull_request: diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 7a8261238..c18410c0c 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -2,9 +2,7 @@ name: CodeQL analysis on: push: - branches: [main] pull_request: - branches: [main] schedule: - cron: '0 3 * * 0' diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index 43b538719..d9c51f8ed 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -5,9 +5,6 @@ on: paths-ignore: - '**.md' push: - branches: - - main - - releases/* paths-ignore: - '**.md' @@ -204,6 +201,106 @@ jobs: shell: pwsh run: __tests__/verify-dotnet.ps1 -Patterns "^2.2", "^3.1" + test-setup-global-json-rollforward-latestmajor: + runs-on: ${{ matrix.operating-system }} + strategy: + fail-fast: false + matrix: + operating-system: [ubuntu-latest, windows-latest, macos-13] + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Clear toolcache + shell: pwsh + run: __tests__/clear-toolcache.ps1 ${{ runner.os }} + - name: Write global.json + shell: bash + run: | + mkdir subdirectory + echo '{"sdk":{"version": "3.1.0","rollForward": "latestMajor"}}' > ./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 "^(?!3)" + + test-setup-global-json-rollforward-latestminor: + runs-on: ${{ matrix.operating-system }} + strategy: + fail-fast: false + matrix: + operating-system: [ubuntu-latest, windows-latest, macos-13] + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Clear toolcache + shell: pwsh + run: __tests__/clear-toolcache.ps1 ${{ runner.os }} + - name: Write global.json + shell: bash + run: | + mkdir subdirectory + echo '{"sdk":{"version": "3.0.100","rollForward": "latestMinor"}}' > ./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 "^3.1" + + test-setup-global-json-rollforward-latestfeature: + runs-on: ${{ matrix.operating-system }} + strategy: + fail-fast: false + matrix: + operating-system: [ubuntu-latest, windows-latest, macos-13] + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Clear toolcache + shell: pwsh + run: __tests__/clear-toolcache.ps1 ${{ runner.os }} + - name: Write global.json + shell: bash + run: | + mkdir subdirectory + echo '{"sdk":{"version": "3.1.100","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 "^3.1.4" + + test-setup-global-json-rollforward-latestpatch: + runs-on: ${{ matrix.operating-system }} + strategy: + fail-fast: false + matrix: + operating-system: [ubuntu-latest, windows-latest, macos-13] + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Clear toolcache + shell: pwsh + run: __tests__/clear-toolcache.ps1 ${{ runner.os }} + - name: Write global.json + shell: bash + run: | + mkdir subdirectory + echo '{"sdk":{"version": "5.0.400","rollForward": "latestPatch"}}' > ./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 "^5.0.408$" + test-setup-global-json-only: runs-on: ${{ matrix.operating-system }} strategy: diff --git a/.github/workflows/licensed.yml b/.github/workflows/licensed.yml index 37f1560c3..d6ac99605 100644 --- a/.github/workflows/licensed.yml +++ b/.github/workflows/licensed.yml @@ -2,11 +2,7 @@ name: Licensed on: push: - branches: - - main pull_request: - branches: - - main workflow_dispatch: jobs: diff --git a/.github/workflows/test-dotnet.yml b/.github/workflows/test-dotnet.yml index 32f91acd4..0c9b742d0 100644 --- a/.github/workflows/test-dotnet.yml +++ b/.github/workflows/test-dotnet.yml @@ -5,9 +5,6 @@ on: paths-ignore: - '**.md' push: - branches: - - main - - releases/* paths-ignore: - '**.md' diff --git a/__tests__/clear-toolcache.ps1 b/__tests__/clear-toolcache.ps1 index 5589ec1dd..a8bd902d1 100644 --- a/__tests__/clear-toolcache.ps1 +++ b/__tests__/clear-toolcache.ps1 @@ -6,8 +6,8 @@ $dotnetPaths = @{ foreach ($srcPath in $dotnetPaths[$args[0]]) { if (Test-Path $srcPath) { - Write-Host "Move $srcPath path" - $dstPath = Join-Path ([IO.Path]::GetTempPath()) ([IO.Path]::GetRandomFileName()) + $dstPath = "$srcPath-" + [IO.Path]::GetRandomFileName() + Write-Host "Moving $srcPath to $dstPath" Move-Item -Path $srcPath -Destination $dstPath } } \ No newline at end of file diff --git a/dist/setup/index.js b/dist/setup/index.js index 405862d3b..6d3a0e44e 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -94096,9 +94096,23 @@ function getVersionFromGlobalJson(globalJsonPath) { if (globalJson.sdk && globalJson.sdk.version) { version = globalJson.sdk.version; const rollForward = globalJson.sdk.rollForward; - if (rollForward && rollForward === 'latestFeature') { - const [major, minor] = version.split('.'); - version = `${major}.${minor}`; + if (rollForward) { + const [major, minor, featurePatch] = version.split('.'); + const feature = featurePatch.substring(0, 1); + switch (rollForward) { + case 'latestMajor': + version = ''; + break; + case 'latestMinor': + version = `${major}`; + break; + case 'latestFeature': + version = `${major}.${minor}`; + break; + case 'latestPatch': + version = `${major}.${minor}.${feature}xx`; + break; + } } } return version; diff --git a/externals/install-dotnet.sh b/externals/install-dotnet.sh index 42c201af4..caa3ea450 100755 --- a/externals/install-dotnet.sh +++ b/externals/install-dotnet.sh @@ -327,6 +327,10 @@ get_machine_architecture() { echo "loongarch64" return 0 ;; + riscv64) + echo "riscv64" + return 0 + ;; esac fi diff --git a/src/setup-dotnet.ts b/src/setup-dotnet.ts index 2a628a5ab..60434566e 100644 --- a/src/setup-dotnet.ts +++ b/src/setup-dotnet.ts @@ -110,9 +110,27 @@ function getVersionFromGlobalJson(globalJsonPath: string): string { if (globalJson.sdk && globalJson.sdk.version) { version = globalJson.sdk.version; const rollForward = globalJson.sdk.rollForward; - if (rollForward && rollForward === 'latestFeature') { - const [major, minor] = version.split('.'); - version = `${major}.${minor}`; + if (rollForward) { + const [major, minor, featurePatch] = version.split('.'); + const feature = featurePatch.substring(0, 1); + + switch (rollForward) { + case 'latestMajor': + version = ''; + break; + + case 'latestMinor': + version = `${major}`; + break; + + case 'latestFeature': + version = `${major}.${minor}`; + break; + + case 'latestPatch': + version = `${major}.${minor}.${feature}xx`; + break; + } } } return version;