ci: Add workflow to build on windows (#19937)

This commit is contained in:
Declan Carroll 2025-09-24 13:56:24 +01:00 committed by GitHub
parent 68e00955ec
commit b8895edb94
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 95 additions and 2 deletions

81
.github/workflows/build-windows.yml vendored Normal file
View File

@ -0,0 +1,81 @@
name: Windows CI
on:
workflow_dispatch:
inputs:
notify_on_failure:
description: 'Send Slack notification on build failure'
required: false
type: boolean
default: false
workflow_call:
inputs:
notify_on_failure:
description: 'Send Slack notification on build failure'
required: false
type: boolean
default: false
secrets:
QBOT_SLACK_TOKEN:
required: false
pull_request:
branches: [master]
paths:
- '**/package.json'
- '**/turbo.json'
- '.github/workflows/build-windows.yml'
jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Setup Node.js and Build
uses: ./.github/actions/setup-nodejs-github
with:
build-command: pnpm build
- name: Send Slack notification on failure
if: failure() && inputs.notify_on_failure == true
uses: slackapi/slack-github-action@91efab103c0de0a537f72a35f6b8cda0ee76bf0a # v2.1.1
with:
method: chat.postMessage
token: ${{ secrets.QBOT_SLACK_TOKEN }}
payload: |
{
"channel": "C035KBDA917",
"text": "🚨 Windows build failed for `${{ github.repository }}` on branch `${{ github.ref_name }}`",
"blocks": [
{
"type": "header",
"text": { "type": "plain_text", "text": "🚨 Windows Build Failed" }
},
{
"type": "section",
"fields": [
{ "type": "mrkdwn", "text": "*Repository:*\n<${{ github.server_url }}/${{ github.repository }}|${{ github.repository }}>" },
{ "type": "mrkdwn", "text": "*Branch:*\n`${{ github.ref_name }}`" },
{ "type": "mrkdwn", "text": "*Commit:*\n`${{ github.sha }}`" },
{ "type": "mrkdwn", "text": "*Trigger:*\n${{ github.event_name }}" }
]
},
{
"type": "section",
"text": { "type": "mrkdwn", "text": ":warning: *Cross-platform compatibility issue detected*\nThis likely indicates Unix-specific commands in package.json scripts or build configuration that don't work on Windows." }
},
{
"type": "actions",
"elements": [
{
"type": "button",
"text": { "type": "plain_text", "text": ":github: View Workflow Run" },
"style": "danger",
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
]
}
]
}

View File

@ -6,7 +6,7 @@
"type": "module",
"scripts": {
"clean": "rimraf dist .turbo .build",
"popularity-cache-marker": "mkdir -p .build && date +%G-W%V > .build/cache-marker",
"popularity-cache-marker": "node scripts/cache-marker.mjs",
"fetch-popularity": "node scripts/fetch-node-popularity.mjs",
"build": "cross-env VUE_APP_PUBLIC_PATH=\"/{{BASE_PATH}}/\" NODE_OPTIONS=\"--max-old-space-size=8192\" vite build",
"typecheck": "vue-tsc --noEmit",

View File

@ -0,0 +1,11 @@
#!/usr/bin/env node
import { mkdirSync, writeFileSync } from 'fs';
const now = new Date();
const year = now.getFullYear();
const week = Math.ceil(
((now - new Date(year, 0, 1)) / 86400000 + new Date(year, 0, 1).getDay() + 1) / 7,
);
mkdirSync('.build', { recursive: true });
writeFileSync('.build/cache-marker', `${year}-W${week.toString().padStart(2, '0')}`);

View File

@ -13,7 +13,8 @@
},
"build": {
"dependsOn": ["^build", "fetch-popularity"],
"outputs": ["dist/**"]
"outputs": ["dist/**"],
"inputs": ["!.build/**"]
}
}
}