Skip to content
Merged
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
237 changes: 67 additions & 170 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,204 +2,101 @@ name: ci

on:
workflow_dispatch:
pull_request:
push:
branches:
- master
schedule:
- cron: "23 18 * * 0"
tags:
- "v*.*.*"

permissions:
contents: read

jobs:
e2e:
test:
name: build and e2e
runs-on: windows-2025-vs2026
timeout-minutes: 90

steps:
- name: checkout
uses: actions/checkout@v5
uses: actions/checkout@v4

- name: build action bundle
- name: setup node
uses: actions/setup-node@v4
with:
node-version: 24
cache: npm

- name: install dependencies
shell: powershell
run: |
npm.cmd ci
npm.cmd run build
git diff --exit-code -- dist/index.js
run: npm.cmd ci

- name: build bundle
shell: powershell
run: npm.cmd run build

- name: verify checked-in bundle
shell: powershell
run: git diff --exit-code -- dist/index.js

- name: setup wdk7
id: wdk7
uses: ./

- name: verify default setup
- name: run e2e
shell: powershell
run: |
if ("${{ steps.wdk7.outputs.found }}" -ne "true") {
throw "WDK7 was not prepared."
}

"root=${{ steps.wdk7.outputs.root }}"
"source=${{ steps.wdk7.outputs.source }}"
"cache-hit=${{ steps.wdk7.outputs.cache-hit }}"
"dbgeng-found=${{ steps.wdk7.outputs.dbgeng-found }}"
"toolchain-file=${{ steps.wdk7.outputs.toolchain-file }}"
"ddkbuild-cmd=${{ steps.wdk7.outputs.ddkbuild-cmd }}"

if ("${{ steps.wdk7.outputs.dbgeng-found }}" -ne "false") {
throw "DbgEng SDK should not be prepared unless debugger=true."
}

- name: build cmake user e2e targets without debugger
shell: powershell
env:
CMAKE_GENERATOR: ${{ steps.wdk7.outputs.cmake-generator }}
WDK7_TOOLCHAIN_FILE: ${{ steps.wdk7.outputs.toolchain-file }}
run: |
$source = Join-Path $PWD "test\e2e\cmake"
$expected = @(
"e2e_cli.exe",
"e2e_dll.dll",
"e2e_lib.lib",
"e2e_native.exe"
)

foreach ($arch in @("i386", "amd64")) {
$build = Join-Path $PWD ".e2e\cmake-basic-$arch"

cmake -S $source -B $build -G $env:CMAKE_GENERATOR `
"-DCMAKE_TOOLCHAIN_FILE=$env:WDK7_TOOLCHAIN_FILE" `
"-DWDK7_ARCH=$arch" `
"-DCMAKE_BUILD_TYPE=Release"
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}

cmake --build $build --config Release
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}

foreach ($file in $expected) {
$path = Join-Path $build $file
if (-not (Test-Path -LiteralPath $path)) {
throw "Missing CMake $arch output: $path"
}
}

$dbgengPath = Join-Path $build "e2e_dbgeng.exe"
if (Test-Path -LiteralPath $dbgengPath) {
throw "DbgEng target was built without debugger=true: $dbgengPath"
}
}
run: .\scripts\test-e2e.ps1 -Mode default

- name: setup wdk7 with debugger
id: wdk7_debugger
uses: ./
with:
debugger: true

- name: verify debugger setup
shell: powershell
run: |
if ("${{ steps.wdk7_debugger.outputs.found }}" -ne "true") {
throw "WDK7 was not prepared."
}
if ("${{ steps.wdk7_debugger.outputs.dbgeng-found }}" -ne "true") {
throw "DbgEng SDK was not prepared with debugger=true."
}

"debuggers-root=${{ steps.wdk7_debugger.outputs.debuggers-root }}"
"dbgeng-include-dir=${{ steps.wdk7_debugger.outputs.dbgeng-include-dir }}"
"dbgeng-lib-i386=${{ steps.wdk7_debugger.outputs.dbgeng-lib-i386 }}"
"dbgeng-lib-amd64=${{ steps.wdk7_debugger.outputs.dbgeng-lib-amd64 }}"

- name: build cmake user e2e targets with debugger
shell: powershell
env:
CMAKE_GENERATOR: ${{ steps.wdk7_debugger.outputs.cmake-generator }}
WDK7_TOOLCHAIN_FILE: ${{ steps.wdk7_debugger.outputs.toolchain-file }}
run: |
$source = Join-Path $PWD "test\e2e\cmake"
$expected = @(
"e2e_cli.exe",
"e2e_dll.dll",
"e2e_lib.lib",
"e2e_dbgeng.exe",
"e2e_native.exe"
)

foreach ($arch in @("i386", "amd64")) {
$build = Join-Path $PWD ".e2e\cmake-dbgeng-$arch"

cmake -S $source -B $build -G $env:CMAKE_GENERATOR `
"-DCMAKE_TOOLCHAIN_FILE=$env:WDK7_TOOLCHAIN_FILE" `
"-DWDK7_ARCH=$arch" `
"-DCMAKE_BUILD_TYPE=Release"
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}

