|
| 1 | +--- |
| 2 | +name: Build - Ubuntu |
| 3 | + |
| 4 | +on: |
| 5 | + workflow_dispatch: |
| 6 | + pull_request: |
| 7 | + types: [opened, synchronize, reopened, ready_for_review] |
| 8 | + push: |
| 9 | + branches: |
| 10 | + - main |
| 11 | + |
| 12 | +env: |
| 13 | + CMAKE_BUILD_PARALLEL_LEVEL: 2 |
| 14 | + MAKEFLAGS: '-j 2' |
| 15 | + |
| 16 | +jobs: |
| 17 | + job: |
| 18 | + if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }} |
| 19 | + name: ${{ matrix.os }}-${{ matrix.buildtype }} |
| 20 | + runs-on: ${{ matrix.os }} |
| 21 | + |
| 22 | + strategy: |
| 23 | + fail-fast: false |
| 24 | + matrix: |
| 25 | + os: [ubuntu-22.04] |
| 26 | + buildtype: [Release, Debug] |
| 27 | + include: |
| 28 | + - os: ubuntu-22.04 |
| 29 | + triplet: x64-linux |
| 30 | + |
| 31 | + steps: |
| 32 | + - name: Checkout repository |
| 33 | + uses: actions/checkout@main |
| 34 | + |
| 35 | + - name: Install Linux Dependencies |
| 36 | + run: > |
| 37 | + sudo apt-get update && sudo apt-get install ccache linux-headers-$(uname -r) |
| 38 | + |
| 39 | + - name: Switch to gcc-11 |
| 40 | + run: | |
| 41 | + sudo apt install gcc-11 g++-11 |
| 42 | + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100 --slave /usr/bin/g++ g++ /usr/bin/g++-11 --slave /usr/bin/gcov gcov /usr/bin/gcov-11 |
| 43 | + sudo update-alternatives --set gcc /usr/bin/gcc-11 |
| 44 | +
|
| 45 | + - name: CCache |
| 46 | + uses: hendrikmuhs/ccache-action@main |
| 47 | + with: |
| 48 | + max-size: "1G" |
| 49 | + key: ccache-${{ matrix.os }}-${{ matrix.buildtype }} |
| 50 | + restore-keys: | |
| 51 | + ccache-${{ matrix.os }} |
| 52 | +
|
| 53 | + - name: Restore artifacts and install vcpkg |
| 54 | + id: vcpkg-step |
| 55 | + run: | |
| 56 | + vcpkgCommitId=$(grep '.builtin-baseline' vcpkg.json | awk -F: '{print $2}' | tr -d '," ') |
| 57 | + echo "vcpkg commit ID: $vcpkgCommitId" |
| 58 | + echo "::set-output name=vcpkgGitCommitId::$vcpkgCommitId" |
| 59 | + - name: Get vcpkg commit id from vcpkg.json |
| 60 | + uses: lukka/run-vcpkg@main |
| 61 | + with: |
| 62 | + vcpkgGitURL: "https://github.com/microsoft/vcpkg.git" |
| 63 | + vcpkgGitCommitId: ${{ steps.vcpkg-step.outputs.vcpkgGitCommitId }} |
| 64 | + |
| 65 | + - name: Get latest CMake and ninja |
| 66 | + uses: lukka/get-cmake@main |
| 67 | + |
| 68 | + - name: Install additional libraries |
| 69 | + run: sudo apt-get install libasio-dev nlohmann-json3-dev libfmt-dev libxi-dev libgl1-mesa-dev libglu1-mesa-dev mesa-common-dev libxrandr-dev libxxf86vm-dev libglib2.0-dev at-spi2-core libwxgtk3.0-gtk3-dev libarchive-dev freeglut3-dev libxmu-dev libdbus-1-dev libxtst-dev |
| 70 | + |
| 71 | + - name: Run CMake |
| 72 | + uses: lukka/run-cmake@v3 |
| 73 | + with: |
| 74 | + cmakeListsTxtPath: ${{ github.workspace }}/CMakeLists.txt |
| 75 | + useVcpkgToolchainFile: true |
| 76 | + buildDirectory: ${{ github.workspace }}/build/ |
| 77 | + cmakeBuildType: ${{ matrix.buildtype }} |
| 78 | + |
| 79 | + - name: Create and Upload Artifact |
| 80 | + uses: actions/upload-artifact@main |
| 81 | + with: |
| 82 | + name: remeres-${{ matrix.os }}-${{ matrix.buildtype }}-${{ github.sha }} |
| 83 | + path: | |
| 84 | + ${{ github.workspace }}/build/${{ matrix.buildtype }}/bin/ |
0 commit comments