build.yml (2749B)
1 name: build 2 on: 3 pull_request: 4 branches: 5 - 'master' 6 - 'release-[0-9]+.[0-9]+' 7 paths: 8 - '**.cmake' 9 - '**/CMakeLists.txt' 10 - '**/CMakePresets.json' 11 - 'cmake.*/**' 12 - '.github/**' 13 workflow_dispatch: 14 15 concurrency: 16 group: ${{ github.workflow }}-${{ github.ref }} 17 cancel-in-progress: ${{ github.event_name == 'pull_request' }} 18 19 env: 20 BIN_DIR: ${{ github.workspace }}/bin 21 INSTALL_PREFIX: ${{ github.workspace }}/nvim-install 22 23 jobs: 24 # Test the minimum supported cmake. 25 old-cmake: 26 runs-on: ubuntu-latest 27 timeout-minutes: 15 28 env: 29 CMAKE_URL: 'https://cmake.org/files/v3.16/cmake-3.16.0-Linux-x86_64.sh' 30 CMAKE_VERSION: '3.16.0' 31 steps: 32 - uses: actions/checkout@v6 33 - uses: ./.github/actions/setup 34 35 - name: Install minimum required version of cmake 36 run: | 37 curl --retry 5 --silent --show-error --fail -o /tmp/cmake-installer.sh "$CMAKE_URL" 38 mkdir -p "$BIN_DIR" /opt/cmake-custom 39 chmod a+x /tmp/cmake-installer.sh 40 /tmp/cmake-installer.sh --prefix=/opt/cmake-custom --skip-license 41 ln -sfn /opt/cmake-custom/bin/cmake "$BIN_DIR/cmake" 42 cmake_version="$(cmake --version | head -1)" 43 echo "$cmake_version" | grep -qF "cmake version $CMAKE_VERSION" || { 44 echo "Unexpected CMake version: $cmake_version" 45 exit 1 46 } 47 48 - name: Build dependencies 49 run: make deps 50 51 - name: Build 52 run: make CMAKE_FLAGS="-D CI_BUILD=ON -D CMAKE_INSTALL_PREFIX:PATH=$INSTALL_PREFIX" 53 54 - name: Install 55 run: make install 56 57 # Offline build (USE_EXISTING_SRC_DIR=ON with no network access) 58 use-existing-src: 59 runs-on: ubuntu-latest 60 steps: 61 - uses: actions/checkout@v6 62 - uses: ./.github/actions/setup 63 64 - name: Build bundled dependencies 65 run: make deps 66 67 # Hint: this is equivalent to the files commmited in: https://github.com/neovim/deps/tree/master/src 68 - name: Clean bundled dependencies à la neovim/deps 69 run: | 70 rm -rf ./build 71 find .deps .deps/build -maxdepth 1 '!' \( -name .deps -o -name build -o -name src \) -exec rm -r '{}' + 72 cd .deps/build/src 73 rm -rf ./*-build 74 rm -rf ./*-stamp/*-{configure,build,install,done} 75 for d in *; do (cd "$d"; rm -rf ./autom4te.cache; make clean || true; make distclean || true); done 76 77 - name: Re-build bundled dependencies with no network access 78 run: | 79 sudo sysctl kernel.apparmor_restrict_unprivileged_userns=0 80 unshare --map-root-user --net make deps DEPS_CMAKE_FLAGS=-DUSE_EXISTING_SRC_DIR=ON 81 82 - name: Build 83 run: make CMAKE_FLAGS="-D CI_BUILD=ON"