cmake --build $build --config Release
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}

foreach ($file in $expected) {
$path = Join-Path $build $file
if (-not (Test-Path -LiteralPath $path)) {
throw "Missing CMake $arch output: $path"
}
}
}

- name: build cmake sys e2e target
- name: run debugger e2e
shell: powershell
run: .\scripts\test-e2e.ps1 -Mode debugger

release:
name: release
needs: test
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: create release
env:
CMAKE_GENERATOR: ${{ steps.wdk7.outputs.cmake-generator }}
WDK7_TOOLCHAIN_FILE: ${{ steps.wdk7.outputs.toolchain-file }}
GH_TOKEN: ${{ github.token }}
TAG_NAME: ${{ github.ref_name }}
run: |
$source = Join-Path $PWD "test\e2e\cmake-sys"

foreach ($arch in @("i386", "amd64")) {
$build = Join-Path $PWD ".e2e\cmake-sys-$arch"

cmake -S $source -B $build -G $env:CMAKE_GENERATOR `
"-DCMAKE_TOOLCHAIN_FILE=$env:WDK7_TOOLCHAIN_FILE" `
"-DWDK7_ARCH=$arch" `
"-DWDK7_DEFAULT_MODE=KERNEL" `
"-DCMAKE_BUILD_TYPE=Release"
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}

cmake --build $build --config Release
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}

$path = Join-Path $build "e2e_sys.sys"
if (-not (Test-Path -LiteralPath $path)) {
throw "Missing CMake $arch sys output: $path"
}
}

- name: build ddkbuild e2e target
shell: powershell
if ! [[ "$TAG_NAME" =~ ^v([0-9]+)\.[0-9]+\.[0-9]+$ ]]; then
echo "Skipping release for non-semver tag: $TAG_NAME"
exit 0
fi

if gh release view "$TAG_NAME" >/dev/null 2>&1; then
echo "Release $TAG_NAME already exists."
else
gh release create "$TAG_NAME" --verify-tag --generate-notes --title "$TAG_NAME"
fi

- name: update major tag
env:
DDKBUILD_CMD: ${{ steps.wdk7.outputs.ddkbuild-cmd }}
TAG_NAME: ${{ github.ref_name }}
run: |
$source = "test\e2e\ddkbuild\sys"

foreach ($target in @("-WIN7", "-WIN7A64")) {
cmd /s /c "call ""$env:DDKBUILD_CMD"" $target free $source"
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
}

$sysFiles = @(Get-ChildItem -Path $source -Recurse -Filter e2e_ddkbuild.sys)
if ($sysFiles.Count -lt 2) {
throw "Expected ddkbuild to produce x86 and amd64 .sys files."
}

$sysFiles | ForEach-Object { $_.FullName }
if ! [[ "$TAG_NAME" =~ ^v([0-9]+)\.[0-9]+\.[0-9]+$ ]]; then
exit 0
fi

MAJOR_TAG="v${BASH_REMATCH[1]}"
TARGET_SHA="$(git rev-list -n 1 "$TAG_NAME")"
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git tag -f "$MAJOR_TAG" "$TARGET_SHA"
git push -f origin "refs/tags/$MAJOR_TAG"
Loading
Loading