ci: move BSD jobs from sourcehut to Cirrus CI #19616

dispatch.sr.ht is being deprecated, meaning that using sourcehut CI
won't be possible (see https://github.com/neovim/neovim/issues/19609).
Since Github Actions doesn't provide any BSD runners an external service
is required and Cirrus CI seems like a good replacement for sourcehut.

Initially experimented with using FreeBSD and OpenBSD virtual machines
in GitHub Actions, but Cirrus has been a much better fit with better
performance, logs and overall experience.

Failing tests are automatically skipped on FreeBSD regardless if it's on
CI or not. Ideally these tests should only be skipped in CI with the
help of `isCI` helper function. Unfortunately, the tests don't recognize
the environment variable CIRRUS_CI even if it's set manually. This
workaround is good enough for the time being, but we might want to only
skip tests when using the CI (or even better, fix the failing tests).

Closes: https://github.com/neovim/neovim/issues/19609
This commit is contained in:
dundargoc 2022-09-09 00:12:42 +02:00 committed by GitHub
parent d6233cbcdc
commit 2d6735d8ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 56 additions and 113 deletions

View File

@ -1,45 +0,0 @@
image: freebsd/latest
packages:
- cmake
- gmake
- ninja
- libtool
- automake
- pkgconf
- unzip
- wget
- gettext
- python
- libffi
- gdb
sources:
- https://github.com/neovim/neovim
environment:
SOURCEHUT: 1
LANG: en_US.UTF-8
CMAKE_EXTRA_FLAGS: -DCI_BUILD=ON -DMIN_LOG_LEVEL=3
tasks:
- should-run: |
if ! git -C neovim diff --name-only HEAD^! | grep -E -v "^(.github|runtime/doc/.*)" >/dev/null; then
echo "Skipping build because only ignored files were changed"
complete-build
fi
- build-deps: |
cd neovim
gmake deps
- build: |
cd neovim
gmake CMAKE_BUILD_TYPE=RelWithDebInfo CMAKE_EXTRA_FLAGS="${CMAKE_EXTRA_FLAGS}" nvim
- functionaltest: |
cd neovim
gmake functionaltest
- unittest: |
cd neovim
gmake unittest
- oldtest: |
cd neovim
gmake oldtest

View File

@ -1,49 +0,0 @@
# sourcehut CI: https://builds.sr.ht/~jmk/neovim
image: openbsd/latest
packages:
- autoconf-2.71
- automake-1.16.3
- cmake
- gettext-runtime
- gettext-tools
- gmake
- libtool
- ninja
- unzip-6.0p14
- gdb
sources:
- https://github.com/neovim/neovim
environment:
SOURCEHUT: 1
LC_CTYPE: en_US.UTF-8
CMAKE_EXTRA_FLAGS: -DCI_BUILD=ON -DMIN_LOG_LEVEL=3
tasks:
- should-run: |
if ! git -C neovim diff --name-only HEAD^! | grep -E -v "^(.github|runtime/doc/.*)" >/dev/null; then
echo "Skipping build because only ignored files were changed"
complete-build
fi
- build-deps: |
export AUTOCONF_VERSION=2.71
export AUTOMAKE_VERSION=1.16
mkdir neovim/.deps
cd neovim/.deps
cmake -G Ninja ../cmake.deps/
cmake --build . --config RelWithDebInfo
- build: |
mkdir neovim/build
cd neovim/build
cmake -G Ninja $CMAKE_EXTRA_FLAGS ..
cmake --build . --config RelWithDebInfo
./bin/nvim --version
- functionaltest: |
cd neovim/build
cmake --build . --config RelWithDebInfo --target functionaltest
- oldtest: |
cd neovim
gmake oldtest

29
.cirrus.yml Normal file
View File

@ -0,0 +1,29 @@
env:
CIRRUS_CLONE_DEPTH: '1'
LANG: en_US.UTF-8
CMAKE_EXTRA_FLAGS: -DCI_BUILD=ON -DMIN_LOG_LEVEL=3
freebsd_task:
name: FreeBSD
only_if: $BRANCH != "master"
freebsd_instance:
image_family: freebsd-13-1
timeout_in: 30m
install_script:
- pkg update -f
- pkg install -y cmake gmake ninja libtool automake pkgconf unzip wget gettext python libffi git
build_deps_script:
- gmake deps
build_script:
- gmake CMAKE_EXTRA_FLAGS="${CMAKE_EXTRA_FLAGS}" nvim
workaround_script:
# Run tests as user "cirrus" instead of root. This is required for the
# permission-related tests to work correctly.
- pw useradd cirrus -m
- chown -R cirrus:cirrus .
functionaltest_script:
- sudo -u cirrus gmake functionaltest
unittest_script:
- sudo -u cirrus gmake unittest
oldtest_script:
- sudo -u cirrus gmake oldtest

View File

