Skip to content

Commit 633087f

Browse files
committed
Activate GH Actions for this project
AppVeyor is being annoying because of the preinstalled WebDriver in the path. So I'm going to build on GH Actions instead.
1 parent 35fc4b8 commit 633087f

1 file changed

Lines changed: 101 additions & 0 deletions

File tree

.github/workflows/dotnetCi.yml

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

0 commit comments

Comments
 (0)