|
| 1 | +name: Build for various platforms |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [build] |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +jobs: |
| 9 | + build: |
| 10 | + name: Upload distribution for platform `${{matrix.config.fancy_name}}` |
| 11 | + runs-on: ${{matrix.config.os}} |
| 12 | + strategy: |
| 13 | + fail-fast: false |
| 14 | + matrix: |
| 15 | + config: |
| 16 | + - { |
| 17 | + name: release-linux-gnu, |
| 18 | + fancy_name: Linux (GCC), |
| 19 | + exe: CodenamePedestrian, |
| 20 | + out: CodenamePedestrian, |
| 21 | + os: ubuntu-latest, |
| 22 | + cxx: g++, |
| 23 | + cc: gcc, |
| 24 | + } |
| 25 | + - { |
| 26 | + name: release-win-msvc, |
| 27 | + fancy_name: Windows (MSVC), |
| 28 | + exe: Debug/CodenamePedestrian.exe, |
| 29 | + out: CodenamePedestrian.exe, |
| 30 | + os: windows-latest, |
| 31 | + cxx: cl, |
| 32 | + cc: cl, |
| 33 | + } |
| 34 | + steps: |
| 35 | + - name: Install dependencies (Ubuntu) |
| 36 | + if: matrix.config.os == 'ubuntu-latest' |
| 37 | + run: | |
| 38 | + sudo apt update |
| 39 | + sudo apt install cmake gcc g++ libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev libgl-dev |
| 40 | + - name: Checkout |
| 41 | + uses: actions/checkout@v4 |
| 42 | + - name: Configure CMake with selected compiler family |
| 43 | + run: cmake -B build -S ${{github.workspace}} -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=${{matrix.config.cc}} -DCMAKE_CXX_COMPILER=${{matrix.config.cxx}} |
| 44 | + - name: Build with CMake |
| 45 | + run: cmake --build build -j 4 |
| 46 | + - name: Copy the executable into the root folder |
| 47 | + run: cp build/${{matrix.config.exe}} ${{matrix.config.out}} |
| 48 | + - name: Tar the distribution |
| 49 | + run: tar -cvf ${{matrix.config.name}}.tar ${{matrix.config.out}} assets/ |
| 50 | + - name: Upload build artifacts |
| 51 | + uses: actions/upload-artifact@v3 |
| 52 | + with: |
| 53 | + name: ${{matrix.config.fancy_name}} |
| 54 | + path: ${{matrix.config.name}}.tar |
0 commit comments