diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml new file mode 100644 index 000000000..691ededf4 --- /dev/null +++ b/.github/workflows/ci-test.yml @@ -0,0 +1,44 @@ +name: CI Tests + +on: + push: + branches: [ main ] + tags: [ v* ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ main ] + paths-ignore: [ '**/*.md' ] + merge_group: + types: [ checks_requested ] + +jobs: + os_matrix: + strategy: + matrix: + os: [ windows-latest, macos-latest, ubuntu-latest ] + runs-on: ${{ matrix.os }} + env: + DOTNET_NOLOGO: true + DOTNET_CLI_TELEMETRY_OPTOUT: true + DOTNET_GENERATE_ASPNET_CERTIFICATE: false + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Install dotnet + uses: actions/setup-dotnet@v4 + with: + dotnet-version: | + 6.0.x + 7.0.x + - name: Run setup and build script + shell: pwsh + run: tools/azurePipelinesBuild.ps1 + - name: Run tests + shell: pwsh + run: Invoke-Build Test -Configuration Release + - name: Upload test results + uses: actions/upload-artifact@v3 + if: ${{ always() }} + with: + name: ${{ matrix.os }}-test-results + path: '**/*.trx' diff --git a/.vsts-ci/azure-pipelines-ci.yml b/.vsts-ci/azure-pipelines-ci.yml index 64f10d89f..557fcf3af 100644 --- a/.vsts-ci/azure-pipelines-ci.yml +++ b/.vsts-ci/azure-pipelines-ci.yml @@ -9,40 +9,25 @@ pr: variables: # Don't download unneeded packages - - name: DOTNET_SKIP_FIRST_TIME_EXPERIENCE + - name: DOTNET_NOLOGO value: 'true' # Improve performance by not sending telemetry - name: DOTNET_CLI_TELEMETRY_OPTOUT value: 'true' + # Improve performance by not generating certificates + - name: DOTNET_GENERATE_ASPNET_CERTIFICATE + value: 'false' jobs: - job: windows2022 - displayName: Windows 2022 PowerShell 5.1 - pool: - vmImage: windows-2022 - steps: - - template: templates/ci-general.yml - parameters: - pwsh: false - -- job: windows2022pwsh - displayName: Windows 2022 PowerShell 7 + displayName: Windows 2022 pool: vmImage: windows-2022 steps: - template: templates/ci-general.yml - job: windows2019 - displayName: Windows 2019 PowerShell 5.1 - pool: - vmImage: windows-2019 - steps: - - template: templates/ci-general.yml - parameters: - pwsh: false - -- job: windows2019pwsh - displayName: Windows 2019 PowerShell 7 + displayName: Windows 2019 pool: vmImage: windows-2019 steps: diff --git a/.vsts-ci/azure-pipelines-release.yml b/.vsts-ci/azure-pipelines-release.yml index fc20fef92..95877edf2 100644 --- a/.vsts-ci/azure-pipelines-release.yml +++ b/.vsts-ci/azure-pipelines-release.yml @@ -1,17 +1,20 @@ name: Release-$(Build.SourceBranchName)-$(Date:yyyyMMdd)$(Rev:.rr) +trigger: + branches: + include: + - release + variables: # Don't download unneeded packages - - name: DOTNET_SKIP_FIRST_TIME_EXPERIENCE + - name: DOTNET_NOLOGO value: 'true' # Improve performance by not sending telemetry - name: DOTNET_CLI_TELEMETRY_OPTOUT value: 'true' - -trigger: - branches: - include: - - release + # Improve performance by not generating certificates + - name: DOTNET_GENERATE_ASPNET_CERTIFICATE + value: 'false' resources: repositories: diff --git a/.vsts-ci/templates/ci-general.yml b/.vsts-ci/templates/ci-general.yml index a4a8a04d5..b0268167f 100644 --- a/.vsts-ci/templates/ci-general.yml +++ b/.vsts-ci/templates/ci-general.yml @@ -1,15 +1,10 @@ -parameters: -- name: pwsh - type: boolean - default: true - steps: - task: PowerShell@2 displayName: PowerShell version inputs: targetType: inline + pwsh: true script: $PSVersionTable - pwsh: ${{ parameters.pwsh }} - task: UseDotNet@2 displayName: Install .NET 7.0.x SDK @@ -29,14 +24,13 @@ steps: displayName: Build inputs: filePath: tools/azurePipelinesBuild.ps1 - pwsh: ${{ parameters.pwsh }} - task: PowerShell@2 displayName: Test inputs: targetType: inline + pwsh: true script: Invoke-Build Test -Configuration Release - pwsh: ${{ parameters.pwsh }} - task: PublishTestResults@2 displayName: Publish test results @@ -49,13 +43,13 @@ steps: displayName: Assert PowerShellEditorServices release configuration inputs: targetType: inline + pwsh: true script: | $assembly = [Reflection.Assembly]::LoadFile("$(Build.SourcesDirectory)/module/PowerShellEditorServices.VSCode/bin/Microsoft.PowerShell.EditorServices.VSCode.dll") if ($assembly.GetCustomAttributes([System.Diagnostics.DebuggableAttribute], $true).IsJITOptimizerDisabled) { Write-Host "##vso[task.LogIssue type=error;] PowerShell Editor Services bits were not built in release configuration!" exit 1 } - pwsh: ${{ parameters.pwsh }} # NOTE: We zip the artifacts because they're ~20 MB compressed, but ~300 MB raw, # and we have limited pipeline artifact storage space. diff --git a/PowerShellEditorServices.build.ps1 b/PowerShellEditorServices.build.ps1 index 1de501a29..eaf9ff400 100644 --- a/PowerShellEditorServices.build.ps1 +++ b/PowerShellEditorServices.build.ps1 @@ -179,9 +179,9 @@ Task Test TestServer, TestE2E, TestConstrainedLanguageMode Task TestServer TestServerWinPS, TestServerPS72, TestServerPS73 -# NOTE: While these can run under `pwsh.exe` we only want them to run under -# `powershell.exe` so that the CI time isn't doubled. -Task TestServerWinPS -If ($PSVersionTable.PSEdition -eq "Desktop") Build, SetupHelpForTests, { +Task TestE2E TestE2EPwsh, TestE2EWinPS + +Task TestServerWinPS -If (-not $script:IsNix) Build, SetupHelpForTests, { Set-Location .\test\PowerShellEditorServices.Test\ # TODO: See https://github.com/dotnet/sdk/issues/18353 for x64 test host # that is debuggable! If architecture is added, the assembly path gets an @@ -190,25 +190,30 @@ Task TestServerWinPS -If ($PSVersionTable.PSEdition -eq "Desktop") Build, SetupH Invoke-BuildExec { & dotnet $script:dotnetTestArgs $script:NetRuntime.Desktop } } -Task TestServerPS72 -If ($PSVersionTable.PSEdition -eq "Core") Build, SetupHelpForTests, { +Task TestServerPS72 Build, SetupHelpForTests, { Set-Location .\test\PowerShellEditorServices.Test\ Invoke-BuildExec { & dotnet $script:dotnetTestArgs $script:NetRuntime.PS72 } } -Task TestServerPS73 -If ($PSVersionTable.PSEdition -eq "Core") Build, SetupHelpForTests, { +Task TestServerPS73 Build, SetupHelpForTests, { Set-Location .\test\PowerShellEditorServices.Test\ Invoke-BuildExec { & dotnet $script:dotnetTestArgs $script:NetRuntime.PS73 } } -Task TestE2E Build, SetupHelpForTests, { +Task TestE2EPwsh Build, SetupHelpForTests, { + Set-Location .\test\PowerShellEditorServices.Test.E2E\ + $env:PWSH_EXE_NAME = "pwsh" + Invoke-BuildExec { & dotnet $script:dotnetTestArgs $script:NetRuntime.PS73 } +} + +Task TestE2EWinPS -If (-not $script:IsNix) Build, SetupHelpForTests, { Set-Location .\test\PowerShellEditorServices.Test.E2E\ - $env:PWSH_EXE_NAME = if ($IsCoreCLR) { "pwsh" } else { "powershell" } + $env:PWSH_EXE_NAME = "powershell" Invoke-BuildExec { & dotnet $script:dotnetTestArgs $script:NetRuntime.PS73 } } Task TestConstrainedLanguageMode -If (-not $script:IsNix) Build, SetupHelpForTests, { Set-Location .\test\PowerShellEditorServices.Test.E2E\ - $env:PWSH_EXE_NAME = if ($IsCoreCLR) { "pwsh" } else { "powershell" } if (-not [Security.Principal.WindowsIdentity]::GetCurrent().Owner.IsWellKnown("BuiltInAdministratorsSid")) { Write-Warning "Skipping Constrained Language Mode tests as they must be ran in an elevated process." diff --git a/global.json b/global.json index b46f32ad3..05862a4a7 100644 --- a/global.json +++ b/global.json @@ -1,7 +1,7 @@ { "sdk": { - "version": "7.0.100", + "version": "7.0.14", "rollForward": "latestFeature", - "allowPrerelease": true + "allowPrerelease": false } } diff --git a/modules.json b/modules.json index aacaf4abf..72c524a68 100644 --- a/modules.json +++ b/modules.json @@ -1,11 +1,14 @@ { "PSScriptAnalyzer": { - "Version": "1.21.0" + "Version": "1.21.0", + "AllowPrerelease": false }, "Plaster": { - "Version": "1.1.3" + "Version": "1.1.3", + "AllowPrerelease": false }, "PSReadLine": { - "Version": "2.3.4" + "Version": "2.3.4", + "AllowPrerelease": false } }