From 19bc7456b8a6896bfd3534485d335c449757f0ab Mon Sep 17 00:00:00 2001 From: dundargoc Date: Fri, 7 Apr 2023 20:44:00 +0200 Subject: [PATCH] ci: don't automatically enable -Werror if in CI environment This catches downstream consumers of neovim off-guard when trying to use neovim in an esoteric environment not tested in our own CI. Closes https://github.com/neovim/neovim/issues/22932 (cherry picked from commit 0256b67e89089ebcbacaf15e9bb481c2f9ab1e91) --- .cirrus.yml | 2 +- .github/scripts/build_universal_macos.sh | 2 +- .github/workflows/build.yml | 2 +- .github/workflows/release.yml | 4 ++-- .github/workflows/test.yml | 10 +++++----- scripts/genappimage.sh | 2 +- src/nvim/CMakeLists.txt | 6 +----- 7 files changed, 12 insertions(+), 16 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index f602a2c1df..a1264ca608 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -14,7 +14,7 @@ freebsd_task: build_deps_script: - gmake deps build_script: - - gmake nvim + - gmake CMAKE_EXTRA_FLAGS="-DCI_BUILD=ON" nvim workaround_script: # Run tests as user "cirrus" instead of root. This is required for the # permission-related tests to work correctly. diff --git a/.github/scripts/build_universal_macos.sh b/.github/scripts/build_universal_macos.sh index 003be75de8..392eec62ac 100755 --- a/.github/scripts/build_universal_macos.sh +++ b/.github/scripts/build_universal_macos.sh @@ -25,7 +25,7 @@ MACOSX_DEPLOYMENT_TARGET="$(sw_vers -productVersion | cut -f1 -d.)" export MACOSX_DEPLOYMENT_TARGET cmake -S cmake.deps -B .deps -G Ninja -D CMAKE_BUILD_TYPE=${NVIM_BUILD_TYPE} -D CMAKE_OSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} -D CMAKE_OSX_ARCHITECTURES=arm64\;x86_64 cmake --build .deps -cmake -B build -G Ninja -D CMAKE_BUILD_TYPE=${NVIM_BUILD_TYPE} -D CMAKE_OSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} -D CMAKE_OSX_ARCHITECTURES=arm64\;x86_64 -D CI_BUILD=OFF +cmake -B build -G Ninja -D CMAKE_BUILD_TYPE=${NVIM_BUILD_TYPE} -D CMAKE_OSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} -D CMAKE_OSX_ARCHITECTURES=arm64\;x86_64 cmake --build build cmake --install build --prefix build/release/nvim-macos cd build diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fa1f74e4d1..be0f2f812c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -67,7 +67,7 @@ jobs: run: make deps - name: Build - run: make CMAKE_FLAGS="-D CMAKE_INSTALL_PREFIX:PATH=$INSTALL_PREFIX" + run: make CMAKE_FLAGS="-D CI_BUILD=ON -D CMAKE_INSTALL_PREFIX:PATH=$INSTALL_PREFIX" - name: Install run: make install diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 17737dcb36..219ad0288f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -33,7 +33,7 @@ jobs: - name: Build release id: build run: | - CC=gcc-10 make CMAKE_BUILD_TYPE=${NVIM_BUILD_TYPE} CMAKE_EXTRA_FLAGS="-DCI_BUILD=OFF -DCMAKE_INSTALL_PREFIX:PATH=" + CC=gcc-10 make CMAKE_BUILD_TYPE=${NVIM_BUILD_TYPE} CMAKE_EXTRA_FLAGS="-DCMAKE_INSTALL_PREFIX:PATH=" printf 'version<> $GITHUB_OUTPUT ./build/bin/nvim --version | head -n 3 >> $GITHUB_OUTPUT printf 'END\n' >> $GITHUB_OUTPUT @@ -126,7 +126,7 @@ jobs: cmake --build .deps - name: build package run: | - cmake -B build -G Ninja -DCMAKE_BUILD_TYPE='RelWithDebInfo' -D CI_BUILD=OFF + cmake -B build -G Ninja -DCMAKE_BUILD_TYPE='RelWithDebInfo' cmake --build build --target package - uses: actions/upload-artifact@v3 with: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7794e07077..86561e468b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -76,7 +76,7 @@ jobs: - if: success() || failure() && steps.abort_job.outputs.status == 'success' name: configure - run: cmake -B build -G Ninja -D CI_BUILD=OFF + run: cmake -B build -G Ninja - if: "!cancelled()" name: Determine if run should be aborted @@ -197,7 +197,7 @@ jobs: - name: Build run: | - cmake -B build -G Ninja -D CMAKE_INSTALL_PREFIX:PATH=$INSTALL_PREFIX ${{ matrix.flags }} + cmake -B build -G Ninja -D CMAKE_INSTALL_PREFIX:PATH=$INSTALL_PREFIX ${{ matrix.flags }} -D CI_BUILD=ON cmake --build build - if: "!cancelled()" @@ -276,7 +276,7 @@ jobs: cmake --build .deps - name: Configure - run: cmake -B build -G "Ninja Multi-Config" -D CMAKE_C_COMPILER=gcc + run: cmake -B build -G "Ninja Multi-Config" -D CMAKE_C_COMPILER=gcc -D CI_BUILD=ON - name: Release run: cmake --build build --config Release @@ -313,7 +313,7 @@ jobs: - name: Build run: | - cmake -B build -G Ninja -D CMAKE_BUILD_TYPE='RelWithDebInfo' + cmake -B build -G Ninja -D CMAKE_BUILD_TYPE='RelWithDebInfo' -D CI_BUILD=ON cmake --build build - name: Install test deps @@ -405,5 +405,5 @@ jobs: - name: Build run: | - cmake -B build -G Ninja + cmake -B build -G Ninja -D CI_BUILD=ON cmake --build build diff --git a/scripts/genappimage.sh b/scripts/genappimage.sh index dc46f4ce17..9944b5eb31 100755 --- a/scripts/genappimage.sh +++ b/scripts/genappimage.sh @@ -26,7 +26,7 @@ APP_DIR="$APP.AppDir" ######################################################################## # Build and install nvim into the AppImage -make CMAKE_BUILD_TYPE=RelWithDebInfo CMAKE_EXTRA_FLAGS="-DCI_BUILD=OFF -DCMAKE_INSTALL_PREFIX=${APP_DIR}/usr -DCMAKE_INSTALL_MANDIR=man" +make CMAKE_BUILD_TYPE=RelWithDebInfo CMAKE_EXTRA_FLAGS="-DCMAKE_INSTALL_PREFIX=${APP_DIR}/usr -DCMAKE_INSTALL_MANDIR=man" make install ######################################################################## diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index 9695c64889..6fa99db29f 100755 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -146,11 +146,7 @@ if(HAS_DIAG_COLOR_FLAG) endif() endif() -if($ENV{CI}) - option(CI_BUILD "CI, extra flags will be set" ON) -else() - option(CI_BUILD "CI, extra flags will be set" OFF) -endif() +option(CI_BUILD "CI, extra flags will be set" OFF) if(CI_BUILD) message(STATUS "CI build enabled") if(MSVC)