CI: use caching and split Build and Tests step #282
Workflow file for this run
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: Cake Build | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
workflow_dispatch: | |
# 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: | |
# this now uses a dedicated large runner from GitHub running the following specs: | |
# 8-core, 32GB RAM, 300GB SSD | |
# https://github.com/organizations/sourcegraph/settings/actions/runner-groups/6 | |
runs-on: 16gb_16_core_large_window_runner | |
# do we want to run this on forks? | |
if: github.repository_owner == 'sourcegraph' | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Add msbuild to PATH | |
uses: microsoft/[email protected] | |
- name: ⚙️ Prepare Visual Studio | |
run: '&"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\devenv.exe" /RootSuffix Exp /ResetSettings General.vssettings' | |
- name: Install Cake.Tool | |
run: dotnet tool install --global Cake.Tool | |
- name: Restore NuGet packages | |
run: nuget restore src\Cody.Core\Cody.Core.csproj -PackagesDirectory src\packages | |
- name: Cache cody-dist | |
uses: actions/cache@v3 | |
with: | |
path: cody-dist/agent | |
key: ${{ runner.os }}-cody-dist-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-cody-dist- | |
- name: Common Build Setup | |
run: | | |
cd src | |
dotnet tool restore | |
corepack enable | |
- name: Build Cody Agent | |
run: | | |
cd src | |
corepack install --global [email protected] | |
dotnet cake --target=BuildCodyAgent | |
- name: Build Extension | |
run: | | |
cd src | |
dotnet cake --target=BuildDebug | |
- name: Tests | |
env: | |
Access_Token_UI_Tests: ${{ secrets.SRC_ACCESS_TOKEN_DOTCOM }} | |
run: | | |
cd src | |
dotnet test .\Cody.VisualStudio.Tests\bin\Debug\Cody.VisualStudio.Tests.dll -v detailed |