ci: inline external environment scripts (#22237)

Scripts that define the build itself shouldn't be external as they lead
to hard to find bugs.
This commit is contained in:
dundargoc
2023-02-12 18:08:37 +01:00
committed by GitHub
parent 47638706a3
commit 477d4bbf5f
5 changed files with 43 additions and 90 deletions

View File

@@ -16,7 +16,16 @@ concurrency:
cancel-in-progress: true
env:
UNCRUSTIFY_VERSION: uncrustify-0.75.0
ASAN_OPTIONS: detect_leaks=1:check_initialization_order=1:handle_abort=1:handle_sigill=1:log_path=${{ github.workspace }}/build/log/asan:intercept_tls_get_addr=0
BIN_DIR: ${{ github.workspace }}/bin
BUILD_DIR: ${{ github.workspace }}/build
DEPS_BUILD_DIR: ${{ github.workspace }}/nvim-deps
INSTALL_PREFIX: ${{ github.workspace }}/nvim-install
LOG_DIR: ${{ github.workspace }}/build/log
NVIM_LOG_FILE: ${{ github.workspace }}/build/.nvimlog
TSAN_OPTIONS: log_path=${{ github.workspace }}/build/log/tsan
UBSAN_OPTIONS: "print_stacktrace=1 log_path=${{ github.workspace }}/build/log/ubsan"
VALGRIND_LOG: ${{ github.workspace }}/build/log/valgrind-%p.log
# TEST_FILE: test/functional/core/startup_spec.lua
# TEST_FILTER: foo
@@ -25,12 +34,12 @@ jobs:
if: (github.event_name == 'pull_request' && github.base_ref == 'master') || (github.event_name == 'push' && github.ref == 'refs/heads/master')
runs-on: ubuntu-22.04
timeout-minutes: 10
env:
CACHE_UNCRUSTIFY: ${{ github.workspace }}/.cache/uncrustify
UNCRUSTIFY_VERSION: uncrustify-0.75.0
steps:
- uses: actions/checkout@v3
- name: Setup common environment variables
run: ./.github/workflows/env.sh lint
- name: Install apt packages
run: |
./.github/scripts/install_deps_ubuntu.sh
@@ -58,7 +67,7 @@ jobs:
build_dir=uncrustify/build
cmake -S $source_dir -B $build_dir -G Ninja -D CMAKE_BUILD_TYPE=Release
cmake --build $build_dir
mkdir -p $CACHE_DIR
mkdir -p .cache
cp $build_dir/uncrustify ${{ env.CACHE_UNCRUSTIFY }}
- uses: ./.github/actions/cache
@@ -120,9 +129,6 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Setup common environment variables
run: ./.github/workflows/env.sh lintc
- name: Install apt packages
run: |
sudo add-apt-repository ppa:neovim-ppa/stable
@@ -183,14 +189,15 @@ jobs:
- flavor: asan
cc: clang
runner: ubuntu-22.04
sanitizer_flags: -D CLANG_ASAN_UBSAN=ON
flags: -D CLANG_ASAN_UBSAN=ON
- flavor: tsan
cc: clang
runner: ubuntu-22.04
sanitizer_flags: -D CLANG_TSAN=ON
flags: -D CLANG_TSAN=ON
- flavor: uchar
cc: gcc
runner: ubuntu-22.04
flags: -D UNSIGNED_CHAR=ON
- cc: clang
runner: macos-12
@@ -201,6 +208,7 @@ jobs:
cc: gcc
runner: ubuntu-22.04
deps_flags: -D USE_BUNDLED_LUAJIT=OFF -D USE_BUNDLED_LUA=ON
flags: -D PREFER_LUA=ON
runs-on: ${{ matrix.runner }}
timeout-minutes: 45
env:
@@ -210,8 +218,8 @@ jobs:
- name: Set up environment
run: |
./.github/workflows/env.sh ${{ matrix.flavor }}
ulimit -c unlimited
echo "$BIN_DIR" >> $GITHUB_PATH
- name: Create log dir
run: mkdir -p "$LOG_DIR"
@@ -244,6 +252,8 @@ jobs:
perl -W -e 'use Neovim::Ext; print $Neovim::Ext::VERSION'
fi
- run: echo "DEPS_BUILD_DIR=$HOME/nvim-deps" >> $GITHUB_ENV
- uses: ./.github/actions/cache
- name: Build third-party deps
@@ -253,7 +263,7 @@ jobs:
- name: Build
run: |
cmake -B build -G Ninja $CMAKE_FLAGS ${{ matrix.sanitizer_flags }}
cmake -B build -G Ninja -D CI_BUILD=ON -D CMAKE_INSTALL_PREFIX:PATH=$INSTALL_PREFIX -D MIN_LOG_LEVEL=3 ${{ matrix.flags }}
cmake --build build
- if: "!cancelled()"
@@ -357,8 +367,8 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Setup common environment variables
run: ./.github/workflows/env.sh old_cmake
- name: Set up environment
run: echo "$BIN_DIR" >> $GITHUB_PATH
- name: Install apt packages
run: ./.github/scripts/install_deps_ubuntu.sh
@@ -390,16 +400,21 @@ jobs:
windows:
runs-on: windows-2019
timeout-minutes: 45
env:
DEPS_BUILD_DIR: ${{ github.workspace }}/nvim-deps
name: windows (MSVC_64)
name: windows
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/cache
- name: Set env
run: ./.github/workflows/env.ps1
run: |
$installationPath = vswhere.exe -latest -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
if ($installationPath -and (Test-Path "$installationPath\Common7\Tools\vsdevcmd.bat")) {
& "${env:COMSPEC}" /s /c "`"$installationPath\Common7\Tools\vsdevcmd.bat`" -arch=x64 -no_logo && set" | ForEach-Object {
$name, $value = $_ -split '=', 2
"$name=$value" >> $env:GITHUB_ENV
}
}
- name: Build deps
run: |

View File

@@ -22,9 +22,6 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup common environment variables
run: ./.github/workflows/env.sh
- name: Install apt packages
run: ./.github/scripts/install_deps_ubuntu.sh

View File

@@ -1,7 +0,0 @@
$installationPath = vswhere.exe -latest -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
if ($installationPath -and (Test-Path "$installationPath\Common7\Tools\vsdevcmd.bat")) {
& "${env:COMSPEC}" /s /c "`"$installationPath\Common7\Tools\vsdevcmd.bat`" -arch=x64 -no_logo && set" | ForEach-Object {
$name, $value = $_ -split '=', 2
"$name=$value" >> $env:GITHUB_ENV
}
}

