From 161f8127fa3363a810816d3379e7da5df5282733 Mon Sep 17 00:00:00 2001 From: Lion Kortlepel Date: Tue, 5 Dec 2023 13:18:43 +0100 Subject: [PATCH] simplify build steps --- .../{build-linux.yml => build-debian-11.yml} | 20 ++- .github/workflows/cmake-windows.yml | 58 --------- .github/workflows/release-build.yml | 114 ------------------ scripts/debian/2-configure.sh | 2 +- 4 files changed, 8 insertions(+), 186 deletions(-) rename .github/workflows/{build-linux.yml => build-debian-11.yml} (70%) delete mode 100644 .github/workflows/cmake-windows.yml delete mode 100644 .github/workflows/release-build.yml diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-debian-11.yml similarity index 70% rename from .github/workflows/build-linux.yml rename to .github/workflows/build-debian-11.yml index 0ea7d3a..50fb4e1 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-debian-11.yml @@ -1,44 +1,38 @@ -name: CMake Linux Build +name: Debian 11 Build on: [push] jobs: - linux-build: - runs-on: ubuntu-22.04 - + debian-11-build: + runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 with: submodules: "recursive" - name: Install Dependencies - run: | - sudo bash ./scripts/debian/1-install-deps.sh - cmake -E make_directory ${{github.workspace}}/build-linux + run: sudo bash ./scripts/debian/1-install-deps.sh - name: Create Build Environment - working-directory: ${{github.workspace}}/build-linux - run: bash ${{github.workspace}}/scripts/debian/2-configure.sh .. + run: bash ${{github.workspace}}/scripts/debian/2-configure.sh - name: Build Server - working-directory: ${{github.workspace}}/build-linux run: bash ${{github.workspace}}/scripts/debian/3-build.sh - name: Build Tests - working-directory: ${{github.workspace}}/build-linux run: bash ${{github.workspace}}/scripts/debian/3-build-tests.sh - name: Archive server artifact uses: actions/upload-artifact@v2 with: name: BeamMP-Server-linux - path: ${{github.workspace}}/build-linux/BeamMP-Server + path: ${{github.workspace}}/bin/BeamMP-Server - name: Archive test artifact uses: actions/upload-artifact@v2 with: name: BeamMP-Server-linux-tests - path: ${{github.workspace}}/build-linux/BeamMP-Server-tests + path: ${{github.workspace}}/bin/BeamMP-Server-tests run-tests: needs: linux-build diff --git a/.github/workflows/cmake-windows.yml b/.github/workflows/cmake-windows.yml deleted file mode 100644 index dff3b25..0000000 --- a/.github/workflows/cmake-windows.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: CMake Windows Build - -on: [push] - -env: - BUILD_TYPE: Release - -jobs: - windows-build: - runs-on: windows-latest - - steps: - - uses: actions/checkout@v2 - with: - submodules: 'recursive' - - - name: Restore artifacts, or run vcpkg, build and cache artifacts - uses: lukka/run-vcpkg@v7 - id: runvcpkg - with: - vcpkgArguments: 'lua zlib rapidjson openssl websocketpp curl' - vcpkgDirectory: '${{ runner.workspace }}/b/vcpkg' - vcpkgGitCommitId: "16ee2ecb31788c336ace8bb14c21801efb6836e4" - vcpkgTriplet: 'x64-windows-static' - - - name: Create Build Environment - run: cmake -E make_directory ${{github.workspace}}/build-windows - - - name: Configure CMake - shell: bash - working-directory: ${{github.workspace}}/build-windows - env: - beammp_sentry_url: ${{ secrets.BEAMMP_SECRET_SENTRY_URL }} - run: cmake $GITHUB_WORKSPACE -DSENTRY_BACKEND=breakpad -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_TOOLCHAIN_FILE='${{ runner.workspace }}/b/vcpkg/scripts/buildsystems/vcpkg.cmake' -DVCPKG_TARGET_TRIPLET=x64-windows-static -DBEAMMP_SECRET_SENTRY_URL="$beammp_sentry_url" - - - name: Build - working-directory: ${{github.workspace}}/build-windows - shell: bash - run: cmake --build . --config $BUILD_TYPE - - - name: Archive artifacts - uses: actions/upload-artifact@v2 - with: - name: BeamMP-Server.exe - path: ${{github.workspace}}/build-windows/Release/BeamMP-Server.exe - - - name: Build debug - working-directory: ${{github.workspace}}/build-windows - shell: bash - run: | - cmake --build . --config Debug - - - name: Archive debug artifacts - uses: actions/upload-artifact@v2 - with: - name: BeamMP-Server-debug.exe - path: ${{github.workspace}}/build-windows/Debug/BeamMP-Server.exe - diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml deleted file mode 100644 index d30fad2..0000000 --- a/.github/workflows/release-build.yml +++ /dev/null @@ -1,114 +0,0 @@ -name: Release Create & Build -on: - push: - # Sequence of patterns matched against refs/tags - tags: - - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 - -env: - BUILD_TYPE: Release - -jobs: - create-release: - runs-on: ubuntu-latest - name: Create Release - outputs: - upload_url: ${{ steps.create_release.outputs.upload_url }} - steps: - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }} - release_name: ${{ github.ref }} - draft: false - prerelease: true - body: | - Files included in this release: - - `BeamMP-Server.exe` is the windows build - - `BeamMP-Server-linux` is a ubuntu build. You will need to install `liblua5.3-0`. - - upload-release-files-linux: - name: Upload Linux Release Files - runs-on: ubuntu-22.04 - needs: create-release - steps: - - uses: actions/checkout@v2 - with: - submodules: "recursive" - - - name: Install Dependencies - run: | - sudo bash ./scripts/debian/1-install-deps.sh - cmake -E make_directory ${{github.workspace}}/build-linux - - - name: Create Build Environment - working-directory: ${{github.workspace}}/build-linux - run: bash ${{github.workspace}}/scripts/debian/2-configure.sh - - - name: Build Server - working-directory: ${{github.workspace}}/build-linux - run: bash ${{github.workspace}}/scripts/debian/3-build.sh - - - name: Archive server artifact - uses: actions/upload-artifact@v2 - with: - name: BeamMP-Server-linux - path: ${{github.workspace}}/build-linux/BeamMP-Server - - - name: Upload Release Asset - id: upload-release-asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ needs.create-release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps - asset_path: ${{github.workspace}}/build-linux/BeamMP-Server - asset_name: BeamMP-Server-linux - asset_content_type: application/x-elf - - upload-release-files-windows: - name: Upload Windows Release Files - runs-on: windows-latest - needs: create-release - steps: - - uses: actions/checkout@v2 - with: - submodules: 'recursive' - - - name: Restore artifacts, or run vcpkg, build and cache artifacts - uses: lukka/run-vcpkg@v7 - id: runvcpkg - with: - vcpkgArguments: 'lua zlib rapidjson openssl websocketpp curl' - vcpkgDirectory: '${{ runner.workspace }}/b/vcpkg' - vcpkgGitCommitId: '16ee2ecb31788c336ace8bb14c21801efb6836e4' - vcpkgTriplet: 'x64-windows-static' - - - name: Create Build Environment - run: cmake -E make_directory ${{github.workspace}}/build-windows - - - name: Configure CMake - shell: bash - working-directory: ${{github.workspace}}/build-windows - env: - beammp_sentry_url: ${{ secrets.BEAMMP_SECRET_SENTRY_URL }} - run: cmake $GITHUB_WORKSPACE -DSENTRY_BACKEND=breakpad -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_TOOLCHAIN_FILE='${{ runner.workspace }}/b/vcpkg/scripts/buildsystems/vcpkg.cmake' -DVCPKG_TARGET_TRIPLET=x64-windows-static -DBEAMMP_SECRET_SENTRY_URL="$beammp_sentry_url" - - - name: Build - working-directory: ${{github.workspace}}/build-windows - shell: bash - run: cmake --build . --config $BUILD_TYPE - - - name: Upload Release Asset - id: upload-release-asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ needs.create-release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps - asset_path: ${{github.workspace}}/build-windows/Release/BeamMP-Server.exe - asset_name: BeamMP-Server.exe - asset_content_type: application/vnd.microsoft.portable-executable diff --git a/scripts/debian/2-configure.sh b/scripts/debian/2-configure.sh index 7005284..bce5e9e 100755 --- a/scripts/debian/2-configure.sh +++ b/scripts/debian/2-configure.sh @@ -2,4 +2,4 @@ set -ex -cmake ${1-:.} -B bin -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-O3 -s -Wl,-z,norelro -Wl,--hash-style=gnu -Wl,--build-id=none -Wl,-z,noseparate-code -ffunction-sections -fdata-sections -Wl,--gc-sections" -DBeamMP-Server_ENABLE_LTO=ON || cat "$SOURCE"/server/bin/vcpkg-bootstrap.log +cmake ${1:-.} -B bin -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-O3 -s -Wl,-z,norelro -Wl,--hash-style=gnu -Wl,--build-id=none -Wl,-z,noseparate-code -ffunction-sections -fdata-sections -Wl,--gc-sections" -DBeamMP-Server_ENABLE_LTO=ON || cat "$SOURCE"/server/bin/vcpkg-bootstrap.log