Skip to content

Commit

Permalink
test build pipeline optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
baronfel committed Jul 22, 2024
1 parent 15e750d commit 6c6545c
Showing 1 changed file with 44 additions and 57 deletions.
101 changes: 44 additions & 57 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,76 +22,36 @@ jobs:
timeout-minutes: 40 # we have a locking issue, so cap the runs at ~20m to account for varying build times, etc
strategy:
matrix:
os:
test_os:
- windows-latest
- macos-13 # using 13 because it's a bigger machine, and latest is still pointing to 12
- ubuntu-latest
dotnet-version: ["", "6.0.x", "7.0.x", "8.0.x"]
use-transparent-compiler:
- "TransparentCompiler"
- "BackgroundCompiler"
workspace-loader:
- "WorkspaceLoader"
# - "ProjectGraph" # this is disable because it just adds too much time to the build
# these entries will mesh with the above combinations
include:
# just use what's in the repo
- global-json-file: "global.json"
dotnet-version: ""
include-prerelease: false
label: "repo global.json"
build_net7: false
test_tfm: net6.0
# latest 6.0
- global-json-file: "global.json"
dotnet-version: "6.0.x"
include-prerelease: false
label: "6.0"
build_net7: false
test_tfm: net6.0
# latest 7.0
- global-json-file: "global.json"
dotnet-version: "7.0.x"
include-prerelease: true
label: "7.0"
build_net7: true
test_tfm: net7.0
# latest 8.0
- global-json-file: "global.json"
dotnet-version: "8.0.x"
include-prerelease: true
label: "8.0"
build_net8: true
test_tfm: net8.0
dotnet_versions:
- '6.0'
- '8.0'
- '9.0'
fail-fast: false # we have timing issues on some OS, so we want them all to run

runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest

name: Build on ${{matrix.os}} for ${{ matrix.label }} ${{ matrix.workspace-loader }} ${{ matrix.use-transparent-compiler }}
name: Build the app

steps:
- uses: actions/checkout@v3

# setup .NET per the repo global.json
- name: Setup .NET
uses: actions/setup-dotnet@v3

# setup .NET per test session
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
include-prerelease: ${{ matrix.include-prerelease }}
global-json-file: ${{ matrix.global-json-file }}
dotnet-version: ${{ matrix.dotnet-version }}

# remove global.json so that the env configuration takes precedence
- name: Purge global.json
run: rm global.json

# let's make sure we're on the version we think we are.
- name: Announce .NET version
run: dotnet --info

# only need global.json from code to build
- name: Setup .NET
uses: actions/setup-dotnet@v4

- name: Restore tools
run: dotnet tool restore

Expand All @@ -101,16 +61,43 @@ jobs:
DOTNET_ROLL_FORWARD: LatestMajor
DOTNET_ROLL_FORWARD_TO_PRERELEASE: 1

# Ensure the scaffolding code can still add items to the existing code.
# - name: EnsureCanScaffoldCodeFix
# run: dotnet fsi build.fsx -- -p EnsureCanScaffoldCodeFix

- name: Run Build
run: dotnet build -c Release

- uses: actions/upload-artifact@v2
with:
name: compiled-tests
path: test/FsAutoComplete.Tests/bin/Release

- uses: actions/upload-artifact@v2
with:
name: test-cases
path: test/FsAutoComplete.Tests/TestCases

test:
needs: build
runs-on: ${{ matrix.test_os }}
steps:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.dotnet_versions }}

- name: Copy compiled tests
uses: actions/download-artifact@v2
with:
name: compiled-tests
path: ~/FsAutoComplete.Tests.Lsp/bin/Release

- name: Copy test assets
uses: actions/download-artifact@v2
with:
name: test-cases
path: ~/FsAutoComplete.Tests.Lsp/TestCases

- name: Run and report tests
run: dotnet test -c Release -f ${{ matrix.test_tfm }} --no-restore --no-build --logger "console;verbosity=normal" --logger GitHubActions /p:AltCover=true /p:AltCoverAssemblyExcludeFilter="System.Reactive|FSharp.Compiler.Service|Ionide.ProjInfo|FSharp.Analyzers|Analyzer|Humanizer|FSharp.Core|FSharp.DependencyManager" -- Expecto.fail-on-focused-tests=true --blame-hang --blame-hang-timeout 1m
working-directory: test/FsAutoComplete.Tests.Lsp
run: dotnet ./net${{ matrix.dotnet_versions }}/FsAutoComplete.Tests.Lsp.dll --logger "console;verbosity=normal" --logger GitHubActions /p:AltCover=true /p:AltCoverAssemblyExcludeFilter="System.Reactive|FSharp.Compiler.Service|Ionide.ProjInfo|FSharp.Analyzers|Analyzer|Humanizer|FSharp.Core|FSharp.DependencyManager" -- Expecto.fail-on-focused-tests=true --blame-hang --blame-hang-timeout 1m
working-directory: ~/FsAutoComplete.Tests.Lsp/bin/Release
env:
USE_TRANSPARENT_COMPILER: ${{ matrix.use-transparent-compiler }}
USE_WORKSPACE_LOADER: ${{ matrix.workspace-loader }}
Expand Down

0 comments on commit 6c6545c

Please sign in to comment.