Skip to content

enable Windows builds again #259

enable Windows builds again

enable Windows builds again #259

Workflow file for this run

# GitHub Workflows file
name: main
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
inputs:
version:
description: 'Version `x.y.z` (without leading `v`)'
type: string
required: true
jobs:
test:
name: Build and test
runs-on: ${{ matrix.os }}
strategy:
matrix:
build:
- linux
- windows
include:
- build: linux
os: ubuntu-20.04
config: gnu
- build: windows
os: windows-2019
config: cl
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Bazel cache
uses: actions/cache@v4
with:
path: |
~/.cache/bazel_build_cache
key: ${{ runner.os }}-bazel-test-${{ hashFiles('WORKSPACE') }}
restore-keys: |
${{ runner.os }}-bazel-test-
- name: Run bazel test
run: bazel test --config=${{ matrix.config }} --config=ci --disk_cache=~/.cache/bazel_build_cache //...
- name: Cache cleanup
run: ./tools/disk-cache-collect-garbage ~/.cache/bazel_build_cache
buildpkg:
name: Build Release Asset
runs-on: ${{ matrix.os }}
needs: test
strategy:
matrix:
build:
- focal
- jammy
- noble
- macos-universal
- windows
include:
- build: focal
os: ubuntu-20.04
config: gnu
pkgfile: bazel-compile-commands_${{ github.event.inputs.version || 0 }}-focal_amd64.deb
- build: jammy
os: ubuntu-22.04
config: gnu
pkgfile: bazel-compile-commands_${{ github.event.inputs.version || 0 }}-jammy_amd64.deb
- build: noble
os: ubuntu-24.04
config: gnu
pkgfile: bazel-compile-commands_${{ github.event.inputs.version || 0 }}-noble_amd64.deb
- build: macos-universal
os: macos-latest
config: gnu
pkgfile: bazel-compile-commands_${{ github.event.inputs.version || 0 }}-macos_universal.zip
- build: windows
os: windows-2019
config: cl
pkgfile: bazel-compile-commands_${{ github.event.inputs.version || 0 }}-windows_amd64.zip
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Bazel cache
uses: actions/cache@v4
with:
path: |
~/.cache/bazel_build_cache
key: ${{ matrix.os }}-bazel-buildpkg-${{ hashFiles('WORKSPACE') }}
restore-keys: |
${{ matrix.os }}-bazel-buildpkg-
- name: Build Release Package
run: >
bazel run
--config=${{ matrix.config }}
--config=ci --config=release
--//:version=${{ github.event.inputs.version || 0 }}
--disk_cache=~/.cache/bazel_build_cache
//:copy -- ${{ matrix.pkgfile }}
- name: Upload package artifact
uses: actions/upload-artifact@v4
with:
name: pkg-bazel-${{ matrix.build }}
path: ${{ matrix.pkgfile }}
- name: Cache cleanup
run: ./tools/disk-cache-collect-garbage ~/.cache/bazel_build_cache
self_test:
name: Self test
runs-on: ubuntu-24.04
needs: buildpkg
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run bazel to generate worktree
run: bazel build --config=gnu --config=ci //...
- name: Download pkg artifact
uses: actions/download-artifact@v4
with:
pattern: pkg-bazel-noble
- name: Install
run: |
sudo dpkg --install pkg-bazel-noble/bazel-compile-commands_*.deb
- name: Create compile-commands.json
run: |
/usr/bin/bazel-compile-commands -v -a --config=gnu --replace=-fno-canonical-system-headers= //...
- name: Run clang-tidy
run: |
clang-tidy -p "$(pwd)" $(find . -type f -name '*.cpp')
mkrelease:
name: Create Release
runs-on: ubuntu-latest
needs: buildpkg
if: github.event_name == 'workflow_dispatch'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download pkg artifact
uses: actions/download-artifact@v4
with:
pattern: pkg-*
merge-multiple: true
- name: Create Release
run: |
gh release create v${{ github.event.inputs.version }} --generate-notes *.deb *.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
format_check:
name: Style check
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Install LLVM
uses: KyleMayes/install-llvm-action@v1.6.1
with:
version: "15.0.6"
- name: clang-format --version
run: clang-format --version
- name: Style check
run: ./tools/clang-format --dry-run -Werror