Skip to content

Switch to GitHub Actions for all CI #2110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Dec 12, 2023
57 changes: 57 additions & 0 deletions .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: CI Tests

on:
push:
branches: [ main ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
paths-ignore: [ '**/*.md' ]
merge_group:
types: [ checks_requested ]

jobs:
ci:
name: dotnet
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:
cache: true
cache-dependency-path: '**/packages.lock.json'
dotnet-version: |
6.0.x
7.0.x
- name: Install PSResources
shell: pwsh
run: tools/installPSResources.ps1

- name: Build and test
shell: pwsh
run: Invoke-Build

- name: Upload build artifacts
if: always()
uses: actions/upload-artifact@v3
with:
name: PowerShellEditorServices-module-${{ matrix.os }}
path: module

- name: Upload test results
uses: actions/upload-artifact@v3
if: always()
with:
name: PowerShellEditorServices-test-results-${{ matrix.os }}
path: '**/*.trx'
33 changes: 20 additions & 13 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,48 +1,55 @@
name: Run CodeQL Analysis
name: CodeQL Analysis

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 ]
schedule:
- cron: '00 14 * * *' # Every morning at 7:00am PDT

jobs:
analyze:
name: Analyze
name: analyze
strategy:
fail-fast: false
matrix:
language: [ csharp ]
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'csharp' ]

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:
cache: true
cache-dependency-path: '**/packages.lock.json'

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}

- name: Install PSResources
shell: pwsh
run: tools/installPSResources.ps1

- name: Build
shell: pwsh
run: tools/azurePipelinesBuild.ps1
run: Invoke-Build Build

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: '/language:${{matrix.language}}'
20 changes: 15 additions & 5 deletions .github/workflows/emacs-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: Emacs End-to-End Tests
on:
push:
branches: [ main ]
tags: [ v* ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
Expand All @@ -12,19 +11,30 @@ on:
types: [ checks_requested ]

jobs:
test:
name: Test via Eglot
emacs:
name: ert
runs-on: ubuntu-latest
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:
cache: true
cache-dependency-path: '**/packages.lock.json'

- name: Install PSResources
shell: pwsh
run: tools/installPSResources.ps1

- name: Build PSES
- name: Build
shell: pwsh
run: tools/azurePipelinesBuild.ps1
run: Invoke-Build Build

- name: Install Emacs
uses: purcell/setup-emacs@master
Expand Down
21 changes: 15 additions & 6 deletions .github/workflows/vim-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: Vim End-to-End Tests
on:
push:
branches: [ main ]
tags: [ v* ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
Expand All @@ -12,23 +11,33 @@ on:
types: [ checks_requested ]

jobs:
test:
name: Test via LanguageClient-neovim
vim:
name: themis
runs-on: ubuntu-latest
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:
cache: true
cache-dependency-path: '**/packages.lock.json'

- name: Install PSResources
shell: pwsh
run: tools/installPSResources.ps1

- name: Build PSES
- name: Build
shell: pwsh
run: tools/azurePipelinesBuild.ps1
run: Invoke-Build Build

- name: Install Vim
uses: rhysd/action-setup-vim@v1
id: vim

- name: Checkout vim-ps1
uses: actions/checkout@v4
Expand Down
37 changes: 11 additions & 26 deletions .vsts-ci/azure-pipelines-ci.yml
Original file line number Diff line number Diff line change
@@ -1,48 +1,33 @@
name: CI-$(Build.SourceBranchName)-$(Date:yyyyMMdd)$(Rev:.rr)

pr: none

trigger:
- gh-readonly-queue/main/*
pr:
paths:
exclude:
- '**/*.md'
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'
# 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
17 changes: 11 additions & 6 deletions .vsts-ci/azure-pipelines-release.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
name: Release-$(Build.SourceBranchName)-$(Date:yyyyMMdd)$(Rev:.rr)

pr: none

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
22 changes: 12 additions & 10 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 @@ -25,18 +20,25 @@ steps:
version: 6.0.x
performMultiLevelLookup: true

- task: PowerShell@2
displayName: Install PSResources
inputs:
pwsh: true
filePath: tools/installPSResources.ps1

- task: PowerShell@2
displayName: Build
inputs:
filePath: tools/azurePipelinesBuild.ps1
pwsh: ${{ parameters.pwsh }}
targetType: inline
pwsh: true
script: Invoke-Build Build -Configuration Release

- 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 +51,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
2 changes: 2 additions & 0 deletions PowerShellEditorServices.Common.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/PowerShell/PowerShellEditorServices</RepositoryUrl>
<DebugType>portable</DebugType>
<!-- See https://learn.microsoft.com/en-us/nuget/consume-packages/package-references-in-project-files#locking-dependencies -->
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
<!-- See: https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/overview -->
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
Expand Down
Loading