ci.yml raw

   1  name: CI
   2  
   3  on:
   4    push:
   5    pull_request:
   6  
   7  jobs:
   8    build-netbsd:
   9      runs-on: ubuntu-latest
  10      name: build • netbsd ${{ matrix.release }}
  11      defaults:
  12        run:
  13          shell: netbsd {0}
  14      strategy:
  15        fail-fast: false
  16        matrix:
  17          # Test all supported releases.
  18          # See https://www.netbsd.org/releases/.
  19          include:
  20            - release: 9.4
  21              capnproto-cppflags: 'CPPFLAGS="-DKJ_NO_EXCEPTIONS=0 -DKJ_USE_KQUEUE=0"'
  22            - release: 10.1
  23              capnproto-cppflags: 'CPPFLAGS="-DKJ_NO_EXCEPTIONS=0"'
  24      steps:
  25        - uses: actions/checkout@v6
  26  
  27        - name: Start NetBSD VM
  28          uses: vmactions/netbsd-vm@v1
  29          with:
  30            release: ${{ matrix.release }}
  31            # The installed compiler version must match the CXX variable
  32            # defined in `ci/configs/netbsd.bash`.
  33            prepare: |
  34              pkg_add cmake ninja-build gcc14
  35            # capnproto prerequisites.
  36            # See the following "Install capnproto" step.
  37            run: |
  38              set -e
  39              pkg_add digest libtool-base mktools pkgconf cwrappers
  40              pkg_admin -K /usr/pkg/pkgdb fetch-pkg-vulnerabilities
  41              cd /usr
  42              cvs -danoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P \
  43                pkgsrc/devel/capnproto \
  44                pkgsrc/devel/libtool-base \
  45                pkgsrc/devel/pkgconf \
  46                pkgsrc/devel/zlib \
  47                `# gcc15 is referenced here because the pkgsrc framework requires lang/gcc15/version.mk to exist` \
  48                `# during the "make install" step below, even though we compile our project with gcc14.` \
  49                pkgsrc/lang/gcc15 \
  50                pkgsrc/mk \
  51                pkgsrc/pkgtools \
  52                pkgsrc/security/openssl \
  53                pkgsrc/sysutils/install-sh/files
  54            sync: 'rsync'
  55            copyback: false
  56  
  57        - name: Install capnproto
  58          run: |
  59            cd /usr/pkgsrc/devel/capnproto/
  60            unset PKG_PATH
  61            make ${{ matrix.capnproto-cppflags }} install
  62  
  63        - name: Run CI script
  64          run: |
  65            cd ${{ github.workspace }}
  66            CI_CONFIG="ci/configs/netbsd.bash" bash ci/scripts/ci.sh
  67  
  68    build-openbsd:
  69      runs-on: ubuntu-latest
  70      name: build • openbsd
  71      defaults:
  72        run:
  73          shell: openbsd {0}
  74      steps:
  75        - uses: actions/checkout@v5
  76  
  77        - name: Start OpenBSD VM
  78          uses: vmactions/openbsd-vm@v1
  79          with:
  80            prepare: |
  81              pkg_add -v cmake ninja bash capnproto
  82            sync: 'rsync'
  83            copyback: false
  84  
  85        - name: Run CI script
  86          run: |
  87            cd ${{ github.workspace }}
  88            CI_CONFIG="ci/configs/openbsd.bash" bash ci/scripts/ci.sh
  89  
  90    build-freebsd:
  91      runs-on: ubuntu-latest
  92      name: build • freebsd
  93      defaults:
  94        run:
  95          shell: freebsd {0}
  96      steps:
  97        - uses: actions/checkout@v5
  98  
  99        - name: Start FreeBSD VM
 100          uses: vmactions/freebsd-vm@v1
 101          with:
 102            prepare: |
 103              pkg install -y cmake ninja bash capnproto
 104            sync: 'rsync'
 105            copyback: false
 106  
 107        - name: Run CI script
 108          run: |
 109            cd ${{ github.workspace }}
 110            CI_CONFIG="ci/configs/freebsd.bash" bash ci/scripts/ci.sh
 111  
 112    build-macos:
 113      runs-on: macos-latest
 114      name: build • macos
 115  
 116      steps:
 117        - uses: actions/checkout@v5
 118  
 119        - name: Install dependencies
 120          env:
 121            HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
 122          run: |
 123            brew install --quiet ninja capnp llvm
 124  
 125        - name: Run CI script
 126          run: |
 127            export PATH="$(brew --prefix llvm)/bin:$PATH"
 128            CI_CONFIG="ci/configs/macos.bash" bash ci/scripts/ci.sh
 129  
 130    build:
 131      runs-on: ubuntu-latest
 132  
 133      env:
 134        NIXPKGS_CHANNEL: nixos-25.05
 135        NIX_EXTRA_CONFIG: |
 136          keep-env-derivations = true
 137          keep-outputs = true
 138        NIX_EXTRA_CONFIG_ACT: |
 139          sandbox = false
 140          filter-syscalls = false
 141  
 142      strategy:
 143        fail-fast: false
 144        matrix:
 145          config: [default, llvm, gnu32, sanitize, olddeps]
 146  
 147      name: build • ${{ matrix.config }}
 148  
 149      steps:
 150        - uses: actions/checkout@v5
 151  
 152        - name: Determine CI configuration
 153          id: config
 154          env:
 155            CI_CONFIG: ci/configs/${{ matrix.config }}.bash
 156          run: ci/scripts/config.sh
 157  
 158        - name: Install Nix
 159          uses: cachix/install-nix-action@v31       # 2025-05-27, from https://github.com/cachix/install-nix-action/tags
 160          with:
 161            nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/${{ steps.config.outputs.nixpkgs_rev }}.tar.gz
 162            # Act executes inside an unprivileged container (Docker or Podman),
 163            # so KVM support isn't available.
 164            enable_kvm: "${{ github.actor != 'nektos/act' }}"
 165            extra_nix_config: |
 166              ${{ env.NIX_EXTRA_CONFIG }}
 167              ${{ github.actor == 'nektos/act' && env.NIX_EXTRA_CONFIG_ACT || '' }}
 168  
 169        - name: Cache Nix store
 170          if: steps.config.outputs.cache_nix_store == 'true'
 171          uses: nix-community/cache-nix-action@v7
 172          with:
 173            primary-key: nix-${{ runner.os }}-${{ matrix.config }}-${{ steps.config.outputs.nixpkgs_rev }}-${{ hashFiles('shell.nix', 'ci/patches/*.patch', format('ci/configs/{0}.bash', matrix.config)) }}
 174            restore-prefixes-first-match: |
 175              nix-${{ runner.os }}-${{ matrix.config }}-${{ steps.config.outputs.nixpkgs_rev }}-
 176              nix-${{ runner.os }}-${{ matrix.config }}-
 177              nix-${{ runner.os }}-
 178            gc-max-store-size-linux: 10G
 179  
 180        - name: Run CI script
 181          env:
 182            CI_CONFIG: ci/configs/${{ matrix.config }}.bash
 183          run: ci/scripts/run.sh
 184