ci: run tests in parallel

This will run the three test suites (unit, functional and old) in
parallel, meaning that neovim is built for each test and run separately.
This has a slight increase in total CI usage, but it allows rerunning
only the specific test suite that failed for flaky tests, which will
save some time.

Ideally we'd remove any drawbacks by building neovim once and reusing it
for each test suite, but that is not currently possible due to poor
upload/download speeds of the upload-artifact and download-artifact
actions. This has been addressed in
https://github.com/actions/toolkit/pull/1488, but will only be made
available in upload-artifact@v4 and download-artifact@v4.
This commit is contained in:
dundargoc
2023-10-20 15:12:37 +02:00
committed by dundargoc
parent 3a3e025126
commit bc850ba2a0
2 changed files with 41 additions and 66 deletions

View File

@@ -10,6 +10,10 @@ runs:
run: echo "CACHE_KEY=$CACHE_KEY-${{ join(matrix.*, '-') }}" >> $GITHUB_ENV run: echo "CACHE_KEY=$CACHE_KEY-${{ join(matrix.*, '-') }}" >> $GITHUB_ENV
shell: bash shell: bash
- if: ${{ matrix.build }}
run: echo "CACHE_KEY=$CACHE_KEY-${{ join(matrix.build.*, '-') }}" >> $GITHUB_ENV
shell: bash
- id: image - id: image
run: echo "version=$ImageVersion" >> $GITHUB_OUTPUT run: echo "version=$ImageVersion" >> $GITHUB_OUTPUT
shell: bash shell: bash

View File

