forked from sccn/liblsl
-
Notifications
You must be signed in to change notification settings - Fork 1
139 lines (129 loc) · 5.23 KB
/
cppcmake.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: C/C++ CI
on:
push:
branches: ['*']
tags: ['*']
paths:
- '**'
- '!docs/**'
- '!.github/**'
- '.github/workflows/cppcmake.yml'
pull_request:
release:
types: ['created']
workflow_dispatch:
inputs:
cmakeextra:
description: 'Extra CMake options'
required: false
default: ''
defaults:
run:
shell: bash
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {name: "ubuntu-20.04", os: "ubuntu-20.04", cmake_extra: "-DLSL_BUNDLED_PUGIXML=OFF"}
- {name: "ubuntu-18.04", os: "ubuntu-latest", docker: "ubuntu:18.04" }
- {name: "windows-x64", os: "windows-2019", cmake_extra: "-T v140,host=x86"}
- {name: "windows-32", os: "windows-2019", cmake_extra: "-T v140,host=x86 -A Win32"}
- {name: "macOS-latest", os: "macOS-latest"}
# runs all steps in the container configured in config.docker or as subprocesses when empty
container: ${{ matrix.config.docker }}
steps:
- uses: actions/checkout@v2
- name: set up build environment in container
run: |
apt update
apt install -y --no-install-recommends g++ git python3-pip ninja-build file dpkg-dev lsb-release sudo curl
python3 -m pip install cmake
if: ${{ matrix.config.docker }}
- name: Configure CMake
run: |
if [[ "${{ matrix.config.os }}" == "ubuntu-20.04" ]]; then
sudo apt-get install libpugixml-dev
fi
cmake --version
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${PWD}/install \
-DLSL_UNITTESTS=ON \
-DLSL_BENCHMARKS=ON \
-DLSL_BUILD_EXAMPLES=ON \
-DCPACK_PACKAGE_DIRECTORY=${PWD}/package \
-Dlslgitrevision=${{ github.sha }} \
-Dlslgitbranch=${{ github.ref }} \
${{ matrix.config.cmake_extra }} \
${{ github.event.inputs.cmakeextra }}
echo ${PWD}
- name: make
run: cmake --build build --target install --config Release -j
- name: package
run: |
echo $GITHUB_REF
cmake --build build --target package --config Release -j
echo $PWD
ls -la
# On Debian / Ubuntu the dependencies can only be resolved for
# already installed packages. Therefore, we have built all
# packages without dependencies in the previous step,
# install them and rebuild them with dependency discovery enabled
if [[ "${{ matrix.config.os }}" == ubuntu-* ]]; then
cmake -DCPACK_DEBIAN_PACKAGE_SHLIBDEPS=ON .
sudo dpkg -i package/*.deb
cmake --build build --target package --config Release -j
dpkg -I package/liblsl*.deb
fi
cmake -E remove_directory package/_CPack_Packages
cp testing/lslcfgs/default.cfg .
- name: upload install dir
uses: actions/upload-artifact@master
with:
name: build-${{ matrix.config.name }}
path: install
- name: upload package
uses: actions/upload-artifact@master
with:
name: pkg-${{ matrix.config.name }}
path: package
- name: print network config
run: |
which ifconfig && ifconfig
if [ `which ip` ]; then
ip link
ip addr
ip route
ip -6 route
fi
# run internal tests, ignore test failures on docker (missing IPv6 connectivity)
- name: unit tests (internal functions)
run: 'install/bin/lsl_test_internal --order rand --wait-for-keypress never --durations yes || test ! -z "${{ matrix.config.docker }}"'
timeout-minutes: 5
- name: unit tests (exported functions)
run: install/bin/lsl_test_exported --order rand --wait-for-keypress never --durations yes
timeout-minutes: 5
if: ${{ success() || failure() }}
- name: upload to release page
if: github.event_name == 'release'
env:
TOKEN: "token ${{ secrets.GITHUB_TOKEN }}"
TAG: ${{ github.event.release.tag_name }}
UPLOAD_URL: ${{ github.event.release.upload_url }}
run: |
# Do try this at home! The REST API is documented at
# https://docs.github.com/en/free-pro-team@latest/rest and you can get a personal
# access token at https://github.com/settings/tokens
# (set TOKEN to "bearer abcdef1234")
# you can get the UPLOAD_URL with a short bash snippet; make sure to set the env var TAG:
# UPLOAD_URL=$(curl -H 'Accept: application/vnd.github.v3+json' $GITHUB_API_URL/repos/$GITHUB_REPOSITORY/releases/tags/$TAG | jq -r .upload_url)
UPLOAD_URL=${UPLOAD_URL%\{*} # remove "{name,label}" suffix
for pkg in package/*.*; do
NAME=$(basename $pkg)
MIME=$(file --mime-type $pkg|cut -d ' ' -f2)
curl -X POST -H "Accept: application/vnd.github.v3+json" -H "Authorization: $TOKEN" -H "Content-Type: $MIME" --data-binary @$pkg $UPLOAD_URL?name=$NAME
done