From b9b9055bbf23cf864f632e8b295239482390005f Mon Sep 17 00:00:00 2001 From: David Chisnall Date: Mon, 20 Feb 2023 12:05:53 +0000 Subject: [PATCH] Try vm-actions instead of cross-platform-actions (#589) This uses VirtualBox instead of xhyve. It might be slower, but should be more reliable. Tests run on FreeBSD, NetBSD, and OpenBSD. Only the FreeBSD ones are passing at the moment, the others will keep running but aren't added as dependencies for the action used to guard commits. --- .github/workflows/main.yml | 106 +++++++++++++++++++++++++++---------- CMakeLists.txt | 2 +- 2 files changed, 79 insertions(+), 29 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1a8fb82..8518a80 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -110,54 +110,104 @@ jobs: # GitHub doesn't natively support *BSD, but we can run them in VMs on Mac / # Linux runners - bsd: + freebsd: strategy: matrix: # Build each combination of OS, version, and release/debug variants # FreeBSD and OpenBSD run on xhyve, netbsd needs qemu os: - - name: freebsd - version: '13.1' - host: macos-12 + - version: '13.1' dependencies: pkg ins -y cmake ninja - enabled: true - - name: freebsd - version: '12.4' - host: macos-12 + - version: '12.3' dependencies: pkg ins -y cmake ninja - enabled: true - # Tests are failing on OpenBSD, so disable for now. - #- name: openbsd - # version: '7.2' - # host: macos-12 - # dependencies: pkg_add -I cmake ninja - # NetBSD fails to produce any output in 25 minutes, so disable for now. - #- name: netbsd - # version: '9.2' - # host: ubuntu-latest - # dependencies: pkgin -y install cmake ninja build-type: [ Release, Debug ] # Don't abort runners if a single one fails fail-fast: false # Kill these jobs if they take too long. timeout-minutes: 25 - runs-on: ${{ matrix.os.host }} - name: ${{ matrix.os.name }}-${{ matrix.os.version}} ${{ matrix.build-type }} + runs-on: macos-latest + name: FreeBSD-${{ matrix.os.version}} ${{ matrix.build-type }} steps: - uses: actions/checkout@v3 - - uses: cross-platform-actions/action@v0.10.0 + - uses: vmactions/freebsd-vm@v0 with: - operating_system: ${{ matrix.os.name }} - architecture: x86-64 - version: ${{ matrix.os.version}} - shell: bash + release: ${{ matrix.os.version}} + usesh: true + mem: 8192 + copyback: false + prepare: | + ${{ matrix.os.dependencies }} run: | - sudo ${{ matrix.os.dependencies }} + set -e cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.build-type}} -G Ninja cd ${{github.workspace}}/build NINJA_STATUS="%p [%f:%s/%t] %o/s, %es" ninja ctest -j 4 --output-on-failure -E '(perf-.*)|(.*-malloc$)' --timeout 400 + netbsd: + strategy: + matrix: + # Build each combination of OS, version, and release/debug variants + # FreeBSD and OpenBSD run on xhyve, netbsd needs qemu + os: + - version: '9.2' + dependencies: | + pkg_add cmake ninja-build gcc10 + build-type: [ Release, Debug ] + # Don't abort runners if a single one fails + fail-fast: false + # Kill these jobs if they take too long. + timeout-minutes: 25 + runs-on: macos-latest + name: NetBSD-${{ matrix.os.version}} ${{ matrix.build-type }} + steps: + - uses: actions/checkout@v3 + - uses: vmactions/netbsd-vm@v0 + with: + release: ${{ matrix.os.version}} + usesh: true + mem: 8192 + copyback: false + prepare: | + ${{ matrix.os.dependencies }} + run: | + set -e + cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.build-type}} -G Ninja -DCMAKE_CXX_COMPILER=/usr/pkg/gcc10/bin/g++ -DCMAKE_C_COMPILER=/usr/pkg/gcc10/bin/gcc + cd ${{github.workspace}}/build + NINJA_STATUS="%p [%f:%s/%t] %o/s, %es" ninja + ctest -j 4 --output-on-failure -E '(perf-.*)|(.*-malloc$)' --timeout 400 + + openbsd: + strategy: + matrix: + # Build each combination of OS, version, and release/debug variants + os: + - version: '7.2' + dependencies: pkg_add -I cmake ninja + build-type: [ Release, Debug ] + # Don't abort runners if a single one fails + fail-fast: false + # Kill these jobs if they take too long. + timeout-minutes: 25 + runs-on: macos-latest + name: OpenBSD-${{ matrix.os.version}} ${{ matrix.build-type }} + steps: + - uses: actions/checkout@v3 + - uses: vmactions/openbsd-vm@v0 + with: + release: ${{ matrix.os.version}} + usesh: true + mem: 8192 + copyback: false + prepare: | + ${{ matrix.os.dependencies }} + run: | + set -e + cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.build-type}} -G Ninja + cd ${{github.workspace}}/build + NINJA_STATUS="%p [%f:%s/%t] %o/s, %es" ninja + ctest -j 4 --output-on-failure -E '(perf-.*)|(.*-malloc$)' --timeout 400 + sanitizer: strategy: matrix: @@ -368,7 +418,7 @@ jobs: fi all-checks: - needs: [linux, bsd, qemu-crossbuild, windows, format, sanitizer] + needs: [linux, freebsd, qemu-crossbuild, windows, format, sanitizer] runs-on: ubuntu-latest steps: - name: Dummy step diff --git a/CMakeLists.txt b/CMakeLists.txt index d44a456..57de8cf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -288,7 +288,7 @@ if(NOT SNMALLOC_HEADER_ONLY_LIBRARY) if(NOT (DEFINED SNMALLOC_LINKER_FLAVOUR) OR ("${SNMALLOC_LINKER_FLAVOUR}" MATCHES "^$")) # Linker not specified externally; probe to see if we can make lld work - set(CMAKE_REQUIRED_LINK_OPTIONS -fuse-ld=lld) + set(CMAKE_REQUIRED_LINK_OPTIONS -fuse-ld=lld -Wl,--icf=all) check_cxx_source_compiles("int main() { return 1; }" LLD_WORKS) if (LLD_WORKS) message(STATUS "Using LLD to link snmalloc shims")