@@ -102,38 +102,30 @@ jobs:
- run: cmake --build build --target clang-analyzer - run: cmake --build build --target clang-analyzer
posix: posix:
name: ${{ matrix.runner }} ${{ matrix.flavor }} (cc=${{ matrix.cc }}) name: ${{ matrix.build.runner }} ${{ matrix.build.flavor }} ${{ matrix.build.cc }} ${{ matrix.test }}
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
include: build:
- flavor: asan [
cc: clang { runner: ubuntu-22.04, flavor: asan, cc: clang, flags: -D ENABLE_ASAN_UBSAN=ON },
runner: ubuntu-22.04 { runner: ubuntu-22.04, flavor: tsan, cc: clang, flags: -D ENABLE_TSAN=ON },
flags: -D ENABLE_ASAN_UBSAN=ON { runner: ubuntu-22.04, flavor: uchar, cc: gcc, flags: -D UNSIGNED_CHAR=ON },
- flavor: tsan { runner: macos-12, cc: clang, flags: -D CMAKE_FIND_FRAMEWORK=NEVER, deps_flags: -D CMAKE_FIND_FRAMEWORK=NEVER },
cc: clang { runner: ubuntu-22.04, flavor: functionaltest-lua, cc: gcc, deps_flags: -D USE_BUNDLED_LUAJIT=OFF -D USE_BUNDLED_LUA=ON, flags: -D PREFER_LUA=ON },
runner: ubuntu-22.04 ]
flags: -D ENABLE_TSAN=ON test: [unittest, functionaltest, oldtest]
- flavor: uchar exclude:
cc: gcc - test: unittest
runner: ubuntu-22.04 build: { flavor: tsan }
flags: -D UNSIGNED_CHAR=ON - test: unittest
- cc: clang build: { flavor: functionaltest-lua }
runner: macos-12 - test: oldtest
flags: -D CMAKE_FIND_FRAMEWORK=NEVER build: { flavor: tsan }
deps_flags: -D CMAKE_FIND_FRAMEWORK=NEVER runs-on: ${{ matrix.build.runner }}
# Check that the tests pass with PUC Lua instead of LuaJIT.
- flavor: functionaltest-lua
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 timeout-minutes: 45
env: env:
CC: ${{ matrix.cc }} CC: ${{ matrix.build.cc }}
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@@ -148,7 +140,8 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: ./.github/scripts/install_deps.sh --test run: ./.github/scripts/install_deps.sh --test
- name: Set up interpreter packages - if: ${{ matrix.test != 'unittest' }}
name: Set up interpreter packages
run: | run: |
# Use default CC to avoid compilation problems when installing Python modules. # Use default CC to avoid compilation problems when installing Python modules.
echo "Install neovim module for Python." echo "Install neovim module for Python."
@@ -168,40 +161,21 @@ jobs:
- name: Build third-party deps - name: Build third-party deps
run: | run: |
cmake -S cmake.deps -B .deps -G Ninja ${{ matrix.deps_flags }} cmake -S cmake.deps -B .deps -G Ninja ${{ matrix.build.deps_flags }}
cmake --build .deps cmake --build .deps
- name: Build - name: Build
run: | run: |
cmake --preset ci -D CMAKE_INSTALL_PREFIX:PATH=$INSTALL_PREFIX ${{ matrix.flags }} cmake --preset ci -D CMAKE_INSTALL_PREFIX:PATH=$INSTALL_PREFIX ${{ matrix.build.flags }}
cmake --build build cmake --build build
- if: "!cancelled()" - name: ${{ matrix.test }}
name: Determine if run should be aborted
id: abort_job
run: echo "status=${{ job.status }}" >> $GITHUB_OUTPUT
- if: matrix.flavor != 'tsan' && matrix.flavor != 'functionaltest-lua' && (success() || failure() && steps.abort_job.outputs.status == 'success')
name: Unittest
timeout-minutes: 5
run: cmake --build build --target unittest
- if: success() || failure() && steps.abort_job.outputs.status == 'success'
name: Functionaltest
timeout-minutes: 20 timeout-minutes: 20
run: cmake --build build --target functionaltest run: make ${{ matrix.test }}
- if: matrix.flavor != 'tsan' && (success() || failure() && steps.abort_job.outputs.status == 'success') - name: Install
name: Oldtest
run: make oldtest
- if: success() || failure() && steps.abort_job.outputs.status == 'success'
name: Install
run: cmake --install build
- if: success() || failure() && steps.abort_job.outputs.status == 'success'
name: Installtests
run: | run: |
cmake --install build
"$INSTALL_PREFIX/bin/nvim" --version "$INSTALL_PREFIX/bin/nvim" --version
if ! "$INSTALL_PREFIX/bin/nvim" -u NONE -e -c ':help' -c ':qall'; then if ! "$INSTALL_PREFIX/bin/nvim" -u NONE -e -c ':help' -c ':qall'; then
echo "Running ':help' in the installed nvim failed." echo "Running ':help' in the installed nvim failed."
@@ -226,14 +200,17 @@ jobs:
exit 1 exit 1
fi fi
- if: success() || failure() && steps.abort_job.outputs.status == 'success' - if: '!cancelled()'
name: Show logs name: Show logs
run: cat $(find "$LOG_DIR" -type f) run: cat $(find "$LOG_DIR" -type f)
windows: windows:
runs-on: windows-2022 runs-on: windows-2022
timeout-minutes: 45 timeout-minutes: 45
name: windows strategy:
fail-fast: false
matrix:
test: [functional, old]
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: ./.github/actions/cache - uses: ./.github/actions/cache
@@ -269,18 +246,12 @@ jobs:
Get-Command -CommandType Application neovim-node-host.cmd Get-Command -CommandType Application neovim-node-host.cmd
npm.cmd link neovim npm.cmd link neovim
- if: "!cancelled()" - if: ${{ matrix.test == 'functional' }}
name: Determine if run should be aborted name: functionaltest
id: abort_job
run: |
"status=${{ job.status }}" >> $env:GITHUB_OUTPUT
- if: success() || failure() && steps.abort_job.outputs.status == 'success'
name: Run functionaltest
timeout-minutes: 20 timeout-minutes: 20
run: cmake --build build --target functionaltest run: cmake --build build --target functionaltest
- if: success() || failure() && steps.abort_job.outputs.status == 'success' - if: ${{ matrix.test == 'old' }}
uses: msys2/setup-msys2@v2 uses: msys2/setup-msys2@v2
with: with:
update: true update: true
@@ -288,8 +259,8 @@ jobs:
make:p gcc:p diffutils:p make:p gcc:p diffutils:p
release: false release: false
- if: success() || failure() && steps.abort_job.outputs.status == 'success' - if: ${{ matrix.test == 'old' }}
name: Run oldtest name: oldtest
shell: msys2 {0} shell: msys2 {0}
run: | run: |
cd test/old/testdir cd test/old/testdir