|
| 1 | +name: CMake |
| 2 | + |
| 3 | +on: [push, pull_request, workflow_dispatch] |
| 4 | + |
| 5 | +env: |
| 6 | + # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) |
| 7 | + BUILD_TYPE: Release |
| 8 | + |
| 9 | +jobs: |
| 10 | + build: |
| 11 | + strategy: |
| 12 | + fail-fast: false |
| 13 | + matrix: |
| 14 | + os: [ubuntu-latest, macos-latest, windows-latest] |
| 15 | + runs-on: ${{ matrix.os }} |
| 16 | + |
| 17 | + # The CMake configure and build commands are platform agnostic and should work equally |
| 18 | + # well on Windows or Mac. You can convert this to a matrix build if you need |
| 19 | + # cross-platform coverage. |
| 20 | + # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix |
| 21 | + |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v2 |
| 24 | + |
| 25 | + - name: Fetch packages (Linux) |
| 26 | + if: runner.os == 'Linux' |
| 27 | + run: | |
| 28 | + sudo apt-get update |
| 29 | + sudo apt-get install libasound2-dev librtmidi-dev erlang-dev |
| 30 | +
|
| 31 | + - name: Fetch packages (Mac) |
| 32 | + continue-on-error: true |
| 33 | + if: runner.os == 'macOS' |
| 34 | + run: | |
| 35 | + export HOMEBREW_NO_INSTALL_CLEANUP=1 |
| 36 | + brew update |
| 37 | + brew install erlang |
| 38 | +
|
| 39 | + - name: Fetch packages (Windows) |
| 40 | + if: runner.os == 'Windows' |
| 41 | + run: choco install erlang |
| 42 | + |
| 43 | +# - name: Setup tmate session |
| 44 | +# if: runner.os == 'Windows' |
| 45 | +# uses: mxschmitt/action-tmate@v3 |
| 46 | +# timeout-minutes: 15 |
| 47 | + |
| 48 | + - name: Create Build Environment |
| 49 | + # Some projects don't allow in-source building, so create a separate build directory |
| 50 | + # We'll use this as our working directory for all subsequent commands |
| 51 | + run: cmake -E make_directory ${{github.workspace}}/build |
| 52 | + |
| 53 | + - name: Configure CMake |
| 54 | + # Use a bash shell so we can use the same syntax for environment variable |
| 55 | + # access regardless of the host operating system |
| 56 | + shell: bash |
| 57 | + working-directory: ${{github.workspace}}/build |
| 58 | + # Note the current convention is to use the -S and -B options here to specify source |
| 59 | + # and build directories, but this is only available with CMake 3.13 and higher. |
| 60 | + # The CMake binaries on the Github Actions machines are (as of this writing) 3.12 |
| 61 | + run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE |
| 62 | + |
| 63 | + - name: Build |
| 64 | + working-directory: ${{github.workspace}}/build |
| 65 | + shell: bash |
| 66 | + # Execute the build. You can specify a specific target with "--target <NAME>" |
| 67 | + run: cmake --build . --config $BUILD_TYPE |
0 commit comments