From b676f485db1323f86e88ac199ca38e219c0ec74a Mon Sep 17 00:00:00 2001 From: Chadwick Boulay Date: Sat, 7 Mar 2020 12:33:40 -0500 Subject: [PATCH] testing update of GitHub Actions --- .github/workflows/cppcmake.yml | 111 ++++++++++++++++++++++++++++----- 1 file changed, 94 insertions(+), 17 deletions(-) diff --git a/.github/workflows/cppcmake.yml b/.github/workflows/cppcmake.yml index 09585ee..ac1a689 100644 --- a/.github/workflows/cppcmake.yml +++ b/.github/workflows/cppcmake.yml @@ -2,16 +2,17 @@ name: C/C++ CI on: push: - branches: - - master + tags: + - v*.* pull_request: branches: - master env: LSL_URL: 'https://github.com/sccn/liblsl/releases/download' - LSL_RELEASE: '1.13.0' - LSL_RELEASE_SUFFIX: '' + LSL_RELEASE_PREFIX: 'v' + LSL_RELEASE: '1.14.0' + LSL_RELEASE_SUFFIX: 'b1' jobs: @@ -24,44 +25,120 @@ jobs: - windows-latest - macOS-latest fail-fast: false + steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 + - name: CMake version run: cmake --version + - name: download liblsl (Ubuntu) + if: matrix.os == 'ubuntu-latest' run: | - curl -L ${LSL_URL}/${LSL_RELEASE}${LSL_RELEASE_SUFFIX}/liblsl-${LSL_RELEASE}-Linux64-bionic.deb -o liblsl.deb + echo ${{ github.ref }} + curl -L ${LSL_URL}/${LSL_RELEASE_PREFIX}${LSL_RELEASE}${LSL_RELEASE_SUFFIX}/liblsl-${LSL_RELEASE}-Linux64-bionic.deb -o liblsl.deb sudo dpkg -i liblsl.deb - sudo apt install -y qtbase5-dev - if: matrix.os == 'ubuntu-latest' + sudo apt install -y qtbase5-dev qtmultimedia5-dev + - name: download liblsl (Windows) + if: matrix.os == 'windows-latest' run: | - Invoke-WebRequest -Uri $Env:LSL_URL/$Env:LSL_RELEASE$Env:LSL_RELEASE_SUFFIX/liblsl-$Env:LSL_RELEASE-Win64.zip -o liblsl.7z + 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 7z x liblsl.7z -oLSL - if: matrix.os == 'windows-latest' + - name: download liblsl (macOS) + if: matrix.os == 'macOS-latest' run: | - curl -L ${LSL_URL}/${LSL_RELEASE}${LSL_RELEASE_SUFFIX}/liblsl-${LSL_RELEASE}-OSX64.tar.bz2 -o liblsl.tar.bz2 + curl -L ${LSL_URL}/${LSL_RELEASE_PREFIX}${LSL_RELEASE}${LSL_RELEASE_SUFFIX}/liblsl-${LSL_RELEASE}-OSX64.tar.bz2 -o liblsl.tar.bz2 mkdir LSL tar -xvf liblsl.tar.bz2 -C LSL brew install qt echo '::set-env name=CMAKE_PREFIX_PATH::/usr/local/opt/qt' - if: matrix.os == 'macOS-latest' + # TODO: Need to fix liblsl CI + - name: Install Qt + if: matrix.os == 'windows-latest' # uses: jurplel/install-qt-action@v2 uses: ouuan/install-qt-action@v2.3.1 # workaround until the aqtinstall timeout is fixed with: version: 5.14.0 - if: matrix.os == 'windows-latest' + - name: Configure CMake shell: bash run: | cmake -S . -B build -DLSL_INSTALL_ROOT=$PWD/LSL/ -DCPACK_DEBIAN_PACKAGE_SHLIBDEPS=ON -DCPACK_DEBIAN_PACKAGE_DEPENDS=1 - - name: make + + - name: Make run: cmake --build build --config Release -j - - name: package + + - name: Install run: cmake --build build --config Release -j --target install - - uses: actions/upload-artifact@master + + - name: Package + run: cmake --build build --config Release -j --target package + + # TODO: upload-artifact@v2 (in-progress) will support file glob + - name: Upload Artifacts (ubuntu) + if: matrix.os == 'ubuntu-latest' + uses: actions/upload-artifact@master + with: + name: pkg-${{ matrix.os }} + path: build/AppTemplate_cpp_qt-1.13.0-Linux64-bionic.deb + + - name: Upload Artifacts (macOS) + if: matrix.os == 'macOS-latest' + uses: actions/upload-artifact@master + with: + name: pkg-${{ matrix.os }} + path: build/AppTemplate_cpp_qt-1.13.0-OSX64.tar.bz2 + + # TODO: Can reconstruct filename from project name and version in CMakeCache.txt using powershell: + # Select-String -Path build\CMakeCache.txt -Pattern "CMAKE_PROJECT_NAME:STATIC=(.*)" | % { $_.matches.groups[1] } | % {$_.Value} + # Select-String -Path build\CMakeCache.txt -Pattern "CMAKE_PROJECT_VERSION:STATIC=(.*)" | % { $_.matches.groups[1] } | % {$_.Value} + - name: Upload Artifacts (windows) + if: matrix.os == 'windows-latest' + uses: actions/upload-artifact@master with: name: pkg-${{ matrix.os }} - path: build/install + path: build/AppTemplate_cpp_qt-1.13.0-Win64.zip + + release: + needs: build + runs-on: ubuntu-latest + steps: + + # TODO: download-artifact@v2 will support multiple download + - name: Download Artifact (ubuntu) + if: startsWith(github.ref, 'refs/tags/') + uses: actions/download-artifact@v1 + with: + name: pkg-ubuntu-latest + + - name: Download Artifact (windows) + if: startsWith(github.ref, 'refs/tags/') + uses: actions/download-artifact@v1 + with: + name: pkg-windows-latest + + - name: Download Artifact (macOS) + if: startsWith(github.ref, 'refs/tags/') + uses: actions/download-artifact@v1 + with: + name: pkg-macOS-latest + + - name: Create Release + if: startsWith(github.ref, 'refs/tags/') + id: create_release + uses: softprops/action-gh-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + # tag_name: ${{ github.ref }} # ${{ github.ref }} is default + name: Release ${{ github.ref }} + draft: false + prerelease: false + # body_path: CHANGELOG.txt + files: | + pkg-ubuntu-latest/AppTemplate_cpp_qt-1.13.0-Linux64-bionic.deb + pkg-macOS-latest/AppTemplate_cpp_qt-1.13.0-OSX64.tar.bz2 + pkg-windows-latest/AppTemplate_cpp_qt-1.13.0-Win64.zip