Skip to content

Commit 3b5eed7

Browse files
authored
Merge pull request #9 from labstreaminglayer/ghrelease
CI: update liblsl release, release uploading
2 parents df5848d + 0f365ea commit 3b5eed7

File tree

2 files changed

+54
-67
lines changed

2 files changed

+54
-67
lines changed

.github/workflows/cppcmake.yml

Lines changed: 53 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -7,107 +7,94 @@ on:
77
pull_request:
88
branches:
99
- master
10+
release:
11+
types: ['created']
1012

1113
env:
12-
LSL_URL: 'https://github.com/sccn/liblsl/releases/download'
13-
LSL_RELEASE_PREFIX: 'v'
14+
LSL_RELEASE_URL: 'https://github.com/sccn/liblsl/releases/download/v1.14.0rc1'
1415
LSL_RELEASE: '1.14.0'
15-
LSL_RELEASE_SUFFIX: 'b4'
16+
17+
defaults:
18+
run:
19+
shell: bash
1620

1721

1822
jobs:
1923
build:
20-
runs-on: ${{ matrix.os }}
24+
name: ${{ matrix.config.name }}
25+
runs-on: ${{ matrix.config.os }}
2126
strategy:
22-
matrix:
23-
os:
24-
- ubuntu-latest
25-
- windows-latest
26-
- macOS-latest
2727
fail-fast: false
28-
28+
matrix:
29+
config:
30+
- {name: "ubuntu-20.04", os: "ubuntu-20.04"}
31+
# - {name: "ubuntu-18.04", os: "ubuntu-18.04"}
32+
- {name: "ubuntu-16.04", os: "ubuntu-16.04"}
33+
- {name: "windows-x64", os: "windows-latest"}
34+
- {name: "macOS-latest", os: "macOS-latest"}
2935
steps:
3036
- uses: actions/checkout@v2
31-
32-
- name: CMake version
33-
run: cmake --version
34-
3537
- name: download liblsl (Ubuntu)
36-
if: matrix.os == 'ubuntu-latest'
38+
if: startsWith(matrix.config.os, 'ubuntu-')
3739
run: |
38-
echo ${{ github.ref }}
39-
curl -L ${LSL_URL}/${LSL_RELEASE_PREFIX}${LSL_RELEASE}${LSL_RELEASE_SUFFIX}/liblsl-${LSL_RELEASE}-Linux64-bionic.deb -o liblsl.deb
40+
curl -L ${LSL_RELEASE_URL}/liblsl-${LSL_RELEASE}-$(lsb_release -sc)_amd64.deb -o liblsl.deb
4041
sudo dpkg -i liblsl.deb
41-
sudo apt install -y qtbase5-dev qtmultimedia5-dev
42+
sudo apt-get install -y qtbase5-dev qtmultimedia5-dev
4243
4344
- name: download liblsl (Windows)
44-
if: matrix.os == 'windows-latest'
45+
if: matrix.config.os == 'windows-latest'
4546
run: |
46-
Invoke-WebRequest -Uri $Env:LSL_URL/$Env:LSL_RELEASE_PREFIX$Env:LSL_RELEASE$Env:LSL_RELEASE_SUFFIX/liblsl-$Env:LSL_RELEASE-Win64.zip -o liblsl.7z
47-
7z x liblsl.7z -oLSL
47+
curl -L ${LSL_RELEASE_URL}/liblsl-${LSL_RELEASE}-Win_amd64.zip -o liblsl.zip
48+
7z x liblsl.zip -oLSL
4849
4950
- name: download liblsl (macOS)
50-
if: matrix.os == 'macOS-latest'
51+
if: matrix.config.os == 'macOS-latest'
5152
run: |
52-
curl -L ${LSL_URL}/${LSL_RELEASE_PREFIX}${LSL_RELEASE}${LSL_RELEASE_SUFFIX}/liblsl-${LSL_RELEASE}-OSX64.tar.bz2 -o liblsl.tar.bz2
53+
curl -L ${LSL_RELEASE_URL}/liblsl-${LSL_RELEASE}-OSX_amd64.tar.bz2 -o liblsl.tar.bz2
5354
mkdir LSL
5455
tar -xvf liblsl.tar.bz2 -C LSL
5556
brew install qt
56-
echo '::set-env name=CMAKE_PREFIX_PATH::/usr/local/opt/qt'
57-
# TODO: Need to fix liblsl CI
5857
5958
- name: Install Qt
60-
if: matrix.os == 'windows-latest'
59+
if: matrix.config.os == 'windows-latest'
6160
uses: jurplel/install-qt-action@v2
6261
with:
6362
version: 5.15.1
6463

