aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/.github/workflows/ci.yml
blob: 23203488a1a0903e637f6d7c559c217852ade3b0 (plain) (blame)
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
name: CI

on:
  push:
  workflow_dispatch:

jobs:
  lint:
    runs-on: ubuntu-latest
    name: Linting
    continue-on-error: "${{ github.ref != 'refs/heads/master' }}"
    steps:
      - name: Checkout
        uses: actions/checkout@v7
      - name: Set up clang-format
        uses: egor-tensin/setup-clang@v2
        with:
          # To use the latest clang-format features:
          version: 22
      - name: Run clang-format
        uses: egor-tensin/clang-format@v1
        with:
          version: 22

  build:
    strategy:
      matrix:
        toolset: [vs2022, vs2026]
        platform: [x64]
        configuration: [Debug, Release]
        include:
          - {toolset: vs2022, os: windows-2022}
          - {toolset: vs2026, os: windows-2025}
    runs-on: '${{ matrix.os }}'
    name: 'Build: ${{ matrix.toolset }} / ${{ matrix.platform }} / ${{ matrix.configuration }}'
    defaults:
      run:
        shell: pwsh
    steps:
      - name: Checkout
        uses: actions/checkout@v7
        with:
          submodules: recursive

      - name: Set up msbuild
        uses: microsoft/setup-msbuild@v3

      - name: Install NuGet packages
        # As of June '26, WDK doesn't seem to be included in VS 2026 (windows-2025) images.
        # The recommended way is to use NuGet: https://github.com/actions/runner-images/issues/13071#issuecomment-3361203846
        # How to use it: https://community.osr.com/t/announcing-the-wdk-nuget-a-new-way-to-develop-drivers-on-windows/58887/20
        # Also, see Microsoft's driver samples: https://github.com/microsoft/windows-driver-samples
        run: nuget restore .\packages.config -PackagesDirectory .\packages\
        if: matrix.toolset == 'vs2026'

      - name: Build user-mode code
        run: |
          New-Item -Type Directory build\cmake | Out-Null
          cd build\cmake

          cmake -A '${{ matrix.platform }}' `
              '-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}\build\install' `
              '${{ github.workspace }}'

          cmake --build . --target install --config '${{ matrix.configuration }}'

      - name: Build kernel-mode code
        run: |
          .\km\build.ps1 `
              -InstallDir build\install `
              -Configuration '${{ matrix.configuration }}' `
              -Platform '${{ matrix.platform }}' `
              -WDK wdk10

      - name: Run tests
        run: |
          .\km\test.ps1 -InstallDir build\install

      - name: Publish artifact
        uses: actions/upload-artifact@v7
        with:
          name: 'windows7-drivers-${{ matrix.platform }}-${{ matrix.configuration }}-Win10-${{ matrix.toolset }}'
          path: ./build/install/
          if-no-files-found: error