|
| 1 | +name: C/C++ CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - v*.* |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - master |
| 10 | + |
| 11 | +env: |
| 12 | + LSL_URL: 'https://github.com/sccn/liblsl/releases/download' |
| 13 | + LSL_RELEASE_PREFIX: '' |
| 14 | + LSL_RELEASE: '1.13.1' |
| 15 | + |
| 16 | + |
| 17 | +jobs: |
| 18 | + build: |
| 19 | + runs-on: ${{ matrix.os }} |
| 20 | + strategy: |
| 21 | + matrix: |
| 22 | + os: |
| 23 | + - ubuntu-latest |
| 24 | + - windows-latest |
| 25 | + - macOS-latest |
| 26 | + fail-fast: false |
| 27 | + |
| 28 | + steps: |
| 29 | + - uses: actions/checkout@v2 |
| 30 | + |
| 31 | + - name: CMake version |
| 32 | + run: cmake --version |
| 33 | + |
| 34 | + - name: Install Qt (Windows) |
| 35 | + if: matrix.os == 'windows-latest' |
| 36 | + uses: jurplel/install-qt-action@v2 |
| 37 | + with: |
| 38 | + version: 5.14.0 |
| 39 | + |
| 40 | + - name: Get liblsl (Windows) |
| 41 | + if: matrix.os == 'windows-latest' |
| 42 | + run: | |
| 43 | + Invoke-WebRequest -Uri $Env:LSL_URL/$Env:LSL_RELEASE_PREFIX$Env:LSL_RELEASE/liblsl-$Env:LSL_RELEASE-Win64.zip -o liblsl.7z |
| 44 | + 7z x liblsl.7z -oLSL |
| 45 | + - name: Get liblsl and Qt (Ubuntu) |
| 46 | + if: matrix.os == 'ubuntu-latest' |
| 47 | + run: | |
| 48 | + echo ${{ github.ref }} |
| 49 | + curl -L ${LSL_URL}/${LSL_RELEASE_PREFIX}${LSL_RELEASE}/liblsl-${LSL_RELEASE}-Linux64-bionic.deb -o liblsl.deb |
| 50 | + sudo dpkg -i liblsl.deb |
| 51 | + sudo apt install -y qtbase5-dev |
| 52 | +
|
| 53 | + - name: Get liblsl and Qt (macOS) |
| 54 | + if: matrix.os == 'macOS-latest' |
| 55 | + # curl -L ${LSL_URL}/${LSL_RELEASE_PREFIX}${LSL_RELEASE}/liblsl-${LSL_RELEASE}-MacOS10.13.tar.bz2 -o liblsl.tar.bz2 |
| 56 | + run: | |
| 57 | + curl -L ${LSL_URL}/v1.14.0b3/liblsl-1.14.0-MacOS10.13.tar.bz2 -o liblsl.tar.bz2 |
| 58 | + mkdir LSL |
| 59 | + tar -xvf liblsl.tar.bz2 -C LSL |
| 60 | + brew install qt |
| 61 | + echo '::set-env name=CMAKE_PREFIX_PATH::/usr/local/opt/qt' |
| 62 | +
|
| 63 | + - name: Configure CMake |
| 64 | + shell: bash |
| 65 | + run: | |
| 66 | + cmake -S . -B build -DLSL_INSTALL_ROOT=$PWD/LSL/ -DCPACK_DEBIAN_PACKAGE_SHLIBDEPS=ON -DCPACK_DEBIAN_PACKAGE_DEPENDS=1 |
| 67 | +
|
| 68 | + - name: Make & Install |
| 69 | + run: cmake --build build --config Release -j --target install |
| 70 | + |
| 71 | + - name: Package |
| 72 | + run: cmake --build build --config Release -j --target package |
| 73 | + |
| 74 | + - name: Upload Artifacts |
| 75 | + uses: actions/upload-artifact@v2-preview |
| 76 | + with: |
| 77 | + name: pkg-${{ matrix.os }} |
| 78 | + path: build/*.[dbz][ezi][b2p] # Hack to get deb, bz2, zip. Will also get e.g. de2, dep, dzb, dz2, dzp, etc... |
| 79 | + |
| 80 | + release: |
| 81 | + needs: build |
| 82 | + runs-on: ubuntu-latest |
| 83 | + steps: |
| 84 | + |
| 85 | + - name: Download Artifacts |
| 86 | + if: startsWith(github.ref, 'refs/tags/') |
| 87 | + uses: actions/download-artifact@v2-preview |
| 88 | + # By not specifying with: name:, it defaults to downloading all artifacts. |
| 89 | + |
| 90 | + # Official GitHub Upload-Asset action does not allow for uploading multiple files. |
| 91 | + # There are many community alternatives. Below is one that combines release and upload, with globbing. |
| 92 | + # See also: svenstaro/upload-release-action shogo82148/actions-upload-release-asset meeDamian/github-release csexton/release-asset-action |
| 93 | + - name: Create Release |
| 94 | + if: startsWith(github.ref, 'refs/tags/') |
| 95 | + id: create_release |
| 96 | + uses: softprops/action-gh-release@v1 |
| 97 | + env: |
| 98 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 99 | + with: |
| 100 | + # tag_name: ${{ github.ref }} # ${{ github.ref }} is default |
| 101 | + name: Release ${{ github.ref }} |
| 102 | + draft: false |
| 103 | + prerelease: false |
| 104 | + # body_path: CHANGELOG.txt |
| 105 | + files: pkg-*/* |
0 commit comments