|
| 1 | +name: CMake |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ "*" ] |
| 6 | + pull_request: |
| 7 | + branches: [ "*" ] |
| 8 | + |
| 9 | +env: |
| 10 | + # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) |
| 11 | + CMAKE_BUILD_TYPE: Release |
| 12 | + |
| 13 | +jobs: |
| 14 | + build-binaries: |
| 15 | + strategy: |
| 16 | + fail-fast: false |
| 17 | + matrix: |
| 18 | + platform: [macos-latest, ubuntu-latest, windows-latest] |
| 19 | + |
| 20 | + # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. |
| 21 | + # You can convert this to a matrix build if you need cross-platform coverage. |
| 22 | + # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix |
| 23 | + runs-on: ${{ matrix.platform }} |
| 24 | + |
| 25 | + steps: |
| 26 | + - uses: actions/checkout@v3 |
| 27 | + |
| 28 | + - name: Configure CMake |
| 29 | + # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. |
| 30 | + # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type |
| 31 | + run: | |
| 32 | + mkdir build |
| 33 | + cd build |
| 34 | + cmake .. |
| 35 | +
|
| 36 | + - name: Build |
| 37 | + # Build your program with the given configuration |
| 38 | + run: | |
| 39 | + cd build |
| 40 | + cmake --build . --config ${{ env.CMAKE_BUILD_TYPE }} |
| 41 | + ls |
| 42 | +
|
| 43 | + - name: Upload Posix Build Artifact |
| 44 | + |
| 45 | + if: runner.os != 'Windows' |
| 46 | + with: |
| 47 | + # Artifact name |
| 48 | + name: cgit_${{ runner.os }} |
| 49 | + # A file, directory or wildcard pattern that describes what to upload |
| 50 | + path: build/cgit |
| 51 | + retention-days: 15 |
| 52 | + |
| 53 | + - name: Upload Windows Build Artifact |
| 54 | + |
| 55 | + if: runner.os == 'Windows' |
| 56 | + with: |
| 57 | + # Artifact name |
| 58 | + name: cgit_${{ runner.os }} |
| 59 | + # A file, directory or wildcard pattern that describes what to upload |
| 60 | + path: build/${{ env.CMAKE_BUILD_TYPE }}/cgit.exe |
| 61 | + retention-days: 15 |
0 commit comments