-
Notifications
You must be signed in to change notification settings - Fork 0
101 lines (85 loc) · 3.04 KB
/
dotnetCi.yml
File metadata and controls
101 lines (85 loc) · 3.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
name: .NET CI
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
# Summary:
#
# * Installs and configures the environment
# * Runs all .NET and JS tests
# * In Debug configuration (.NET tests)
# * WebDriver-based tests use a locally-running Chrome browser ONLY
# * Packages test results as build artifacts
# * Builds & packs the solution in Release configuration
# * Uploads the Release config packages as build artifacts
build_test_and_pack:
name: Build, test & package
runs-on: ubuntu-24.04
timeout-minutes: 30
env:
VersionSuffix: ci.${{ github.run_number }}
Configuration: Debug
DotnetVersion: 8.0.x
DISPLAY: :99
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# Install build dependencies
- name: Add .NET global tools location to PATH
run: echo "$HOME/.dotnet/tools" >> "$GITHUB_PATH"
- name: Install .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DotnetVersion }}
- name: Install DocFX
run: dotnet tool install --global docfx
# See https://chromium.googlesource.com/chromium/src/+/main/docs/security/apparmor-userns-restrictions.md
- name: Disable AppArmor restrictions so Chrome may run
run: echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns
- name: Start an Xvfb display so Chrome may run
run: Xvfb -ac $DISPLAY -screen 0 1280x1024x16 &
# Environment setup pre-build
- name: Restore .NET packages
run: dotnet restore
# Build and test the solution
- name: Build the solution
run: dotnet build -c ${{ env.Configuration }}
- name: Run .NET tests
id: dotnet_tests
run: dotnet test
continue-on-error: true
# Post-test tasks (artifacts, overall status)
- name: Gracefully stop Xvfb
run: killall Xvfb
continue-on-error: true
- name: Upload .NET test results artifacts
uses: actions/upload-artifact@v4
with:
name: NUnit test results
path: Tests/*.Tests/**/TestResults.xml
- name: Fail the build if any test failures
if: steps.dotnet_tests.outcome == 'failure'
run: |
echo "Failing the build due to test failures"
exit 1
# Build the apps in release mode and publish artifacts
- name: Clean the solution ahead of building in release config
run: dotnet clean
- name: Build, in release configuration
run: dotnet pack -p:VersionSuffix=$VersionSuffix -o packages
- name: Upload build result artifacts
uses: actions/upload-artifact@v4
with:
name: Build results (NuGet)
path: packages/*.nupkg
- name: Build docs website
run: docfx CSF.Extensions.WebDriver.Docs/docfx.json
- name: Upload docs website artifact
uses: actions/upload-artifact@v4
with:
name: Docs website
path: docs/**/*