View File

@@ -1,56 +0,0 @@
#!/bin/bash
set -e -u
FLAVOR=${1:-}
BUILD_DIR=$GITHUB_WORKSPACE/build
BIN_DIR=$GITHUB_WORKSPACE/bin
DEPS_BUILD_DIR=$HOME/nvim-deps
INSTALL_PREFIX=$GITHUB_WORKSPACE/nvim-install
LOG_DIR=$BUILD_DIR/log
NVIM_LOG_FILE=$BUILD_DIR/.nvimlog
VALGRIND_LOG=$LOG_DIR/valgrind-%p.log
CACHE_DIR=$GITHUB_WORKSPACE/.cache
CACHE_UNCRUSTIFY=$CACHE_DIR/uncrustify
CMAKE_FLAGS="-D CI_BUILD=ON -D CMAKE_INSTALL_PREFIX:PATH=$INSTALL_PREFIX -D MIN_LOG_LEVEL=3"
ASAN_OPTIONS=
UBSAN_OPTIONS=
TSAN_OPTIONS=
case "$FLAVOR" in
asan)
ASAN_OPTIONS="detect_leaks=1:check_initialization_order=1:handle_abort=1:handle_sigill=1:log_path=$LOG_DIR/asan:intercept_tls_get_addr=0"
UBSAN_OPTIONS="print_stacktrace=1 log_path=$LOG_DIR/ubsan"
;;
tsan)
TSAN_OPTIONS=log_path=$LOG_DIR/tsan
;;
uchar)
CMAKE_FLAGS+=" -D UNSIGNED_CHAR=ON"
;;
functionaltest-lua)
CMAKE_FLAGS+=" -D PREFER_LUA=ON"
;;
*)
;;
esac
cat <<EOF >> "$GITHUB_ENV"
CMAKE_FLAGS=$CMAKE_FLAGS
BUILD_DIR=$BUILD_DIR
BIN_DIR=$BIN_DIR
DEPS_BUILD_DIR=$DEPS_BUILD_DIR
INSTALL_PREFIX=$INSTALL_PREFIX
LOG_DIR=$LOG_DIR
NVIM_LOG_FILE=$NVIM_LOG_FILE
VALGRIND_LOG=$VALGRIND_LOG
CACHE_DIR=$CACHE_DIR
CACHE_UNCRUSTIFY=$CACHE_UNCRUSTIFY
ASAN_OPTIONS=$ASAN_OPTIONS
UBSAN_OPTIONS=$UBSAN_OPTIONS
TSAN_OPTIONS=$TSAN_OPTIONS
EOF
cat <<EOF >> "$GITHUB_PATH"
$BIN_DIR
EOF

View File

@@ -111,20 +111,24 @@ jobs:
windows:
runs-on: windows-2019
env:
DEPS_BUILD_DIR: ${{ github.workspace }}/nvim-deps
CMAKE_BUILD_TYPE: "RelWithDebInfo"
name: windows (MSVC_64)
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set env
run: ./.github/workflows/env.ps1
run: |
$installationPath = vswhere.exe -latest -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
if ($installationPath -and (Test-Path "$installationPath\Common7\Tools\vsdevcmd.bat")) {
& "${env:COMSPEC}" /s /c "`"$installationPath\Common7\Tools\vsdevcmd.bat`" -arch=x64 -no_logo && set" | ForEach-Object {
$name, $value = $_ -split '=', 2
"$name=$value" >> $env:GITHUB_ENV
}
}
- name: Build deps
run: |
cmake -S cmake.deps -B $env:DEPS_BUILD_DIR -G Ninja -DCMAKE_BUILD_TYPE='RelWithDebInfo'
cmake --build $env:DEPS_BUILD_DIR
cmake -S cmake.deps -B .deps -G Ninja -DCMAKE_BUILD_TYPE='RelWithDebInfo'
cmake --build .deps
- name: build package
run: |
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE='RelWithDebInfo'