diff --git a/.github/workflows/postsubmit.yml b/.github/workflows/postsubmit.yml new file mode 100644 index 0000000..853c12e --- /dev/null +++ b/.github/workflows/postsubmit.yml @@ -0,0 +1,30 @@ +# Copyright (c) 2026 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Postsubmit + +on: + push: + branches: + - main + workflow_dispatch: + +permissions: {} + +jobs: + windows: + name: Windows + permissions: + contents: read + uses: ./.github/workflows/windows.yml diff --git a/.github/workflows/presubmit.yml b/.github/workflows/presubmit.yml new file mode 100644 index 0000000..b88172a --- /dev/null +++ b/.github/workflows/presubmit.yml @@ -0,0 +1,33 @@ +# Copyright (c) 2026 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Presubmit + +on: + pull_request: + branches: + - main + +permissions: {} + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + windows: + name: Windows + permissions: + contents: read + uses: ./.github/workflows/windows.yml diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml new file mode 100644 index 0000000..d534460 --- /dev/null +++ b/.github/workflows/windows.yml @@ -0,0 +1,82 @@ +# Copyright (c) 2026 Google LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Windows CI + +on: + workflow_call: + +permissions: + contents: read + +jobs: + msvc-2022: + name: msvc-2022-${{ matrix.config.name }} + runs-on: windows-2022 + timeout-minutes: 60 + defaults: + run: + shell: pwsh + strategy: + fail-fast: false + matrix: + config: + - name: debug + build_type: Debug + - name: release + build_type: RelWithDebInfo + + steps: + - name: Checkout + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Set up Python 3.12 + uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 + with: + python-version: '3.12' + + - name: Sync dependencies + run: python utils/git-sync-deps + + - name: Build, test, and install + env: + BUILD_TYPE: ${{ matrix.config.build_type }} + run: | + $vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" + $vsPath = & $vswhere -products * -latest -version "[17.0,18.0)" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath + if ($LASTEXITCODE -ne 0 -or -not $vsPath) { + throw "Visual Studio 2022 with C++ x64 tools not found" + } + Import-Module (Join-Path $vsPath "Common7\Tools\Microsoft.VisualStudio.DevShell.dll") + Enter-VsDevShell -VsInstallPath $vsPath -SkipAutomaticLocation -DevCmdArguments "-arch=x64 -host_arch=x64" + + python --version + cmake --version + ninja --version + where.exe cl.exe + + $installPrefix = Join-Path $env:GITHUB_WORKSPACE "install" + cmake -S . -B build -G Ninja "-DCMAKE_BUILD_TYPE=$env:BUILD_TYPE" "-DCMAKE_INSTALL_PREFIX=$installPrefix" -DRE2_BUILD_TESTING=OFF -DCMAKE_C_COMPILER=cl.exe -DCMAKE_CXX_COMPILER=cl.exe + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + + cmake --build build + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + + ctest --test-dir build -C $env:BUILD_TYPE --output-on-failure --timeout 300 + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + + cmake --install build + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }