From 73bd8bd65a1db45e299c994fba31f19523638409 Mon Sep 17 00:00:00 2001 From: FranciscoPombal Date: Fri, 2 Oct 2020 19:22:00 +0100 Subject: [PATCH] Add GitHub Actions CI workflow for CMake build --- .github/workflows/ci.yaml | 116 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 .github/workflows/ci.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 00000000000..e3ba1f6dede --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,116 @@ +name: GitHub Actions CI + +on: + push: + branches: [ RC_1_2 ] + pull_request: + types: [edited, opened, reopened, synchronize] + branches: [ RC_1_2 ] + +env: + # openssl: 1.1.1g#1 + # boost: 1.73.0 + VCPKG_COMMIT: 76a7e9248fb3c57350b559966dcaa2d52a5e4458 + VCPKG_DEST_WIN: C:\libt_tools\vcpkg + VCPKG_TRIPLET: "x64-windows" + BUILD_VARIANT: "shared" + LIBT_STATIC_RT: "OFF" + LIBT_BSL: "ON" + LIBT_TESTS: "ON" + LIBT_DEPR_FUN: "ON" + +defaults: + run: + shell: pwsh + +jobs: + + ci_windows_static: + name: Windows + vcpkg + + strategy: + matrix: + build_variant: [shared, static] + deprecated_functions: [depr_fun, no_depr_fun] + build_config: [Release] + fail-fast: false + + runs-on: windows-2019 + + steps: + - name: checkout repository + uses: actions/checkout@v2.3.3 + + - name: setup environment - static build + if: matrix.build_variant == 'static' + run: | + echo "::set-env name=LIBT_STATIC_RT::ON" + echo "::set-env name=LIBT_BSL::OFF" + echo "::set-env name=VCPKG_TRIPLET::x64-windows-static" + echo "::set-env name=BUILD_VARIANT::static" + + - name: setup environment - build with no deprecated functions + if: matrix.deprecated_functions == 'no_depr_fun' + run: | + echo "::set-env name=LIBT_TESTS::OFF" + echo "::set-env name=LIBT_DEPR_FUN::OFF" + + # NOTE: MSVC tools must be in the path for the Ninja generator. Caveat: must use cmd + - name: setup MSVC dev cmd + uses: ilammy/msvc-dev-cmd@v1.4.1 + + # ninja is preferrable, not a hard requirement + - name: install additional required packages with chocolatey + run: | + choco install ninja + + - name: setup vcpkg (cached, if possible) + uses: lukka/run-vcpkg@v4.0 + with: + vcpkgDirectory: ${{ env.VCPKG_DEST_WIN }} + vcpkgGitCommitId: ${{ env.VCPKG_COMMIT }} + setupOnly: true + appendedCacheKey: ${{ matrix.build_variant }} + + # clear buildtrees to reduce disk space requirements + - name: install dependencies via vcpkg + run: | + ${{ env.RUNVCPKG_VCPKG_ROOT }}/vcpkg.exe install ` + boost-asio:${{ env.VCPKG_TRIPLET }} ` + boost-chrono:${{ env.VCPKG_TRIPLET }} ` + boost-config:${{ env.VCPKG_TRIPLET }} ` + boost-crc:${{ env.VCPKG_TRIPLET }} ` + boost-date-time:${{ env.VCPKG_TRIPLET }} ` + boost-iterator:${{ env.VCPKG_TRIPLET }} ` + boost-multiprecision:${{ env.VCPKG_TRIPLET }} ` + boost-pool:${{ env.VCPKG_TRIPLET }} ` + boost-random:${{ env.VCPKG_TRIPLET }} ` + boost-scope-exit:${{ env.VCPKG_TRIPLET }} ` + boost-system:${{ env.VCPKG_TRIPLET }} ` + boost-variant:${{ env.VCPKG_TRIPLET }} ` + openssl:${{ env.VCPKG_TRIPLET }} ` + --clean-after-build + + - name: build libtorrent + shell: cmd + run: | + cmake -B cmake-build-dir -G "Ninja" ^ + -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=${{ matrix.build_config }} ^ + -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_DEST_WIN }}\scripts\buildsystems\vcpkg.cmake ^ + -DVCPKG_TARGET_TRIPLET=${{ env.VCPKG_TRIPLET }} ^ + -Dbuild_examples=ON -Dbuild_tools=ON ^ + -Dbuild_tests=${{ env.LIBT_TESTS }} -Ddeprecated-functions=${{ env.LIBT_DEPR_FUN }} ^ + -DBUILD_SHARED_LIBS=${{ env.LIBT_BSL }} -Dstatic_runtime=${{ env.LIBT_STATIC_RT }} ^ + --graphviz=cmake-build-dir\target_graph.dot + cmake --build cmake-build-dir + + - name: run libtorrent tests + run: | + ctest + + - name: upload artifact as zip + uses: actions/upload-artifact@v2.2.0 + with: + name: libtorrent_RC_1_2-CI-Windows_x64-${{ matrix.build_variant }}-${{ matrix.deprecated_functions }}-${{ matrix.build_config }} + path: | + cmake-build-dir