Skip to content

Bump electron from 39.8.4 to 39.8.5 in /samples/electron-winml (#402) #1049

Bump electron from 39.8.4 to 39.8.5 in /samples/electron-winml (#402)

Bump electron from 39.8.4 to 39.8.5 in /samples/electron-winml (#402) #1049

Workflow file for this run

name: Build and Package
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
permissions:
contents: write # Required for creating releases
pull-requests: write # Required for binary size report comments
actions: write # Required for deleting old metrics baseline cache
jobs:
# Fast docs validation - runs in parallel with the main build to fail PRs early on doc drift
# Only builds the CLI binary (no tests, npm, or MSIX) so it completes much faster
validate-docs:
if: github.event_name == 'pull_request'
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Install .NET Core
uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.0.x
- name: Build and publish CLI (x64 only)
run: dotnet publish src/winapp-CLI/WinApp.Cli/WinApp.Cli.csproj -c Release -r win-x64 --self-contained -o artifacts/cli/win-x64
- name: Validate CLI schema and agent skills
run: .\scripts\validate-llm-docs.ps1 -FailOnDrift
build-and-package:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0 # Required for build number calculation
- name: Install .NET Core
uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.0.x
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: '24'
# Run the build script which handles building, testing, versioning, npm packaging, and MSIX bundling
# Skip doc generation in CI - we validate the committed docs separately to detect drift
- name: Build, test, and package
id: build
run: |
.\scripts\build-cli.ps1 -SkipDocs
# Get version information for release tagging
$versionJson = Get-Content "version.json" | ConvertFrom-Json
$baseVersion = $versionJson.version
$buildNumber = & ".\scripts\get-build-number.ps1"
# Determine prerelease label based on current branch
$prereleaseLabel = & ".\scripts\get-prerelease-label.ps1"
$fullVersion = "$baseVersion-$prereleaseLabel.$buildNumber"
# Export for use in subsequent steps
echo "version=$fullVersion" >> $env:GITHUB_OUTPUT
echo "base_version=$baseVersion" >> $env:GITHUB_OUTPUT
echo "build_number=$buildNumber" >> $env:GITHUB_OUTPUT
# Validate CLI schema and agent skills on push to main (warning only, not blocking)
- name: Validate CLI schema and agent skills
if: github.event_name != 'pull_request'
run: .\scripts\validate-llm-docs.ps1 -FailOnDrift:$false
# Upload all build artifacts
- name: Upload test results
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v7
with:
name: test-results
path: artifacts/TestResults/
if-no-files-found: error
- name: Upload CLI binaries
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v7
with:
name: cli-binaries
path: artifacts/cli/
if-no-files-found: error
- name: Upload npm package
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v7
with:
name: npm-package
path: artifacts/*.tgz
if-no-files-found: error
- name: Upload MSIX packages
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v7
with:
name: msix-packages
path: artifacts/msix-packages/
if-no-files-found: error
- name: Upload NuGet packages
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v7
with:
name: nuget-packages
path: artifacts/nuget/
if-no-files-found: error
# --- Build quality metrics ---
- name: Collect build metrics
if: ${{ !cancelled() }}
uses: ./.github/actions/collect-metrics
- name: Report build metrics
if: ${{ !cancelled() }}
uses: ./.github/actions/report-metrics
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
# Mark existing metrics comment as stale immediately on PR push
# This job has no dependencies so it starts instantly, before the build finishes
mark-metrics-stale:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Mark metrics comment as stale
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});
const existing = comments.find(c => c.body &&
(c.body.includes('<!-- build-metrics-report -->') || c.body.includes('<!-- binary-size-report -->')));
if (!existing) {
core.info('No existing metrics comment found, nothing to mark stale.');
return;
}
// Skip if already marked stale
if (existing.body.includes('<!-- build-metrics-stale -->')) {
core.info('Comment is already marked stale.');
return;
}
const staleBanner = '> :hourglass_flowing_sand: **Build in progress** — metrics below are from a previous commit and will update when the current build finishes.\n>\n<!-- build-metrics-stale -->\n\n';
const updatedBody = staleBanner + existing.body;
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: existing.id,
body: updatedBody,
});
core.info(`Marked comment ${existing.id} as stale.`);
# E2E test for Electron workflow - runs after build completes
e2e-test:
runs-on: windows-latest
needs: build-and-package
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Enable Windows Developer Mode
run: |
# Registry key to enable Developer Mode
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock" /t REG_DWORD /v "AllowDevelopmentWithoutDevLicense" /d 1 /f
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: '24'
- name: Download npm package artifact
uses: actions/download-artifact@v4
with:
name: npm-package
path: artifacts/npm
- name: Run E2E Electron test
run: |
.\scripts\test-e2e-electron.ps1 -ArtifactsPath "artifacts/npm" -Verbose