Skip to content

Restore GNU sed detection for the pre-commit hook #187

Restore GNU sed detection for the pre-commit hook

Restore GNU sed detection for the pre-commit hook #187

Workflow file for this run

name: Build on Windows (MSYS2)
on: [push, pull_request]
permissions:
contents: read
actions: read
jobs:
build:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
sys: [mingw64, ucrt64, clang64]
backend: [Cairo, Skia]
include:
- { sys: mingw64, icon: '🟦' }
- { sys: ucrt64, icon: '🟨' }
- { sys: clang64, icon: '🟧' }
name: 🚧${{ matrix.icon }} ${{ matrix.sys }} (${{ matrix.backend }})
defaults:
run:
shell: msys2 {0}
steps:
- name: '🧰 Checkout'
uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: false
- name: 'πŸ”Ž Detect compiled-file changes'
id: changes
uses: dorny/paths-filter@v4
with:
filters: |
compiled:
- 'CMakeLists.txt'
- 'cmake/**'
- 'vcpkg.json'
- 'vcpkg-configuration.json'
- 'core/**'
- 'include/**'
- 'tests/**'
- 'demos/**'
- 'css/**'
- '**/*.c'
- '**/*.cc'
- '**/*.cpp'
- '**/*.cxx'
- '**/*.h'
- '**/*.hpp'
- '**/*.cu'
- name: 'πŸ” Check previous run for this job'
id: last
uses: actions/github-script@v8
env:
JOB_NAME: '🚧${{ matrix.icon }} ${{ matrix.sys }} (${{ matrix.backend }})'
with:
script: |
if (context.eventName !== 'push') {
core.setOutput('force', 'false');
return;
}
const jobName = process.env.JOB_NAME;
const branch = context.ref.replace('refs/heads/', '');
const runs = await github.paginate(
github.rest.actions.listWorkflowRunsForRepo,
{
owner: context.repo.owner,
repo: context.repo.repo,
branch,
status: 'completed',
per_page: 50,
}
);
const priorRuns = runs
.filter(r => r.name === context.workflow && r.id !== context.runId)
.sort((a, b) => new Date(b.created_at) - new Date(a.created_at));
let force = 'false';
for (const run of priorRuns) {
const jobs = await github.paginate(
github.rest.actions.listJobsForWorkflowRun,
{
owner: context.repo.owner,
repo: context.repo.repo,
run_id: run.id,
per_page: 100,
}
);
const matched = jobs.find(j => j.name === jobName);
if (matched) {
core.info(
`Last "${jobName}" (run ${run.id}) conclusion: ${matched.conclusion}`
);
if (matched.conclusion !== 'success') force = 'true';
break;
}
}
core.setOutput('force', force);
- name: '${{ matrix.icon }} Setup MSYS2'
uses: msys2/setup-msys2@v2
with:
msystem: ${{matrix.sys}}
update: true
install: >-
git
make
flex
bison
pacboy: >-
toolchain:p
cmake:p
make:p
tools-git:p
${{ matrix.backend == 'Skia' && 'skia:p' || 'cairo:p' }}
pango:p
libxml2:p
gtest:p
pkg-config:p
zlib:p
libpng:p
libjpeg-turbo:p
vulkan-devel:p
vulkan-loader:p
glslang:p
astyle:p
doxygen:p
graphviz:p
if: steps.changes.outputs.compiled == 'true' || steps.last.outputs.force == 'true'
- name: 'πŸ› οΈ Configuring'
run: cmake -G "MSYS Makefiles" -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release -DBACKEND=${{ matrix.backend }}
if: steps.changes.outputs.compiled == 'true' || steps.last.outputs.force == 'true'
- name: 'πŸ—οΈ Building'
run: cmake --build ${{github.workspace}}/build
if: steps.changes.outputs.compiled == 'true' || steps.last.outputs.force == 'true'
- name: 'πŸ§ͺ Running Tests'
run: ctest --test-dir ${{github.workspace}}/build --output-on-failure
if: (steps.changes.outputs.compiled == 'true' || steps.last.outputs.force == 'true') && matrix.backend != 'Skia'
- name: 'βœ… Skip build (no compiled changes)'
if: steps.changes.outputs.compiled != 'true' && steps.last.outputs.force != 'true'
shell: bash
run: echo "No compiled-relevant files changed and previous run succeeded. Skipping build and tests."