Skip to content

Commit

Permalink
Try GitHub Actions for all CI
Browse files Browse the repository at this point in the history
  • Loading branch information
andyleejordan committed Dec 12, 2023
1 parent 8559105 commit 01e5fda
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 49 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
@@ -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'
27 changes: 6 additions & 21 deletions .vsts-ci/azure-pipelines-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
15 changes: 9 additions & 6 deletions .vsts-ci/azure-pipelines-release.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
12 changes: 3 additions & 9 deletions .vsts-ci/templates/ci-general.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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.
Expand Down
21 changes: 13 additions & 8 deletions PowerShellEditorServices.build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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."
Expand Down
4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"sdk": {
"version": "7.0.100",
"version": "7.0.14",
"rollForward": "latestFeature",
"allowPrerelease": true
"allowPrerelease": false
}
}
9 changes: 6 additions & 3 deletions modules.json
Original file line number Diff line number Diff line change
@@ -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
}
}

0 comments on commit 01e5fda

Please sign in to comment.