@ -111,7 +111,7 @@ the VCS/git logs more valuable. The general structure of a commit message is:
### Automated builds (CI)
Each pull request must pass the automated builds on [sourcehut] and [GitHub Actions].
Each pull request must pass the automated builds on [Cirrus CI] and [GitHub Actions].
- CI builds are compiled with [`-Werror`][gcc-warnings], so compiler warnings
will fail the build.
@ -125,20 +125,7 @@ Each pull request must pass the automated builds on [sourcehut] and [GitHub Acti
- The [lint](#lint) build checks modified lines _and their immediate
neighbors_, to encourage incrementally updating the legacy style to meet our
[style](#style). (See [#3174][3174] for background.)
- CI for freebsd and openbsd runs on [sourcehut].
- To get a backtrace on freebsd (after connecting via ssh):
```sh
sudo pkg install tmux # If you want tmux.
lldb build/bin/nvim -c nvim.core
# To get a full backtrace:
# 1. Rebuild with debug info.
rm -rf nvim.core build
gmake CMAKE_BUILD_TYPE=RelWithDebInfo CMAKE_EXTRA_FLAGS="-DCI_BUILD=ON -DMIN_LOG_LEVEL=3" nvim
# 2. Run the failing test to generate a new core file.
TEST_FILE=test/functional/foo.lua gmake functionaltest
lldb build/bin/nvim -c nvim.core
```
- CI for FreeBSD runs on [Cirrus CI].
### Clang scan-build
@ -321,6 +308,7 @@ as context, use the `-W` argument as well.
[1820]: https://github.com/neovim/neovim/pull/1820
[3174]: https://github.com/neovim/neovim/issues/3174
[ASan]: http://clang.llvm.org/docs/AddressSanitizer.html
[Cirrus CI]: https://cirrus-ci.com/github/neovim/neovim
[Clang report]: https://neovim.io/doc/reports/clang/
[GitHub Actions]: https://github.com/neovim/neovim/actions
[clangd]: https://clangd.llvm.org
@ -345,7 +333,6 @@ as context, use the `-W` argument as well.
[pr-ready]: https://docs.github.com/en/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/changing-the-stage-of-a-pull-request
[review-checklist]: https://github.com/neovim/neovim/wiki/Code-review-checklist
[run-tests]: https://github.com/neovim/neovim/blob/master/test/README.md#running-tests
[sourcehut]: https://builds.sr.ht/~jmk
[style-guide]: https://neovim.io/doc/user/dev_style.html#dev-style
[uncrustify]: http://uncrustify.sourceforge.net/
[wiki-contribute-help]: https://github.com/neovim/neovim/wiki/contribute-%3Ahelp

View File

@ -7,6 +7,7 @@ local exec_lua = helpers.exec_lua
local retry = helpers.retry
local isCI = helpers.isCI
local assert_alive = helpers.assert_alive
local uname = helpers.uname
describe('notify', function()
local channel
@ -78,6 +79,9 @@ describe('notify', function()
end)
it('cancels stale events on channel close', function()
if uname() == 'freebsd' then
pending('Failing FreeBSD test')
end
if isCI() then
pending('hangs on CI #14083 #15251')
return

View File

@ -23,6 +23,7 @@ local iswin = helpers.iswin
local assert_alive = helpers.assert_alive
local expect_exit = helpers.expect_exit
local write_file = helpers.write_file
local uname = helpers.uname
describe('fileio', function()
before_each(function()
@ -83,6 +84,9 @@ describe('fileio', function()
end)
it('backup #9709', function()
if uname() == 'freebsd' then
pending('Failing FreeBSD test')
end
clear({ args={ '-i', 'Xtest_startup_shada',
'--cmd', 'set directory=Xtest_startup_swapdir' } })
@ -102,6 +106,9 @@ describe('fileio', function()
end)
it('backup with full path #11214', function()
if uname() == 'freebsd' then
pending('Failing FreeBSD test')
end
clear()
mkdir('Xtest_backupdir')
command('set backup')

View File

@ -9,6 +9,7 @@ local feed_command = helpers.feed_command
local funcs = helpers.funcs
local meths = helpers.meths
local iswin = helpers.iswin
local uname = helpers.uname
local fname = 'Xtest-functional-ex_cmds-write'
local fname_bak = fname .. '~'
@ -52,6 +53,9 @@ describe(':write', function()
end)
it('&backupcopy=no replaces symlink with new file', function()
if uname() == 'freebsd' then
pending('Failing FreeBSD test')
end
command('set backupcopy=no')
write_file('test_bkc_file.txt', 'content0')
if iswin() then
@ -91,6 +95,9 @@ describe(':write', function()
end)
it('errors out correctly', function()
if uname() == 'freebsd' then
pending('Failing FreeBSD test')
end
command('let $HOME=""')
eq(funcs.fnamemodify('.', ':p:h'), funcs.fnamemodify('.', ':p:h:~'))
-- Message from check_overwrite

View File

@ -10,6 +10,7 @@ local retry = helpers.retry
local ok = helpers.ok
local iswin = helpers.iswin
local command = helpers.command
local uname = helpers.uname
describe(':terminal', function()
local screen
@ -45,6 +46,9 @@ describe(':terminal', function()
end)
it("reads output buffer on terminal reporting #4151", function()
if uname() == 'freebsd' then
pending('Failing FreeBSD test')
end
if helpers.pending_win32(pending) then return end
if iswin() then
feed_command([[terminal powershell -NoProfile -NoLogo -Command Write-Host -NoNewline "\"$([char]27)[6n\""; Start-Sleep -Milliseconds 500 ]])

View File

@ -790,10 +790,9 @@ end
function module.isCI(name)
local any = (name == nil)
assert(any or name == 'sourcehut' or name == 'github')
local sh = ((any or name == 'sourcehut') and nil ~= os.getenv('SOURCEHUT'))
assert(any or name == 'github')
local gh = ((any or name == 'github') and nil ~= os.getenv('GITHUB_ACTIONS'))
return sh or gh
return gh
end