Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/publish-test-results.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Publish Test Results

on:
workflow_run:
workflows: ["Build and Test"]
types:
- completed

permissions: {}

jobs:
test-results:
if: github.event.workflow_run.conclusion != 'skipped' && github.event.workflow_run.event == 'pull_request'
name: Test Results
runs-on: ubuntu-latest

permissions:
actions: read
checks: write
pull-requests: write

steps:
- name: Download event file
uses: dawidd6/action-download-artifact@v6
with:
run_id: ${{ github.event.workflow_run.id }}
path: artifacts
name: EventFile

- name: Download test results
uses: dawidd6/action-download-artifact@v6
with:
run_id: ${{ github.event.workflow_run.id }}
path: test-results
pattern: test-results-*
if_no_artifact_found: warn

- name: Resolve event file path
id: event_file
shell: pwsh
run: |
$eventFilePath =
Get-ChildItem -Path artifacts -Filter event.json -Recurse |
Select-Object -First 1 -ExpandProperty FullName

if ($null -eq $eventFilePath) {
throw "event.json file was not found in downloaded artifacts"
}

"path=$eventFilePath" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append

- name: Publish test results
if: ${{ hashFiles('test-results/**/*.trx') != '' }}
uses: EnricoMi/publish-unit-test-result-action@v2
with:
commit: ${{ github.event.workflow_run.head_sha }}
event_file: ${{ steps.event_file.outputs.path }}
event_name: ${{ github.event.workflow_run.event }}
files: "test-results/**/*.trx"
Comment on lines +54 to +59
24 changes: 24 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,25 @@ env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: true

permissions: {}

jobs:
event_file:
if: github.event_name == 'pull_request'
name: Publish event file
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Upload event file
uses: actions/upload-artifact@v4
with:
name: EventFile
path: ${{ github.event_path }}

build:
permissions:
contents: read

strategy:
fail-fast: false
Expand Down Expand Up @@ -50,3 +67,10 @@ jobs:

- name: Build and run integration tests
run: dotnet run --project build/Build.fsproj --launch-profile BuildAndTest

- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.os }}
path: test-results
Comment thread
xperiandri marked this conversation as resolved.
49 changes: 36 additions & 13 deletions build/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,17 @@ let startGraphQLServer (project : string) port (streamRef : DataRef<Stream>) =

System.Threading.Thread.Sleep (2000)

let runTests (project : string) (args : string) =
let runTests (project : string) =
let projectName = Path.GetFileNameWithoutExtension project
let resultsFileName = $"{projectName}.trx"

DotNet.test
(fun options ->
{
options with
NoBuild = true
Logger = Some $"trx;LogFileName={resultsFileName}"
ResultsDirectory = Some "test-results"
Framework = Some DotNetMoniker
Configuration = configuration
MSBuildParams = {
Expand Down Expand Up @@ -164,18 +169,36 @@ let integrationTestsProjectPath =

let [<Literal>] UpdateIntrospectionFileTarget = "UpdateIntrospectionFile"
Target.create UpdateIntrospectionFileTarget <| fun _ ->
integrationTestsProjectPath
|> DotNet.test (fun options -> {
options with
Framework = Some DotNetMoniker
Configuration = configuration
Common = { DotNetCli.setVersion options.Common with CustomParams = Some "--filter FullyQualifiedName~IntrospectionUpdateTests" }
MSBuildParams = {
options.MSBuildParams with
DisableInternalBinLog = true
Verbosity = Some Normal
let projectName = Path.GetFileNameWithoutExtension integrationTestsProjectPath
let resultsFileName = $"{projectName}.trx"

DotNet.test
(fun options ->
{
options with
NoBuild = true
Logger = Some $"trx;LogFileName={resultsFileName}"
ResultsDirectory = Some "test-results"
Framework = Some DotNetMoniker
Configuration = configuration
Common = {
options.Common with
CustomParams = Some "--filter FullyQualifiedName~IntrospectionUpdateTests"
}
MSBuildParams = {
options.MSBuildParams with
DisableInternalBinLog = true
Verbosity = Some Normal
Properties = [
if embedAll then
("DebugType", "embedded")
("EmbedAllSources", "true")
]
}
}
})
|> _.WithRedirectOutput(true)
|> _.WithCommon(DotNetCli.setVersion))
integrationTestsProjectPath

let unitTestsProjectPath =
"tests"
Expand All @@ -184,7 +207,7 @@ let unitTestsProjectPath =

let [<Literal>] RunUnitTestsTarget = "RunUnitTests"
Target.create RunUnitTestsTarget <| fun _ ->
runTests unitTestsProjectPath ""
runTests unitTestsProjectPath
Comment thread
xperiandri marked this conversation as resolved.

let prepareDocGen () =
Shell.rm "docs/release-notes.md"
Expand Down
Loading