|
16 | 16 | include:
|
17 | 17 | - os: windows-latest
|
18 | 18 | cpp_compiler: cl
|
19 |
| - separator: '\\' |
20 | 19 | - os: ubuntu-latest
|
21 | 20 | cpp_compiler: g++
|
22 |
| - separator: "/" |
23 | 21 |
|
24 | 22 | steps:
|
25 | 23 | - uses: actions/checkout@v4
|
@@ -58,70 +56,34 @@ jobs:
|
58 | 56 | shell: bash
|
59 | 57 | run: |
|
60 | 58 | conan profile detect --force
|
61 |
| - echo "[conf]" >> ~/.conan2/profiles/default |
62 |
| - echo "tools.system.package_manager:mode=install" >> ~/.conan2/profiles/default |
63 |
| - echo "tools.system.package_manager:sudo=True" >> ~/.conan2/profiles/default |
64 | 59 |
|
65 |
| - - name: Cache Conan packages |
66 |
| - uses: actions/cache@v3 |
67 |
| - with: |
68 |
| - path: ~/.conan2 |
69 |
| - key: ${{ runner.os }}-conan-${{ hashFiles('**/conanfile.txt') }} |
70 |
| - restore-keys: | |
71 |
| - ${{ runner.os }}-conan- |
72 |
| -
|
73 |
| - - name: Install Conan Dependencies (Linux) |
74 |
| - if: runner.os == 'Linux' |
| 60 | + - name: Install Conan Dependencies |
75 | 61 | run: |
|
76 | 62 | conan install . --build=missing -s build_type=${{ matrix.build_type }}
|
77 | 63 |
|
78 |
| - - name: Install Conan Dependencies (Windows) |
79 |
| - if: runner.os == 'Windows' |
80 |
| - shell: pwsh |
| 64 | + - name: Configure CMake |
81 | 65 | run: |
|
82 |
| - conan install . --build=missing -s build_type=${{ matrix.build_type }} '-c tools.cmake.cmake_layout:build_folder_vars=["generators"]' -c tools.cmake.cmaketoolchain:generator=Ninja |
| 66 | + cmake --preset conan-${{ matrix.build_type }} |
83 | 67 |
|
84 |
| - - name: Set Build Directory |
85 |
| - id: strings |
86 |
| - shell: bash |
87 |
| - run: | |
88 |
| - if [ "${{ runner.os }}" == "Windows" ]; then |
89 |
| - echo "build-output-dir=${{ github.workspace }}\\build\\${{ matrix.build_type }}" >> "$GITHUB_OUTPUT" |
90 |
| - echo "game-path=src\\game\\stabby.exe" >> "$GITHUB_OUTPUT" |
91 |
| - echo "preset=conan-default" >> "$GITHUB_OUTPUT" |
92 |
| - else |
93 |
| - echo "build-output-dir=${{ github.workspace }}/build/${{ matrix.build_type }}" >> "$GITHUB_OUTPUT" |
94 |
| - echo "game-path=src/game/stabby" >> "$GITHUB_OUTPUT" |
95 |
| - echo "preset=conan-release" >> "$GITHUB_OUTPUT" |
96 |
| - fi |
| 68 | + - name: Build |
| 69 | + run: cmake --build --preset conan-${{ matrix.build_type }} |
97 | 70 |
|
98 |
| - - name: Configure CMake |
| 71 | + - name: Test |
| 72 | + run: ctest --preset conan-${{ matrix.build_type }} |
| 73 | + |
| 74 | + - name: Set Artifact Path |
| 75 | + id: artifact |
99 | 76 | shell: bash
|
100 | 77 | run: |
|
101 | 78 | if [ "${{ runner.os }}" == "Windows" ]; then
|
102 |
| - build_dir="${{ github.workspace }}\\build\\${{ matrix.build_type }}" |
103 |
| - toolchain_path="${{ github.workspace }}\\build\\${{ matrix.build_type }}\\generators\\conan_toolchain.cmake" |
| 79 | + echo "game-path=build/${{ matrix.build_type }}/src/game/stabby.exe" >> "$GITHUB_OUTPUT" |
104 | 80 | else
|
105 |
| - build_dir="${{ github.workspace }}/build/${{ matrix.build_type }}" |
106 |
| - toolchain_path="${{ github.workspace }}/build/${{ matrix.build_type }}/generators/conan_toolchain.cmake" |
| 81 | + echo "game-path=build/${{ matrix.build_type }}/src/game/stabby" >> "$GITHUB_OUTPUT" |
107 | 82 | fi
|
108 | 83 |
|
109 |
| - cmake -S . \ |
110 |
| - -B "$build_dir" \ |
111 |
| - -G Ninja \ |
112 |
| - -DCMAKE_TOOLCHAIN_FILE="$toolchain_path" \ |
113 |
| - -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} |
114 |
| -
|
115 |
| - - name: Build |
116 |
| - run: cmake --build ${{ steps.strings.outputs.build-output-dir }} |
117 |
| - |
118 |
| - - name: Test |
119 |
| - working-directory: ${{ steps.strings.outputs.build-output-dir }} |
120 |
| - run: ctest --build-config ${{ matrix.build_type }} |
121 |
| - |
122 | 84 | - name: Upload Build Artifacts
|
123 | 85 | uses: actions/upload-artifact@v3
|
124 | 86 | with:
|
125 | 87 | name: ${{ runner.os }}-${{ matrix.build_type }}-build
|
126 |
| - path: ${{ steps.strings.outputs.build-output-dir }}/${{ steps.strings.outputs.game-path }} |
| 88 | + path: ${{ steps.artifact.outputs.game-path }} |
127 | 89 | if-no-files-found: ignore
|
0 commit comments