Skip to content

Commit

Permalink
Add GitHub Actions CI workflow for CMake build
Browse files Browse the repository at this point in the history
  • Loading branch information
FranciscoPombal committed Oct 4, 2020
1 parent 687d2a2 commit ea4f091
Showing 1 changed file with 116 additions and 0 deletions.
116 changes: 116 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -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: acd2f59e931172f46706ef8ac2fc9b21f71fba85
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

0 comments on commit ea4f091

Please sign in to comment.