diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 307c1b61aa..87fa66c1c7 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -323,10 +323,13 @@ jobs: elfutils-libs - uses: actions/checkout@v3 - name: Configure + # Set ALWAYS_ROOT because the container user is root and creating an + # unpriviledged user would be too much work. run: | cmake . -B build -G Ninja \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ - -DCMAKE_INSTALL_PREFIX=/usr + -DCMAKE_INSTALL_PREFIX=/usr \ + -DALWAYS_ROOT=YES - name: Build run: | cmake --build build @@ -337,6 +340,56 @@ jobs: run: | DESTDIR=$PWD/build/install cmake --build build --target install + freebsd: + runs-on: ubuntu-latest + if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' + steps: + - uses: actions/checkout@v4 + # This has to be executed in a single step because freebsd-vm fails if run + # twice. + - name: Build, test, and install on FreeBSD + uses: vmactions/freebsd-vm@v1 + with: + # qmake is required by /usr/local/lib/cmake/Qt5Core/Qt5CoreConfig.cmake + run: | + set -e + pkg install -y \ + git \ + cmake \ + ninja \ + gettext \ + qt5-buildtools \ + qt5-qmake \ + qt5-network \ + qt5-svg \ + qt5-testlib \ + qt5-widgets \ + kf5-karchive \ + lua53 \ + sqlite3 \ + sdl2_mixer \ + readline \ + zlib-ng \ + libunwind \ + elfutils + + # Create an unpriviledged user to run tests as, otherwise the server + # refuses to start (and rightfully so) + pw user add -n action -m + + # Create a script with the commands to run + cat >build-and-test.sh < #ifdef FREECIV_MSWINDOWS #include +#else +#include // SIGHUP, SIGPIPE #endif // Qt diff --git a/utility/shared.cpp b/utility/shared.cpp index e2d5e770a7..366f60d64c 100644 --- a/utility/shared.cpp +++ b/utility/shared.cpp @@ -27,8 +27,10 @@ #include #ifdef HAVE_DIRECT_H #include -#endif // HAVE_DIRECT_H -#endif // FREECIV_MSWINDOWS +#endif // HAVE_DIRECT_H +#else // FREECIV_MSWINDOWS +#include // getuid, geteuid +#endif // FREECIV_MSWINDOWS // Qt #include