From c30ef1a4575868312dbd6251b54eb66f39d38783 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Sun, 20 Dec 2020 14:39:58 +0100 Subject: [PATCH] ci: gh-actions: add win-mingw build --- .github/workflows/cmake-build-ci.gen | 47 ++++++++---- .github/workflows/cmake-build-ci.yml | 107 +++++++++++++++++++++++++-- 2 files changed, 134 insertions(+), 20 deletions(-) diff --git a/.github/workflows/cmake-build-ci.gen b/.github/workflows/cmake-build-ci.gen index a7e896cf..d9434506 100755 --- a/.github/workflows/cmake-build-ci.gen +++ b/.github/workflows/cmake-build-ci.gen @@ -26,6 +26,11 @@ const DEF = [ "CC" => "msvc", "CXX" => "msvc", ], + "mingw" => [ // dummy + "ver" => "cur", + "CC" => "mingw", + "CXX" => "mingw", + ] ]; const ENV = [ "ubuntu-20.04" => [ @@ -82,15 +87,6 @@ const MAP = [ ] ] ], - "windows-2019" => [ - 'env.CC_VND' => [ - "msvc" => [ - 'env.CC_VER' => [ - "cur" => "2019", - ], - ], - ], - ], ] ]; @@ -248,12 +244,13 @@ function defaults($os_vnd = DEF["os"]) { return "$os_ver, $cc_vnd, $cc_ver"; } -function env_override($os_vnd) { +function env_override($os_vnd, $cc_vnd = null) { + isset($cc_vnd) or $cc_vnd = DEF[DEF[$os_vnd]]; ?> OS_VND: # OS_VER: # - CC_VND: # - CC_VER: # + CC_VND: # + CC_VER: # - # win build + # win msvc build win-msvc: name: win-msvc (, , ) runs-on: # @@ -377,7 +374,7 @@ jobs: CMAKE_BUILD_TYPE: "Release" BISON_ROOT: "C:/msys64/usr" FLEX_ROOT: "C:/msys64/usr" - + continue-on-error: true steps: - uses: actions/checkout@v2 @@ -392,6 +389,28 @@ jobs: openssh + # win mingw build (set PATH=%PATH%;c:\msys64\mingw64\bin) + win-msvc: + name: win-mingw (, mingw, ) + runs-on: # + env: + CMAKE_BUILD_TYPE: "Release" + CMAKE_GENERATOR: "MinGW Makefiles" + BISON_ROOT: "C:/msys64/usr" + FLEX_ROOT: "C:/msys64/usr" + + continue-on-error: true + steps: + - uses: actions/checkout@v2 + - uses: msys2/setup-msys2@v2 + with: + release: false + install: >- + rsync + openssh + mingw-w64-x86_64-toolchain + + # linux release builds release: strategy: diff --git a/.github/workflows/cmake-build-ci.yml b/.github/workflows/cmake-build-ci.yml index fe858de0..3919c7a2 100644 --- a/.github/workflows/cmake-build-ci.yml +++ b/.github/workflows/cmake-build-ci.yml @@ -507,7 +507,7 @@ jobs: --data-urlencode "level=error" \ --data-urlencode "message=Github [${GITHUB_REPOSITORY}](https://github.com/${GITHUB_REPOSITORY}/commits/${REF}) (${REF}) [failure](https://github.com/m6w6/libmemcached/actions/runs/${GITHUB_RUN_ID}) (${ImageOS}/${CC:-${CC_VND}-${CC_VER}})" - # win build + # win msvc build win-msvc: name: win-msvc (windows-2019, msvc, cur) runs-on: windows-2019 # @@ -608,6 +608,106 @@ jobs: --data-urlencode "level=error" \ --data-urlencode "message=Github [${GITHUB_REPOSITORY}](https://github.com/${GITHUB_REPOSITORY}/commits/${REF}) (${REF}) [failure](https://github.com/m6w6/libmemcached/actions/runs/${GITHUB_RUN_ID}) (${ImageOS}/${CC:-${CC_VND}-${CC_VER}})" + # win mingw build (set PATH=%PATH%;c:\msys64\mingw64\bin) + win-msvc: + name: win-mingw (windows-2019, mingw, cur) + runs-on: windows-2019 # + env: + CMAKE_BUILD_TYPE: "Release" + CMAKE_GENERATOR: "MinGW Makefiles" + BISON_ROOT: "C:/msys64/usr" + FLEX_ROOT: "C:/msys64/usr" + OS_VND: Windows # + OS_VER: windows-2019 # + CC_VND: mingw # + CC_VER: cur # + continue-on-error: true + steps: + - uses: actions/checkout@v2 + - uses: msys2/setup-msys2@v2 + with: + release: false + install: >- + rsync + openssh + mingw-w64-x86_64-toolchain + - name: Install dependencies (Linux) + if: runner.os == 'Linux' + run: | + sudo apt-get install -my \ + libevent-dev \ + libsasl2-dev \ + libtbb-dev \ + python3-sphinx \ + ${INSTALL_MEMCACHED} \ + ${INSTALL_CC} ${INSTALL_CXX} + sudo systemctl stop memcached || true + - name: Install dependencies (Mac) + if: runner.os == 'macOS' + run: | + brew install bison flex sphinx-doc ${INSTALL_MEMCACHED} + brew services stop memcached || true + echo MEMCACHED_BINARY="/usr/local/bin/memcached" >> ${GITHUB_ENV} + - name: Build memcached + if: runner.os != 'Windows' + run: | + if test -d memcached + then + cd memcached + ./autogen.sh + ./configure CFLAGS="-O2 -pipe" \ + --prefix=${MEMCACHED_PREFIX} \ + --enable-sasl \ + --enable-sasl-pwdb \ + --disable-coverage \ + --disable-dependency-tracking \ + --disable-docs \ + --disable-extstore \ + --disable-option-checking \ + ; + make -j2 + make install + cd .. + echo MEMCACHED_BINARY="${MEMCACHED_PREFIX}/bin/memcached" >> ${GITHUB_ENV} + fi + - name: Generate build tree (${{ env.CMAKE_BUILD_TYPE }}) + run: cmake --config ${{ env.CMAKE_BUILD_TYPE }} -S . -B build + - name: Build all with ${{ env.CXX }} ${{ env.CXXFLAGS }} + run: cmake --build build --config ${{ env.CMAKE_BUILD_TYPE }} -j2 + - name: Test + if: env.BUILD_TESTING == 'ON' + run: cmake --build build --config ${{ env.CMAKE_BUILD_TYPE }} -j2 --target test + - name: Install + if: env.BUILD_TESTING == 'ON' + run: cmake --install build --config ${{ env.CMAKE_BUILD_TYPE }} --prefix /tmp + - name: Failed tests log + if: ${{ env.BUILD_TESTING == 'ON' && failure() }} + run: cat build/Testing/Temporary/LastTest.log || true + - name: Package + env: + PUSH_ARTIFACTS_ID: ${{ secrets.PUSH_ARTIFACTS_ID }} + if: env.CC_VER == 'cur' && env.CMAKE_BUILD_TYPE == 'Release' + run: | + cmake --config ${{ env.CMAKE_BUILD_TYPE }} -S . -B build + cmake --build build --config ${{ env.CMAKE_BUILD_TYPE }} -j2 --target package + cmake -DCPACK_COMPONENT_INSTALL=ON build + cmake --build build --config ${{ env.CMAKE_BUILD_TYPE }} -j2 --target package + cmake --build build --config ${{ env.CMAKE_BUILD_TYPE }} -j2 --target push-artifacts + - name: Notify Gitter (success) + if: ${{ success() && runner.os != 'Windows'}} + run: | + REF=$(basename ${GITHUB_REF}) + curl -sS "${{ secrets.GITTER }}" \ + --data-urlencode "level=info" \ + --data-urlencode "message=Github [${GITHUB_REPOSITORY}](https://github.com/${GITHUB_REPOSITORY}/commits/${REF}) (${REF}) [success](https://github.com/m6w6/libmemcached/actions/runs/${GITHUB_RUN_ID}) (${ImageOS}/${CC:-${CC_VND}-${CC_VER}})" + - name: Notify Gitter (failure) + if: ${{ failure() && runner.os != 'Windows'}} + run: | + REF=$(basename ${GITHUB_REF}) + curl -sS "${{ secrets.GITTER }}" \ + --data-urlencode "level=error" \ + --data-urlencode "message=Github [${GITHUB_REPOSITORY}](https://github.com/${GITHUB_REPOSITORY}/commits/${REF}) (${REF}) [failure](https://github.com/m6w6/libmemcached/actions/runs/${GITHUB_RUN_ID}) (${ImageOS}/${CC:-${CC_VND}-${CC_VER}})" + # linux release builds release: strategy: @@ -692,11 +792,6 @@ jobs: echo CC="clang-6.0" >> ${GITHUB_ENV} echo CXX="clang++-6.0" >> ${GITHUB_ENV} echo CXXFLAGS="-stdlib=libc++" >> ${GITHUB_ENV} - - name: Prepare environment (for cur msvc on windows-2019) - if: (env.OS_VER=='windows-2019') && (env.CC_VND=='msvc') && (env.CC_VER=='cur') - run: | - echo CC="msvc2019" >> ${GITHUB_ENV} - echo CXX="msvc2019" >> ${GITHUB_ENV} - name: Install dependencies (Linux) if: runner.os == 'Linux' run: | -- 2.30.2