Adjusting workflows to a unified release delivery process (#145) #39
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and test extension | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
# concurrency prevents multiple instances of the workflow from running at the same time, | |
# using `cancel-in-progress` to cancel any existing runs. | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: 16gb_16_core_large_window_runner | |
# do we want to run this on forks? | |
if: github.repository_owner == 'sourcegraph' | |
env: | |
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages | |
Configuration: Debug | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Add msbuild | |
uses: microsoft/setup-msbuild@v2 | |
- name: Cache nuget | |
uses: actions/cache@v4 | |
with: | |
path: ${{ github.workspace }}/.nuget/packages | |
key: ${{ runner.os }}-nuget-${{ github.sha }} | |
restore-keys: ${{ runner.os }}-nuget- | |
- name: Cache agent | |
id: cache-agent | |
uses: actions/cache@v4 | |
with: | |
path: src/Cody.VisualStudio/Agent | |
key: ${{ runner.os }}-agent-${{ hashFiles('agent/agent.version') }} | |
- name: Build agent if needed | |
if: ${{ steps.cache-agent.outputs.cache-hit != 'true' }} | |
shell: pwsh | |
run: ./agent/runBuildAgent.ps1 | |
- name: Build extension (${{ env.Configuration }}) | |
run: msbuild src/Cody.sln -t:Build -restore -verbosity:minimal -property:Configuration=${{ env.Configuration }} | |
- name: Upload Cody.VisualStudio.vsix artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Cody.VisualStudio.vsix | |
path: src/Cody.VisualStudio/bin/${{ env.Configuration }}/Cody.VisualStudio.vsix | |
#Running tests | |
- name: Change Screen Resolution | |
shell: pwsh | |
run: Set-DisplayResolution -Width 1920 -Height 1080 -Force | |
- name: Run tests | |
env: | |
Access_Token_UI_Tests: ${{ secrets.SRC_ACCESS_TOKEN_DOTCOM }} | |
run: dotnet test src/*Tests/bin/${{ env.Configuration }}/*.Tests.dll --logger:trx --verbosity detailed | |
- name: Upload screenshots for UI tests | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: UI Tests Screenshots | |
path: src/Cody.VisualStudio.Tests/bin/${{ env.Configuration }}/Screenshots | |
retention-days: 20 | |
- name: Publish Test Results | |
uses: EnricoMi/publish-unit-test-result-action/windows@v2 | |
if: always() | |
with: | |
files: TestResults/**/*.trx |