aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/build.yml
blob: 3211216c85ae95a642fc03a9d40fdd85bfa3ad08 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: build
on:
  pull_request:
    branches:
      - 'master'
      - 'release-[0-9]+.[0-9]+'
    paths:
      - '**.cmake'
      - '**/CMakeLists.txt'
      - '**/CMakePresets.json'
      - 'cmake.*/**'
      - '.github/**'
  workflow_dispatch:

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: ${{ github.event_name == 'pull_request' }}

env:
  BIN_DIR: ${{ github.workspace }}/bin
  INSTALL_PREFIX: ${{ github.workspace }}/nvim-install

jobs:
  wasmtime:
    strategy:
      fail-fast: false
      matrix:
        test: [ubuntu-latest, macos-latest, windows-latest]
    runs-on: ${{ matrix.test }}
    steps:
      - uses: actions/checkout@v4
      - uses: ./.github/actions/setup
      - run: |
          cmake -S cmake.deps --preset ci -D ENABLE_WASMTIME=ON
          cmake --build .deps
          cmake --preset ci -D ENABLE_WASMTIME=ON
          cmake --build build

  old-cmake:
    name: Test oldest supported cmake
    runs-on: ubuntu-latest
    timeout-minutes: 15
    env:
      CMAKE_URL: 'https://cmake.org/files/v3.16/cmake-3.16.0-Linux-x86_64.sh'
      CMAKE_VERSION: '3.16.0'
    steps:
      - uses: actions/checkout@v4
      - uses: ./.github/actions/setup

      - name: Install minimum required version of cmake
        run: |
          curl --retry 5 --silent --show-error --fail -o /tmp/cmake-installer.sh "$CMAKE_URL"
          mkdir -p "$BIN_DIR" /opt/cmake-custom
          chmod a+x /tmp/cmake-installer.sh
          /tmp/cmake-installer.sh --prefix=/opt/cmake-custom --skip-license
          ln -sfn /opt/cmake-custom/bin/cmake "$BIN_DIR/cmake"
          cmake_version="$(cmake --version | head -1)"
          echo "$cmake_version" | grep -qF "cmake version $CMAKE_VERSION" || {
            echo "Unexpected CMake version: $cmake_version"
            exit 1
          }

      - name: Build dependencies
        run: make deps

      - name: Build
        run: make CMAKE_FLAGS="-D CI_BUILD=ON -D CMAKE_INSTALL_PREFIX:PATH=$INSTALL_PREFIX"

      - name: Install
        run: make install

  use-existing-src:
    name: Test USE_EXISTING_SRC_DIR=ON builds with no network access
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: ./.github/actions/setup

      - name: Build bundled dependencies
        run: make deps

      - name: Clean bundled dependencies à la neovim/deps
        run: |
          rm -rf ./build
          find .deps .deps/build -maxdepth 1 '!' \( -name .deps -o -name build -o -name src \) -exec rm -r '{}' +
          cd .deps/build/src
          rm -rf ./*-build
          rm -rf ./*-stamp/*-{configure,build,install,done}
          for d in *; do (cd "$d"; rm -rf ./autom4te.cache; make clean || true; make distclean || true); done

      - name: Re-build bundled dependencies with no network access
        run: |
          sudo sysctl kernel.apparmor_restrict_unprivileged_userns=0
          unshare --map-root-user --net make deps DEPS_CMAKE_FLAGS=-DUSE_EXISTING_SRC_DIR=ON

      - name: Build
        run: make CMAKE_FLAGS="-D CI_BUILD=ON"