From 946b9670af4a97be463cae05b5cce6a082d9f475 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Wed, 16 Dec 2020 13:48:31 +0100 Subject: [PATCH] cpack: artifacts --- .builds/freebsd.yml | 19 +- .builds/openbsd.yml | 17 +- .github/workflows/cmake-build-ci.gen | 124 ++++++++---- .github/workflows/cmake-build-ci.yml | 279 +++++++++++++++++++++------ CMakeConfig.txt | 6 + CMakeLists.txt | 6 +- CPack.txt | 58 +++--- CPackDEB.txt => CPack/DEB.txt | 0 CPack/NSIS.txt | 5 + CPackRPM.txt => CPack/RPM.txt | 0 CPackFreeBSD.txt | 2 - CPackNSIS.txt | 5 - scripts/push-artifacts.conf | 8 + scripts/push-artifacts.sh | 10 + 14 files changed, 398 insertions(+), 141 deletions(-) rename CPackDEB.txt => CPack/DEB.txt (100%) create mode 100644 CPack/NSIS.txt rename CPackRPM.txt => CPack/RPM.txt (100%) delete mode 100644 CPackFreeBSD.txt delete mode 100644 CPackNSIS.txt create mode 100644 scripts/push-artifacts.conf create mode 100755 scripts/push-artifacts.sh diff --git a/.builds/freebsd.yml b/.builds/freebsd.yml index 673843b8..1cf06ee8 100644 --- a/.builds/freebsd.yml +++ b/.builds/freebsd.yml @@ -7,12 +7,15 @@ packages: - flex - libevent - pkgconf + - py37-sphinx + - py37-m2r + - rsync - tbb sources: - https://github.com/m6w6/libmemcached +secrets: + - 46f739e5-4538-45dd-a79f-bf173b7a2ed9 environment: - CMAKE_BUILD_TYPE: Debug - BUILD_TESTING: "ON" ENABLE_HASH_HSIEH: "ON" ENABLE_MEMASLAP: "ON" ENABLE_SASL: "ON" @@ -31,11 +34,15 @@ tasks: OPTIONS_SET="SASL SASLPWDB" \ OPTIONS_DEFINE="SASL SASLPWDB" - configure: | - cmake -S libmemcached -B build + cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=ON -S libmemcached -B debug - build: | - make -C build -j2 all + cmake --build debug -j2 - test: | - make -C build -j2 test/fast + cmake --build debug -j2 --target test - install: | - make -C build install DESTDIR=/tmp + cmake --build debug -j2 --target install -- DESTDIR=/tmp + - package: | + cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_DOCS_MANGZ=ON -S libmemcached -B release + cmake --build release -j2 --target package -- VERBOSE= + cmake --build release -j2 --target push-artifact -- VERBOSE= diff --git a/.builds/openbsd.yml b/.builds/openbsd.yml index fe2ebca9..d80bb0ac 100644 --- a/.builds/openbsd.yml +++ b/.builds/openbsd.yml @@ -6,24 +6,29 @@ packages: - libevent - memcached-- - pkgconf + - py3-sphinx + - py3-m2r + - rsync - sudo-- - tbb sources: - https://github.com/m6w6/libmemcached environment: - CMAKE_BUILD_TYPE: Debug - BUILD_TESTING: "ON" ENABLE_HASH_HSIEH: "ON" ENABLE_MEMASLAP: "OFF" VERBOSE: "ON" MEMCACHED_BINARY: "memcached" tasks: - configure: | - cmake -S libmemcached -B build + cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=ON -S libmemcached -B debug - build: | - make -C build -j2 all + cmake --build debug -j2 - test: | - make -C build -j2 test/fast + cmake --build debug -j2 --target test - install: | - make -C build install DESTDIR=/tmp + cmake --build debug -j2 --target install -- DESTDIR=/tmp + - package: | + cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_DOCS_MANGZ=ON -S libmemcached -B release + cmake --build release -j2 --target package -- VERBOSE= + cmake --build release -j2 --target push-artifact -- VERBOSE= diff --git a/.github/workflows/cmake-build-ci.gen b/.github/workflows/cmake-build-ci.gen index 3101dc78..cdffbb11 100755 --- a/.github/workflows/cmake-build-ci.gen +++ b/.github/workflows/cmake-build-ci.gen @@ -17,7 +17,7 @@ const DEF = [ "CXX" => "g++", ], "clang" => [ - "ver" => "apple", + "ver" => "cur", "CC" => "clang", "CXX" => "clang++", ], @@ -140,13 +140,15 @@ function steps_getdeps() { libevent-dev \ libsasl2-dev \ libtbb-dev \ + python3-m2r \ + 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 ${INSTALL_MEMCACHED} + 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 @@ -178,20 +180,32 @@ function steps_build() { - name: Generate build tree (${{ env.CMAKE_BUILD_TYPE }}) run: cmake -S . -B build - name: Build all with ${{ env.CXX }} ${{ env.CXXFLAGS }} - run: make -C build -j2 all + run: cmake --build build -j2 - name: Test - run: make -C build -j2 test + run: cmake --build build -j2 --target test - name: Install - run: make -C build -j2 install DESTDIR=/tmp - - name: Package - if: ${{ env.CMAKE_BUILD_TYPE == 'Release' && env.CC_VER == 'cur' }} - run: make -C build package + run: cmake --build build -j2 --target install -- DESTDIR=/tmp - name: Failed tests log if: ${{ failure() }} run: cat build/Testing/Temporary/LastTest.log || true + - name: Package + env: + PUSH_ARTIFACTS_ID: ${{ secrets.PUSH_ARTIFACTS_ID }} + if: env.OS_VND!='Windows' && env.CC_VER=='cur' && env.CMAKE_BUILD_TYPE=='Release' + run: | + cmake -DENABLE_SASL=ON -DBUILD_DOCS_MANGZ=ON -S . -B build + cmake --build build -j2 --target package -- VERBOSE= + cmake -DCPACK_COMPONENT_INSTALL=ON build + cmake --build build -j2 --target package -- VERBOSE= + cmake --build build -j2 --target push-artifacts -- VERBOSE= + - name: Notify Gitter (success) @@ -215,15 +229,26 @@ function steps($splat_map = null) { steps_setenv($splat_map); steps_getdeps(); steps_build(); + steps_package(); steps_notify(); } -function defaults() { - $os_ver = DEF[DEF["os"]]; +function defaults($os_vnd = DEF["os"]) { + $os_ver = DEF[$os_vnd]; $cc_vnd = DEF[$os_ver]; $cc_ver = DEF[$cc_vnd]["ver"]; return "$os_ver, $cc_vnd, $cc_ver"; } + +function env_override($os_vnd) { +?> + OS_VND: # + OS_VER: # + CC_VND: # + CC_VER: # + name: cmake-build-ci on: @@ -243,12 +268,9 @@ on: env: # defaults INSTALL_MEMCACHED: memcached - CMAKE_BUILD_TYPE: Debug - BUILD_TESTING: "ON" - ENABLE_SASL: "OFF" + ENABLE_SASL: "ON" ENABLE_HASH_HSIEH: "ON" ENABLE_DTRACE: "OFF" - VERBOSE: "ON" OS_VND: # OS_VER: # CC_VND: # @@ -261,11 +283,13 @@ jobs: name: dbg-new () runs-on: # env: - INSTALL_MEMCACHED: - MEMCACHED_PREFIX: /tmp - ENABLE_SASL: "ON" - CFLAGS: "-O0 --coverage" - CXXFLAGS: "-O0 --coverage" + CMAKE_BUILD_TYPE: "Debug" + BUILD_TESTING: "ON" + VERBOSE: "ON" + CFLAGS: "-O0 --coverage" + CXXFLAGS: "-O0 --coverage" + INSTALL_MEMCACHED: "" + MEMCACHED_PREFIX: "/tmp" steps: - uses: actions/checkout@v2 - uses: actions/checkout@v2 @@ -281,7 +305,10 @@ jobs: name: dbg-san () runs-on: # env: - ENABLE_SANITIZERS: "address;undefined" + CMAKE_BUILD_TYPE: "Debug" + BUILD_TESTING: "ON" + VERBOSE: "ON" + ENABLE_SANITIZERS: "address;undefined" steps: - uses: actions/checkout@v2 @@ -291,44 +318,67 @@ jobs: name: dbg-tsan () runs-on: # env: + CMAKE_BUILD_TYPE: "Debug" + BUILD_TESTING: "ON" + VERBOSE: "ON" ENABLE_SANITIZERS: "thread" steps: - uses: actions/checkout@v2 - # mac build + # mac debug dbg-mac: name: dbg-mac (, , ) runs-on: # env: - CFLAGS: -O0 --coverage - CXXFLAGS: -O0 --coverage - OS_VND: macOS - OS_VER: # - CC_VND: # - CC_VER: # + CMAKE_BUILD_TYPE: "Debug" + ENABLE_SASL: "OFF" + BUILD_TESTING: "ON" + VERBOSE: "ON" + CFLAGS: "-O0 --coverage" + CXXFLAGS: "-O0 --coverage" + # continue-on-error: true steps: - uses: actions/checkout@v2 - uses: codecov/codecov-action@v1.0.13 + # mac release + rel-mac: + name: rel-mac (, , ) + runs-on: # + env: + ENABLE_SASL: "OFF" + BUILD_DOCS_MANGZ: "ON" + + continue-on-error: true + steps: + - uses: actions/checkout@v2 + + # win build win-msvc: name: win-msvc (, , ) runs-on: # env: - CMAKE_BUILD_TYPE: Release - BUILD_TESTING: "OFF" + ENABLE_SASL: "OFF" BISON_ROOT: "C:/msys64/usr" FLEX_ROOT: "C:/msys64/usr" - OS_VND: Windows - OS_VER: # - CC_VND: # - CC_VER: # + continue-on-error: true + defaults: + run: + shell: msys2 {0} steps: - uses: actions/checkout@v2 + - uses: msys2/setup-msys2@v2 + with: + release: false + path-type: inherit + install: >- + rsync + openssh - name: Generate build tree (${{ env.CMAKE_BUILD_TYPE }}) run: cmake --config ${{ env.CMAKE_BUILD_TYPE }} -S . -B build - name: Build all with ${{ env.CC_VND }} @@ -336,7 +386,11 @@ jobs: - name: Install run: cmake --install build --prefix installed --config ${{ env.CMAKE_BUILD_TYPE }} - name: Package - run: cmake -E chdir build cpack + env: + PUSH_ARTIFACTS_ID: ${{ secrets.PUSH_ARTIFACTS_ID }} + run: | + cmake --build build --config ${{ env.CMAKE_BUILD_TYPE }} --target package + cmake --build build --config ${{ env.CMAKE_BUILD_TYPE }} --target push-artifacts # release builds release: @@ -349,7 +403,7 @@ jobs: runs-on: ${{ matrix.os_ver }} continue-on-error: ${{ matrix.cc_vnd == 'clang' }} env: - CMAKE_BUILD_TYPE: Release + BUILD_DOCS_MANGZ: "ON" OS_VND: Linux OS_VER: ${{ matrix.os_ver }} CC_VND: ${{ matrix.cc_vnd }} diff --git a/.github/workflows/cmake-build-ci.yml b/.github/workflows/cmake-build-ci.yml index 2e4009d5..17e62b3e 100644 --- a/.github/workflows/cmake-build-ci.yml +++ b/.github/workflows/cmake-build-ci.yml @@ -17,12 +17,9 @@ on: env: # defaults INSTALL_MEMCACHED: memcached - CMAKE_BUILD_TYPE: Debug - BUILD_TESTING: "ON" - ENABLE_SASL: "OFF" + ENABLE_SASL: "ON" ENABLE_HASH_HSIEH: "ON" ENABLE_DTRACE: "OFF" - VERBOSE: "ON" OS_VND: Linux # OS_VER: ubuntu-20.04 # CC_VND: gnu # @@ -35,11 +32,13 @@ jobs: name: dbg-new (ubuntu-20.04, gnu, cur) runs-on: ubuntu-20.04 # env: - INSTALL_MEMCACHED: - MEMCACHED_PREFIX: /tmp - ENABLE_SASL: "ON" - CFLAGS: "-O0 --coverage" - CXXFLAGS: "-O0 --coverage" + CMAKE_BUILD_TYPE: "Debug" + BUILD_TESTING: "ON" + VERBOSE: "ON" + CFLAGS: "-O0 --coverage" + CXXFLAGS: "-O0 --coverage" + INSTALL_MEMCACHED: "" + MEMCACHED_PREFIX: "/tmp" steps: - uses: actions/checkout@v2 - uses: actions/checkout@v2 @@ -59,13 +58,15 @@ jobs: libevent-dev \ libsasl2-dev \ libtbb-dev \ + python3-m2r \ + 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 ${INSTALL_MEMCACHED} + 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 @@ -92,17 +93,24 @@ jobs: - name: Generate build tree (${{ env.CMAKE_BUILD_TYPE }}) run: cmake -S . -B build - name: Build all with ${{ env.CXX }} ${{ env.CXXFLAGS }} - run: make -C build -j2 all + run: cmake --build build -j2 - name: Test - run: make -C build -j2 test + run: cmake --build build -j2 --target test - name: Install - run: make -C build -j2 install DESTDIR=/tmp - - name: Package - if: ${{ env.CMAKE_BUILD_TYPE == 'Release' && env.CC_VER == 'cur' }} - run: make -C build package + run: cmake --build build -j2 --target install -- DESTDIR=/tmp - name: Failed tests log if: ${{ failure() }} run: cat build/Testing/Temporary/LastTest.log || true + - name: Package + env: + PUSH_ARTIFACTS_ID: ${{ secrets.PUSH_ARTIFACTS_ID }} + if: env.OS_VND!='Windows' && env.CC_VER=='cur' && env.CMAKE_BUILD_TYPE=='Release' + run: | + cmake -DENABLE_SASL=ON -DBUILD_DOCS_MANGZ=ON -S . -B build + cmake --build build -j2 --target package -- VERBOSE= + cmake -DCPACK_COMPONENT_INSTALL=ON build + cmake --build build -j2 --target package -- VERBOSE= + cmake --build build -j2 --target push-artifacts -- VERBOSE= - name: Notify Gitter (success) if: ${{ success() }} run: | @@ -124,7 +132,10 @@ jobs: name: dbg-san (ubuntu-20.04, gnu, cur) runs-on: ubuntu-20.04 # env: - ENABLE_SANITIZERS: "address;undefined" + CMAKE_BUILD_TYPE: "Debug" + BUILD_TESTING: "ON" + VERBOSE: "ON" + ENABLE_SANITIZERS: "address;undefined" steps: - uses: actions/checkout@v2 - name: Prepare environment (for cur gnu on ubuntu-20.04) @@ -139,13 +150,15 @@ jobs: libevent-dev \ libsasl2-dev \ libtbb-dev \ + python3-m2r \ + 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 ${INSTALL_MEMCACHED} + 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 @@ -172,17 +185,24 @@ jobs: - name: Generate build tree (${{ env.CMAKE_BUILD_TYPE }}) run: cmake -S . -B build - name: Build all with ${{ env.CXX }} ${{ env.CXXFLAGS }} - run: make -C build -j2 all + run: cmake --build build -j2 - name: Test - run: make -C build -j2 test + run: cmake --build build -j2 --target test - name: Install - run: make -C build -j2 install DESTDIR=/tmp - - name: Package - if: ${{ env.CMAKE_BUILD_TYPE == 'Release' && env.CC_VER == 'cur' }} - run: make -C build package + run: cmake --build build -j2 --target install -- DESTDIR=/tmp - name: Failed tests log if: ${{ failure() }} run: cat build/Testing/Temporary/LastTest.log || true + - name: Package + env: + PUSH_ARTIFACTS_ID: ${{ secrets.PUSH_ARTIFACTS_ID }} + if: env.OS_VND!='Windows' && env.CC_VER=='cur' && env.CMAKE_BUILD_TYPE=='Release' + run: | + cmake -DENABLE_SASL=ON -DBUILD_DOCS_MANGZ=ON -S . -B build + cmake --build build -j2 --target package -- VERBOSE= + cmake -DCPACK_COMPONENT_INSTALL=ON build + cmake --build build -j2 --target package -- VERBOSE= + cmake --build build -j2 --target push-artifacts -- VERBOSE= - name: Notify Gitter (success) if: ${{ success() }} run: | @@ -203,6 +223,9 @@ jobs: name: dbg-tsan (ubuntu-20.04, gnu, cur) runs-on: ubuntu-20.04 # env: + CMAKE_BUILD_TYPE: "Debug" + BUILD_TESTING: "ON" + VERBOSE: "ON" ENABLE_SANITIZERS: "thread" steps: - uses: actions/checkout@v2 @@ -218,13 +241,15 @@ jobs: libevent-dev \ libsasl2-dev \ libtbb-dev \ + python3-m2r \ + 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 ${INSTALL_MEMCACHED} + 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 @@ -251,17 +276,24 @@ jobs: - name: Generate build tree (${{ env.CMAKE_BUILD_TYPE }}) run: cmake -S . -B build - name: Build all with ${{ env.CXX }} ${{ env.CXXFLAGS }} - run: make -C build -j2 all + run: cmake --build build -j2 - name: Test - run: make -C build -j2 test + run: cmake --build build -j2 --target test - name: Install - run: make -C build -j2 install DESTDIR=/tmp - - name: Package - if: ${{ env.CMAKE_BUILD_TYPE == 'Release' && env.CC_VER == 'cur' }} - run: make -C build package + run: cmake --build build -j2 --target install -- DESTDIR=/tmp - name: Failed tests log if: ${{ failure() }} run: cat build/Testing/Temporary/LastTest.log || true + - name: Package + env: + PUSH_ARTIFACTS_ID: ${{ secrets.PUSH_ARTIFACTS_ID }} + if: env.OS_VND!='Windows' && env.CC_VER=='cur' && env.CMAKE_BUILD_TYPE=='Release' + run: | + cmake -DENABLE_SASL=ON -DBUILD_DOCS_MANGZ=ON -S . -B build + cmake --build build -j2 --target package -- VERBOSE= + cmake -DCPACK_COMPONENT_INSTALL=ON build + cmake --build build -j2 --target package -- VERBOSE= + cmake --build build -j2 --target push-artifacts -- VERBOSE= - name: Notify Gitter (success) if: ${{ success() }} run: | @@ -277,17 +309,22 @@ 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}})" - # mac build + # mac debug dbg-mac: - name: dbg-mac (macos-10.15, clang, apple) + name: dbg-mac (macos-10.15, clang, cur) runs-on: macos-10.15 # env: - CFLAGS: -O0 --coverage - CXXFLAGS: -O0 --coverage - OS_VND: macOS - OS_VER: macos-10.15 # - CC_VND: clang # - CC_VER: apple # + CMAKE_BUILD_TYPE: "Debug" + ENABLE_SASL: "OFF" + BUILD_TESTING: "ON" + VERBOSE: "ON" + CFLAGS: "-O0 --coverage" + CXXFLAGS: "-O0 --coverage" + OS_VND: macOS # + OS_VER: macos-10.15 # + CC_VND: clang # + CC_VER: cur # + # continue-on-error: true steps: - uses: actions/checkout@v2 @@ -298,13 +335,15 @@ jobs: libevent-dev \ libsasl2-dev \ libtbb-dev \ + python3-m2r \ + 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 ${INSTALL_MEMCACHED} + 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 @@ -331,17 +370,24 @@ jobs: - name: Generate build tree (${{ env.CMAKE_BUILD_TYPE }}) run: cmake -S . -B build - name: Build all with ${{ env.CXX }} ${{ env.CXXFLAGS }} - run: make -C build -j2 all + run: cmake --build build -j2 - name: Test - run: make -C build -j2 test + run: cmake --build build -j2 --target test - name: Install - run: make -C build -j2 install DESTDIR=/tmp - - name: Package - if: ${{ env.CMAKE_BUILD_TYPE == 'Release' && env.CC_VER == 'cur' }} - run: make -C build package + run: cmake --build build -j2 --target install -- DESTDIR=/tmp - name: Failed tests log if: ${{ failure() }} run: cat build/Testing/Temporary/LastTest.log || true + - name: Package + env: + PUSH_ARTIFACTS_ID: ${{ secrets.PUSH_ARTIFACTS_ID }} + if: env.OS_VND!='Windows' && env.CC_VER=='cur' && env.CMAKE_BUILD_TYPE=='Release' + run: | + cmake -DENABLE_SASL=ON -DBUILD_DOCS_MANGZ=ON -S . -B build + cmake --build build -j2 --target package -- VERBOSE= + cmake -DCPACK_COMPONENT_INSTALL=ON build + cmake --build build -j2 --target package -- VERBOSE= + cmake --build build -j2 --target push-artifacts -- VERBOSE= - name: Notify Gitter (success) if: ${{ success() }} run: | @@ -358,22 +404,120 @@ jobs: --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}})" - uses: codecov/codecov-action@v1.0.13 + # mac release + rel-mac: + name: rel-mac (macos-10.15, clang, cur) + runs-on: macos-10.15 # + env: + ENABLE_SASL: "OFF" + BUILD_DOCS_MANGZ: "ON" + OS_VND: macOS # + OS_VER: macos-10.15 # + CC_VND: clang # + CC_VER: cur # + continue-on-error: true + steps: + - uses: actions/checkout@v2 + - name: Install dependencies (Linux) + if: runner.os == 'Linux' + run: | + sudo apt-get install \ + libevent-dev \ + libsasl2-dev \ + libtbb-dev \ + python3-m2r \ + 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 + 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 -S . -B build + - name: Build all with ${{ env.CXX }} ${{ env.CXXFLAGS }} + run: cmake --build build -j2 + - name: Test + run: cmake --build build -j2 --target test + - name: Install + run: cmake --build build -j2 --target install -- DESTDIR=/tmp + - name: Failed tests log + if: ${{ failure() }} + run: cat build/Testing/Temporary/LastTest.log || true + - name: Package + env: + PUSH_ARTIFACTS_ID: ${{ secrets.PUSH_ARTIFACTS_ID }} + if: env.OS_VND!='Windows' && env.CC_VER=='cur' && env.CMAKE_BUILD_TYPE=='Release' + run: | + cmake -DENABLE_SASL=ON -DBUILD_DOCS_MANGZ=ON -S . -B build + cmake --build build -j2 --target package -- VERBOSE= + cmake -DCPACK_COMPONENT_INSTALL=ON build + cmake --build build -j2 --target package -- VERBOSE= + cmake --build build -j2 --target push-artifacts -- VERBOSE= + - name: Notify Gitter (success) + if: ${{ success() }} + 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() }} + 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}})" + # win build win-msvc: name: win-msvc (windows-2019, msvc, cur) runs-on: windows-2019 # env: - CMAKE_BUILD_TYPE: Release - BUILD_TESTING: "OFF" + ENABLE_SASL: "OFF" BISON_ROOT: "C:/msys64/usr" FLEX_ROOT: "C:/msys64/usr" - OS_VND: Windows - OS_VER: windows-2019 # - CC_VND: msvc # - CC_VER: cur # + OS_VND: Windows # + OS_VER: windows-2019 # + CC_VND: msvc # + CC_VER: cur # continue-on-error: true + defaults: + run: + shell: msys2 {0} steps: - uses: actions/checkout@v2 + - uses: msys2/setup-msys2@v2 + with: + release: false + path-type: inherit + install: >- + rsync + openssh - name: Generate build tree (${{ env.CMAKE_BUILD_TYPE }}) run: cmake --config ${{ env.CMAKE_BUILD_TYPE }} -S . -B build - name: Build all with ${{ env.CC_VND }} @@ -381,7 +525,11 @@ jobs: - name: Install run: cmake --install build --prefix installed --config ${{ env.CMAKE_BUILD_TYPE }} - name: Package - run: cmake -E chdir build cpack + env: + PUSH_ARTIFACTS_ID: ${{ secrets.PUSH_ARTIFACTS_ID }} + run: | + cmake --build build --config ${{ env.CMAKE_BUILD_TYPE }} --target package + cmake --build build --config ${{ env.CMAKE_BUILD_TYPE }} --target push-artifacts # release builds release: @@ -394,7 +542,7 @@ jobs: runs-on: ${{ matrix.os_ver }} continue-on-error: ${{ matrix.cc_vnd == 'clang' }} env: - CMAKE_BUILD_TYPE: Release + BUILD_DOCS_MANGZ: "ON" OS_VND: Linux OS_VER: ${{ matrix.os_ver }} CC_VND: ${{ matrix.cc_vnd }} @@ -476,13 +624,15 @@ jobs: libevent-dev \ libsasl2-dev \ libtbb-dev \ + python3-m2r \ + 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 ${INSTALL_MEMCACHED} + 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 @@ -509,17 +659,24 @@ jobs: - name: Generate build tree (${{ env.CMAKE_BUILD_TYPE }}) run: cmake -S . -B build - name: Build all with ${{ env.CXX }} ${{ env.CXXFLAGS }} - run: make -C build -j2 all + run: cmake --build build -j2 - name: Test - run: make -C build -j2 test + run: cmake --build build -j2 --target test - name: Install - run: make -C build -j2 install DESTDIR=/tmp - - name: Package - if: ${{ env.CMAKE_BUILD_TYPE == 'Release' && env.CC_VER == 'cur' }} - run: make -C build package + run: cmake --build build -j2 --target install -- DESTDIR=/tmp - name: Failed tests log if: ${{ failure() }} run: cat build/Testing/Temporary/LastTest.log || true + - name: Package + env: + PUSH_ARTIFACTS_ID: ${{ secrets.PUSH_ARTIFACTS_ID }} + if: env.OS_VND!='Windows' && env.CC_VER=='cur' && env.CMAKE_BUILD_TYPE=='Release' + run: | + cmake -DENABLE_SASL=ON -DBUILD_DOCS_MANGZ=ON -S . -B build + cmake --build build -j2 --target package -- VERBOSE= + cmake -DCPACK_COMPONENT_INSTALL=ON build + cmake --build build -j2 --target package -- VERBOSE= + cmake --build build -j2 --target push-artifacts -- VERBOSE= - name: Notify Gitter (success) if: ${{ success() }} run: | diff --git a/CMakeConfig.txt b/CMakeConfig.txt index 5203ddac..e4fee7a6 100644 --- a/CMakeConfig.txt +++ b/CMakeConfig.txt @@ -73,6 +73,12 @@ if(BUILD_TESTING) endif() endif() +if(BUILD_DOCS_MANGZ) + set(BUILD_DOCS_MAN ON) +endif() +if(BUILD_DOCS_MAN OR BUILD_DOCS_HTML) + set(BUILD_DOCS ON) +endif() if(BUILD_DOCS) set(SPHINX_OPTIONS "" CACHE STRING "additional sphinx-build command line options") diff --git a/CMakeLists.txt b/CMakeLists.txt index 436d6d8e..171e2469 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ project(libmemcached VERSION "${LIBMEMCACHED_VERSION}" DESCRIPTION "libmemcached, a C/C++ memcached client library" ) -set(CMAKE_PROJECT_HOMEPAGE_URL "https://github.com/m6w6/libmemcached") +set(PROJECT_HOMEPAGE_URL "https://github.com/m6w6/libmemcached") set(PROJECT_CONTACT "Michael Wallner ") set(CXX_STANDARD 11) @@ -55,6 +55,10 @@ if(NOT BUILD_DOCSONLY) configure_file(${CONFIGURE_FILE_IN} ${CONFIGURE_FILE_OUT} @ONLY) endif() +list(APPEND PROJECT_CONFIG ${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_PROCESSOR}) +list(APPEND PROJECT_CONFIG ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}) +list(APPEND PROJECT_CONFIG ${CMAKE_BUILD_TYPE}) + include(CPack.txt) install(FILES diff --git a/CPack.txt b/CPack.txt index 386bb131..52fefe69 100644 --- a/CPack.txt +++ b/CPack.txt @@ -1,13 +1,12 @@ # default options +set(CPACK_ARCHIVE_COMPONENT_INSTALL ${CPACK_COMPONENT_INSTALL}) +set(CPACK_SOURCE_IGNORE_FILES "/[.]git/;/[.](idea|settings|c?project);~$;[.]log$;[.]bak$") + macro(cpack_include_if GENERATOR) message(STATUS "Checking ${GENERATOR} package configuration ...") - if(EXISTS ${CMAKE_SOURCE_DIR}/CPack${GENERATOR}.txt) - message(STATUS " Sourcing ${CMAKE_SOURCE_DIR}/CPack${GENERATOR}.txt") - include(${CMAKE_SOURCE_DIR}/CPack${GENERATOR}.txt) - elseif(EXISTS ${CMAKE_BINARY_DIR}/CPack${GENERATOR}.txt) - message(STATUS " Sourcing ${CMAKE_BINARY_DIR}/CPack${GENERATOR}.txt") - include(${CMAKE_BINARY_DIR}/CPack${GENERATOR}.txt) + if(EXISTS ${CMAKE_SOURCE_DIR}/CPack/${GENERATOR}.txt) + include(${CMAKE_SOURCE_DIR}/CPack/${GENERATOR}.txt) endif() endmacro() @@ -39,19 +38,27 @@ set(CPACK_PACKAGE_DESCRIPTION memcached server (http://memcached.org/). It has been designed to be light on memory usage, thread safe, and provide full access to server side methods.") -set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}/${CPACK_PACKAGE_VERSION}") -#set(CPACK_PACKAGE_CHECKSUM SHA1) +list(JOIN PROJECT_CONFIG "-" CPACK_PACKAGE_DIRECTORY) +set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README.md") +set(CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME}/${PROJECT_VERSION}") +set(CPACK_PACKAGE_CHECKSUM SHA1) set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE") set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.md") set(CPACK_CHANGELOG_FILE "${CMAKE_SOURCE_DIR}/ChangeLog-1.1.md") -set(CPACK_SOURCE_IGNORE_FILES "/[.]git/;/[.](idea|settings|c?project);~$;[.]log$;[.]bak$") -set(CPACK_PACKAGE_FILE_NAME - "${CMAKE_PROJECT_NAME}-${CMAKE_PROJECT_VERSION}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}") - -set(CPACK_ARCHIVE_COMPONENT_INSTALL ${CPACK_COMPONENT_INSTALL}) -set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME lib) +execute_process( + COMMAND git describe --tags --match [0-9]*.* + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE PROJECT_TAG + ERROR_VARIABLE IGNORED +) +string(STRIP "${PROJECT_TAG}" PROJECT_TAG) +if(PROJECT_TAG) + set(CPACK_PACKAGE_FILE_NAME ${PROJECT_NAME}-${PROJECT_TAG}) +else() + set(CPACK_PACKAGE_FILE_NAME ${PROJECT_NAME}-${PROJECT_VERSION}) +endif() # dependencies if(HAVE_LIBSASL) @@ -64,28 +71,29 @@ if(HAVE_LIBEVENT) string(APPEND CPACK_PACKAGE_DEPENDS " libevent") endif() - # DEBs -if(EXISTS /usr/bin/dpkg) +find_program(DPKG dpkg) +if(DPKG) cpack_include_if(DEB) endif() -if(APPLE) -endif() - +# WIN if(WIN32) cpack_include_if(NSIS) endif() -# BSDs -if(CMAKE_SYSTEM_NAME MATCHES BSD) - cpack_include_if(BSD) -endif() - # RPMs -if(EXISTS /usr/bin/dnf OR EXISTS /usr/bin/yum OR EXISTS /usr/bin/rpmbuild) +find_program(RPMBUILD rpmbuild) +if(RPMBUILD) cpack_include_if(RPM) endif() # keep last include(CPack) + +add_custom_target(push-artifacts + COMMAND ${CMAKE_SOURCE_DIR}/scripts/push-artifacts.sh + ${CPACK_PACKAGE_DIRECTORY}/${PROJECT_NAME}-* + WORKING_DIRECTORY ${CPACK_BINARY_DIR} + ) + diff --git a/CPackDEB.txt b/CPack/DEB.txt similarity index 100% rename from CPackDEB.txt rename to CPack/DEB.txt diff --git a/CPack/NSIS.txt b/CPack/NSIS.txt new file mode 100644 index 00000000..918931e1 --- /dev/null +++ b/CPack/NSIS.txt @@ -0,0 +1,5 @@ +set(CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME}\\\\${PROJECT_VERSION}") +set(CPACK_NSIS_MODIFY_PATH ON) +set(CPACK_NSIS_DISPLAY_NAME "${PROJECT_NAME}-${PROJECT_VERSION}") +set(CPACK_NSIS_PACKAGE_NAME "${PROJECT_NAME}") +set(CPACK_NSIS_HELP_LINK "${PROJECT_HOMEPAGE_URL}") diff --git a/CPackRPM.txt b/CPack/RPM.txt similarity index 100% rename from CPackRPM.txt rename to CPack/RPM.txt diff --git a/CPackFreeBSD.txt b/CPackFreeBSD.txt deleted file mode 100644 index 88106d5f..00000000 --- a/CPackFreeBSD.txt +++ /dev/null @@ -1,2 +0,0 @@ -set(CPACK_BINARY_FREEBSD ON) -set(CPACK_FREEBSD_PACKAGE_LICENSE "${CPACK_PACKAGE_LICENSE}") diff --git a/CPackNSIS.txt b/CPackNSIS.txt deleted file mode 100644 index 1a8733e5..00000000 --- a/CPackNSIS.txt +++ /dev/null @@ -1,5 +0,0 @@ -set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CMAKE_PROJECT_NAME}\\\\${CMAKE_PROJECT_VERSION}") -set(CPACK_NSIS_MODIFY_PATH ON) -set(CPACK_NSIS_DISPLAY_NAME "${CMAKE_PROJECT_NAME}-${CMAKE_PROJECT_VERSION}") -set(CPACK_NSIS_PACKAGE_NAME "${CMAKE_PROJECT_NAME}") -set(CPACK_NSIS_HELP_LINK "${CMAKE_PROJECT_HOMEPAGE_URL}") diff --git a/scripts/push-artifacts.conf b/scripts/push-artifacts.conf new file mode 100644 index 00000000..6d1e8f20 --- /dev/null +++ b/scripts/push-artifacts.conf @@ -0,0 +1,8 @@ +StrictHostKeyChecking no +UserKnownHostsFile /dev/null +User artifacts +Port 2 +HostName artifacts.m6w6.name +IdentityFile ~/.ssh/id_ed25519 +IdentityFile push-artifacts.id + diff --git a/scripts/push-artifacts.sh b/scripts/push-artifacts.sh new file mode 100755 index 00000000..45280ee3 --- /dev/null +++ b/scripts/push-artifacts.sh @@ -0,0 +1,10 @@ +#!/bin/bash +# push artifacts to https://artifacts.m6w6.name/libmemcached/ + +if test -n "$PUSH_ARTIFACTS_ID" +then + echo "$PUSH_ARTIFACTS_ID" > push-artifacts.id +fi + +RSYNC_CONF=$(dirname $0)/push-artifacts.conf +rsync -RPae "ssh -F $RSYNC_CONF" "$@" m6w6.name::artifacts/libmemcached/ -- 2.30.2