6564
- name: Configure CMake
66-
shell: bash
6765
run: |
68-
cmake -S . -B build -DLSL_INSTALL_ROOT=$PWD/LSL/ -DCPACK_DEBIAN_PACKAGE_SHLIBDEPS=ON -DCPACK_DEBIAN_PACKAGE_DEPENDS=1
69-
70-
- name: Make
71-
run: cmake --build build --config Release -j
72-
73-
- name: Install
66+
cmake --version
67+
test "${{ runner.os }}" == "macOS" && export CMAKE_PREFIX_PATH=/usr/local/opt/qt
68+
cmake -S . -B build \
69+
-DCMAKE_BUILD_TYPE=Release \
70+
-DCMAKE_INSTALL_PREFIX=${PWD}/install \
71+
-DCPACK_PACKAGE_DIRECTORY=${PWD}/package \
72+
-DLSL_INSTALL_ROOT=$PWD/LSL/ \
73+
-DCPACK_DEBIAN_PACKAGE_SHLIBDEPS=ON \
74+
-DCPACK_DEBIAN_PACKAGE_DEPENDS=1
75+
76+
- name: make
7477
run: cmake --build build --config Release -j --target install
7578

76-
- name: Package
77-
run: cmake --build build --config Release -j --target package
79+
- name: package
80+
run: |
81+
cmake --build build --config Release -j --target package
82+
cmake -E remove_directory package/_CPack_Packages
7883
79-
# TODO: Can reconstruct filename from project name and version in CMakeCache.txt using powershell:
80-
# Select-String -Path build\CMakeCache.txt -Pattern "CMAKE_PROJECT_NAME:STATIC=(.*)" | % { $_.matches.groups[1] } | % {$_.Value}
81-
# Select-String -Path build\CMakeCache.txt -Pattern "CMAKE_PROJECT_VERSION:STATIC=(.*)" | % { $_.matches.groups[1] } | % {$_.Value}
8284
- name: Upload Artifacts
8385
uses: actions/upload-artifact@v2
8486
with:
85-
name: pkg-${{ matrix.os }}
86-
path: |
87-
build/*.deb
88-
build/*.tar.bz2
89-
build/*.zip
90-
91-
release:
92-
needs: build
93-
runs-on: ubuntu-latest
94-
steps:
95-
96-
- name: Download Artifact
97-
if: startsWith(github.ref, 'refs/tags/')
98-
uses: actions/download-artifact@v2
99-
100-
- name: Create Release
101-
if: startsWith(github.ref, 'refs/tags/')
102-
id: create_release
103-
uses: softprops/action-gh-release@v1
87+
name: pkg-${{ matrix.config.name }}
88+
path: package
89+
- name: upload to release page
90+
if: github.event_name == 'release'
10491
env:
105-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
106-
with:
107-
# tag_name: ${{ github.ref }} # ${{ github.ref }} is default
108-
name: Release ${{ github.ref }}
109-
draft: false
110-
prerelease: false
111-
# body_path: CHANGELOG.txt
112-
files: 'pkg-*/*'
113-
92+
TOKEN: "token ${{ secrets.GITHUB_TOKEN }}"
93+
UPLOAD_URL: ${{ github.event.release.upload_url }}
94+
run: |
95+
UPLOAD_URL=${UPLOAD_URL%\{*} # remove "{name,label}" suffix
96+
for pkg in package/*.*; do
97+
NAME=$(basename $pkg)
98+
MIME=$(file --mime-type $pkg|cut -d ' ' -f2)
99+
curl -X POST -H "Accept: application/vnd.github.v3+json" -H "Authorization: $TOKEN" -H "Content-Type: $MIME" --data-binary @$pkg $UPLOAD_URL?name=$NAME
100+
done

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
cmake_minimum_required(VERSION 3.10)
1010

1111
project(AppTemplate_cpp_qt
12-
LANGUAGES CXX
12+
LANGUAGES C CXX
1313
VERSION 1.13.0
1414
)
1515

0 commit comments

Comments
 (0)