From 9e26aafbb38f074b5690706843e5a35a92c59240 Mon Sep 17 00:00:00 2001 From: MeFisto94 Date: Sat, 23 Dec 2023 04:10:56 +0100 Subject: [PATCH 01/14] First attempt at getting the server docker build to work --- .github/workflows/docker-server.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/docker-server.yml diff --git a/.github/workflows/docker-server.yml b/.github/workflows/docker-server.yml new file mode 100644 index 0000000..8036632 --- /dev/null +++ b/.github/workflows/docker-server.yml @@ -0,0 +1,18 @@ +name: Docker Image of the Server +on: + push: + branches: [ "master", "feature/ci" ] + pull_request: + branches: [ "master" ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Copying the protocol files + run: cp -rv shared/protocol server/protocol + - name: Build the Docker image + working-directory: server + run: docker build . --file Dockerfile --tag cyberverse-server:$(date +%s) From 93fcfea699feefb770d14b207192af461ec01c6a Mon Sep 17 00:00:00 2001 From: MeFisto94 Date: Sat, 23 Dec 2023 04:31:10 +0100 Subject: [PATCH 02/14] "Fix" docker server build by dynamically patching the CMakeLists so we can reference the shared protocol files from a different folder. --- server/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/server/Dockerfile b/server/Dockerfile index 5a42570..40a55c5 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -6,6 +6,7 @@ ADD protocol /workspace/protocol # generate and build RUN vcpkg install --triplet=x64-linux +RUN sed -i 's\../../shared/protocol\protocol\g' /workspace/CMakeLists.txt RUN cmake -DCMAKE_TOOLCHAIN_FILE:STRING=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake \ -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug \ -H/workspace -B/workspace/build -G Ninja From b3129e368c9ee794785e63e49f12a11b92fbc17d Mon Sep 17 00:00:00 2001 From: MeFisto94 Date: Sat, 23 Dec 2023 04:31:54 +0100 Subject: [PATCH 03/14] CI: Implement caching for intermediary docker image layers (hopefully the vcpkg install step) --- .github/workflows/docker-server.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/docker-server.yml b/.github/workflows/docker-server.yml index 8036632..2c79321 100644 --- a/.github/workflows/docker-server.yml +++ b/.github/workflows/docker-server.yml @@ -13,6 +13,8 @@ jobs: - uses: actions/checkout@v3 - name: Copying the protocol files run: cp -rv shared/protocol server/protocol + - uses: satackey/action-docker-layer-caching@v0.0.11 + continue-on-error: true - name: Build the Docker image working-directory: server run: docker build . --file Dockerfile --tag cyberverse-server:$(date +%s) From 0255052a0c9ddfa73813209f33a22d4d6f5de9dc Mon Sep 17 00:00:00 2001 From: MeFisto94 Date: Sat, 23 Dec 2023 04:44:47 +0100 Subject: [PATCH 04/14] CI: Also checkout submodules --- .github/workflows/docker-server.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/docker-server.yml b/.github/workflows/docker-server.yml index 2c79321..0642614 100644 --- a/.github/workflows/docker-server.yml +++ b/.github/workflows/docker-server.yml @@ -11,6 +11,8 @@ jobs: steps: - uses: actions/checkout@v3 + with: + submodules: recursive - name: Copying the protocol files run: cp -rv shared/protocol server/protocol - uses: satackey/action-docker-layer-caching@v0.0.11 From 66f19e8681650beb84496f0f7eba1b416e1f4df4 Mon Sep 17 00:00:00 2001 From: MeFisto94 Date: Sat, 23 Dec 2023 11:37:48 +0100 Subject: [PATCH 05/14] CI: Also add a client build --- .github/workflows/build.yml | 50 +++++++++++++++++++++++++++++ .github/workflows/docker-server.yml | 22 ------------- 2 files changed, 50 insertions(+), 22 deletions(-) create mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/docker-server.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..6a29deb --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,50 @@ +name: CI Build +on: + push: + branches: [ "master", "feature/ci" ] + pull_request: + branches: [ "master" ] + +jobs: + docker-server: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + - name: Copying the protocol files + run: cp -rv shared/protocol server/protocol + - uses: satackey/action-docker-layer-caching@v0.0.11 + continue-on-error: true + - name: Build the Docker image + working-directory: server + run: docker build . --file Dockerfile --tag cyberverse-server:$(date +%s) + + client: + runs-on: windows-latest + + env: + VCPKG_DEFAULT_TRIPLET: x64-windows + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + - uses: lukka/get-cmake@latest + - name: Setup vcpkg + uses: lukka/run-vcpkg@main + id: runvcpkg + with: + # The vcpkg.json file, which will be part of cache key computation. + vcpkgJsonGlob: 'server/Native/vcpkg.json' + - name: Run CMake with vcpkg.json manifest + uses: lukka/run-cmake@v10 + with: + cmakeListsTxtPath: '${{ github.workspace }}/server/Native/CMakeLists.txt' + configurePreset: ninja-multi-vcpkg + buildPreset: ninja-multi-vcpkg + buildPresetAdditionalArgs: '[`--config Release`]' + - name: List $RUNNER_WORKSPACE after build + run: find $RUNNER_WORKSPACE + shell: bash + diff --git a/.github/workflows/docker-server.yml b/.github/workflows/docker-server.yml deleted file mode 100644 index 0642614..0000000 --- a/.github/workflows/docker-server.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Docker Image of the Server -on: - push: - branches: [ "master", "feature/ci" ] - pull_request: - branches: [ "master" ] - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - with: - submodules: recursive - - name: Copying the protocol files - run: cp -rv shared/protocol server/protocol - - uses: satackey/action-docker-layer-caching@v0.0.11 - continue-on-error: true - - name: Build the Docker image - working-directory: server - run: docker build . --file Dockerfile --tag cyberverse-server:$(date +%s) From ba3bcede8c3bcef9708520ffcba5ce1d7890b5fc Mon Sep 17 00:00:00 2001 From: MeFisto94 Date: Sat, 23 Dec 2023 11:50:16 +0100 Subject: [PATCH 06/14] Supply vcpkg commit id --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6a29deb..22c31d4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -37,6 +37,7 @@ jobs: with: # The vcpkg.json file, which will be part of cache key computation. vcpkgJsonGlob: 'server/Native/vcpkg.json' + vcpkgGitCommitId: '16ee2ecb31788c336ace8bb14c21801efb6836e4' - name: Run CMake with vcpkg.json manifest uses: lukka/run-cmake@v10 with: From b2fe82914a9a811aec55c02117d3cde7db6e3194 Mon Sep 17 00:00:00 2001 From: MeFisto94 Date: Sat, 23 Dec 2023 12:27:40 +0100 Subject: [PATCH 07/14] CI: Convert to actually supplying CMakePresets --- .github/workflows/build.yml | 1 - server/Dockerfile | 1 + server/Native/CMakePresets.json | 37 +++++++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 server/Native/CMakePresets.json diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 22c31d4..1726e44 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -42,7 +42,6 @@ jobs: uses: lukka/run-cmake@v10 with: cmakeListsTxtPath: '${{ github.workspace }}/server/Native/CMakeLists.txt' - configurePreset: ninja-multi-vcpkg buildPreset: ninja-multi-vcpkg buildPresetAdditionalArgs: '[`--config Release`]' - name: List $RUNNER_WORKSPACE after build diff --git a/server/Dockerfile b/server/Dockerfile index 40a55c5..8b19bf9 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -7,6 +7,7 @@ ADD protocol /workspace/protocol # generate and build RUN vcpkg install --triplet=x64-linux RUN sed -i 's\../../shared/protocol\protocol\g' /workspace/CMakeLists.txt +# TODO: Use CMakePresets instead. RUN cmake -DCMAKE_TOOLCHAIN_FILE:STRING=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake \ -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug \ -H/workspace -B/workspace/build -G Ninja diff --git a/server/Native/CMakePresets.json b/server/Native/CMakePresets.json new file mode 100644 index 0000000..e291add --- /dev/null +++ b/server/Native/CMakePresets.json @@ -0,0 +1,37 @@ +{ + "version": 6, + "cmakeMinimumRequired": { + "major": 3, + "minor": 21, + "patch": 0 + }, + "configurePresets": [ + { + "name": "ninja-vcpkg", + "displayName": "Ninja Configure Settings", + "description": "Configure with vcpkg toolchain", + "binaryDir": "${sourceDir}/build/${presetName}", + "generator": "Ninja", + "cacheVariables": { + "CMAKE_TOOLCHAIN_FILE": { + "type": "FILEPATH", + "value": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" + } + } + } + ], + "buildPresets": [ + { + "name": "ninja-vcpkg", + "configurePreset": "ninja-vcpkg", + "displayName": "Build ninja-vcpkg", + "description": "Build ninja-vcpkg Configurations" + } + ], + "testPresets": [ + { + "name": "ninja-vcpkg", + "configurePreset": "ninja-vcpkg" + } + ] + } \ No newline at end of file From 018d1294904ab9b26ed1eb9da653df8aa8360b53 Mon Sep 17 00:00:00 2001 From: MeFisto94 Date: Sat, 23 Dec 2023 12:39:53 +0100 Subject: [PATCH 08/14] CI: actually use the right preset --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1726e44..cef1b4e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -42,7 +42,7 @@ jobs: uses: lukka/run-cmake@v10 with: cmakeListsTxtPath: '${{ github.workspace }}/server/Native/CMakeLists.txt' - buildPreset: ninja-multi-vcpkg + buildPreset: ninja-vcpkg buildPresetAdditionalArgs: '[`--config Release`]' - name: List $RUNNER_WORKSPACE after build run: find $RUNNER_WORKSPACE From 4a7aa6bf46a8336ab877a284f08476ae72d6a856 Mon Sep 17 00:00:00 2001 From: MeFisto94 Date: Sat, 23 Dec 2023 12:47:34 +0100 Subject: [PATCH 09/14] CI: Is CMake dumb? --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cef1b4e..8a7ee99 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -38,6 +38,8 @@ jobs: # The vcpkg.json file, which will be part of cache key computation. vcpkgJsonGlob: 'server/Native/vcpkg.json' vcpkgGitCommitId: '16ee2ecb31788c336ace8bb14c21801efb6836e4' + - name: Generate build output folder + run: mkdir '${{ github.workspace }}\server\Native\build\ninja-vcpkg' - name: Run CMake with vcpkg.json manifest uses: lukka/run-cmake@v10 with: From 46b58ffc5ff47746e63b17d3380fe18bbee70739 Mon Sep 17 00:00:00 2001 From: MeFisto94 Date: Sat, 23 Dec 2023 14:41:10 +0100 Subject: [PATCH 10/14] CI: Try to configure before building --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8a7ee99..387b957 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -44,6 +44,7 @@ jobs: uses: lukka/run-cmake@v10 with: cmakeListsTxtPath: '${{ github.workspace }}/server/Native/CMakeLists.txt' + configurationPreset: ninja-vcpkg buildPreset: ninja-vcpkg buildPresetAdditionalArgs: '[`--config Release`]' - name: List $RUNNER_WORKSPACE after build From 0d363686de3dc3342dad7da0010da37419dc7a8e Mon Sep 17 00:00:00 2001 From: MeFisto94 Date: Sat, 23 Dec 2023 14:44:08 +0100 Subject: [PATCH 11/14] CI: Fix argument --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 387b957..2ab1506 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -44,7 +44,7 @@ jobs: uses: lukka/run-cmake@v10 with: cmakeListsTxtPath: '${{ github.workspace }}/server/Native/CMakeLists.txt' - configurationPreset: ninja-vcpkg + configurePreset: ninja-vcpkg buildPreset: ninja-vcpkg buildPresetAdditionalArgs: '[`--config Release`]' - name: List $RUNNER_WORKSPACE after build From c7b111775bf70de3684099b4e352d4928f18bd84 Mon Sep 17 00:00:00 2001 From: MeFisto94 Date: Sat, 23 Dec 2023 15:07:38 +0100 Subject: [PATCH 12/14] CI: Actually build the client, not the server. --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2ab1506..43166cc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -36,14 +36,14 @@ jobs: id: runvcpkg with: # The vcpkg.json file, which will be part of cache key computation. - vcpkgJsonGlob: 'server/Native/vcpkg.json' + vcpkgJsonGlob: 'client/red4ext/vcpkg.json' vcpkgGitCommitId: '16ee2ecb31788c336ace8bb14c21801efb6836e4' - name: Generate build output folder - run: mkdir '${{ github.workspace }}\server\Native\build\ninja-vcpkg' + run: mkdir '${{ github.workspace }}\client\red4ext\build\ninja-vcpkg' - name: Run CMake with vcpkg.json manifest uses: lukka/run-cmake@v10 with: - cmakeListsTxtPath: '${{ github.workspace }}/server/Native/CMakeLists.txt' + cmakeListsTxtPath: '${{ github.workspace }}/client/red4ext/CMakeLists.txt' configurePreset: ninja-vcpkg buildPreset: ninja-vcpkg buildPresetAdditionalArgs: '[`--config Release`]' From ffe9ca993cd042d339aabc6f98bfe4073e0a8ff7 Mon Sep 17 00:00:00 2001 From: MeFisto94 Date: Sat, 23 Dec 2023 15:34:30 +0100 Subject: [PATCH 13/14] Move the CMakePresets into the client, too --- {server/Native => client/red4ext}/CMakePresets.json | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {server/Native => client/red4ext}/CMakePresets.json (100%) diff --git a/server/Native/CMakePresets.json b/client/red4ext/CMakePresets.json similarity index 100% rename from server/Native/CMakePresets.json rename to client/red4ext/CMakePresets.json From 84521abc76c5e4cb636c43efaef06ce2b1820c04 Mon Sep 17 00:00:00 2001 From: MeFisto94 Date: Sun, 24 Dec 2023 00:43:16 +0100 Subject: [PATCH 14/14] CI: Preserve the artifacts --- .github/workflows/build.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 43166cc..0febe9f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -50,4 +50,7 @@ jobs: - name: List $RUNNER_WORKSPACE after build run: find $RUNNER_WORKSPACE shell: bash - + - uses: actions/upload-artifact@v4 + with: + name: RED4ext Plugin + path: client/red4ext/build/ninja-vcpkg/src/*.dll