From ddaa67bb26278ee0fa29e7419fb0ca5ac8e9ae03 Mon Sep 17 00:00:00 2001 From: Cyberium Date: Sat, 28 May 2022 18:14:47 +0200 Subject: [PATCH] Update and improve github action script - update boost to 1.79.0 - update to windows 2022 runner - update macos to 11 - force macos to use boost 1.79.0 --- .github/workflows/macos.yml | 42 ++++++++++++++-- .github/workflows/ubuntu.yml | 31 +++++++----- .github/workflows/windows-release.yml | 69 +++++++++++++++++++++++---- .github/workflows/windows.yml | 23 +++++---- 4 files changed, 131 insertions(+), 34 deletions(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 289c4d6f75..71acacfb77 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -7,10 +7,18 @@ env: BUILD_TYPE: Release REPO_DIR : ${{github.workspace}} BUILD_DIR: ${{github.workspace}}/bin/builddir + BOOST_PLATFORM_VERSION: "11" + BOOST_VERSION: "1.79.0" + BOOST_INSTALL_DIR: "${{github.workspace}}/bin" + +permissions: + contents: read jobs: build: - runs-on: macos-10.15 + runs-on: macos-11 + permissions: + contents: read steps: - name: Checkout @@ -20,12 +28,38 @@ jobs: - name: Install dependencies run: | - brew install boost mysql-client + brew install mysql-client brew install openssl echo "OPENSSL_ROOT_DIR=$(brew --prefix --installed openssl)" >> $GITHUB_ENV + mkdir -p ${{env.BOOST_INSTALL_DIR}} + + - name: Cache Windows boost + uses: actions/cache@v2 + id: cache-boost + with: + path: "${{env.BOOST_INSTALL_DIR}}/boost" + key: ${{ runner.os }}-${{ hashFiles('.github/workflows/macos.yml') }} + + - if: steps.cache-boost.outputs.cache-hit != 'true' + name: Install boost + uses: MarkusJx/install-boost@v2.3.0 + id: install-boost + with: + # REQUIRED: Specify the required boost version + # A list of supported versions can be found here: + # https://github.com/actions/boost-versions/blob/main/versions-manifest.json + boost_version: ${{env.BOOST_VERSION}} + # OPTIONAL: Specify a platform version + platform_version: ${{env.BOOST_PLATFORM_VERSION}} + # OPTIONAL: Specify a custom install location + boost_install_dir: ${{env.BOOST_INSTALL_DIR}} + # OPTIONAL: Specify a toolset + toolset: clang - name: Configure - run: cmake -DBoost_ARCHITECTURE=-x64 -B ${{env.BUILD_DIR}} -S ${{env.REPO_DIR}} + env: + BOOST_ROOT: "${{env.BOOST_INSTALL_DIR}}/boost/boost" + run: cmake -B ${{env.BUILD_DIR}} -S ${{env.REPO_DIR}} -DBoost_ARCHITECTURE=-x64 - name: Build env: @@ -33,6 +67,8 @@ jobs: run: cmake --build ${{env.BUILD_DIR}} --config ${{env.BUILD_TYPE}} notify: + permissions: + contents: none name: Discord Notification runs-on: ubuntu-20.04 needs: # make sure the notification is sent AFTER the jobs you want included have completed diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 77035f5296..53508ebc95 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -7,13 +7,16 @@ env: BUILD_TYPE: Release REPO_DIR : ${{github.workspace}} BUILD_DIR: ${{github.workspace}}/bin/builddir - BOOST_PLATFORM_VERSION: "18.04" - BOOST_VERSION: "1.73.0" + BOOST_PLATFORM_VERSION: "20.04" + BOOST_VERSION: "1.79.0" BOOST_INSTALL_DIR: "${{github.workspace}}/bin" jobs: build: runs-on: ${{ matrix.os }} + permissions: + contents: read + strategy: matrix: include: @@ -40,14 +43,12 @@ jobs: - name: Create Build Environment run: | - echo "BOOST_ROOT=${{env.BOOST_INSTALL_DIR}}/boost/boost-${{env.BOOST_VERSION}}-linux-${{env.BOOST_PLATFORM_VERSION}}-gcc-x64" >> $GITHUB_ENV echo "GITHUB_SHORT_REV=$(git rev-parse --short HEAD)" >> $GITHUB_ENV echo "ARCHIVE_FILENAME=${{ github.event.repository.name }}-$(git rev-parse --short HEAD).zip" >> $GITHUB_ENV echo "CC=${{matrix.COMPILER_CC}}" >> $GITHUB_ENV echo "CXX=${{matrix.COMPILER_PP}}" >> $GITHUB_ENV - cmake -E make_directory ${{ env.BUILD_DIR }} - - # install dependencies + cmake -E make_directory ${{ env.BUILD_DIR }} + - name: Cache Windows boost uses: actions/cache@v2 id: cache-boost @@ -57,23 +58,26 @@ jobs: - if: steps.cache-boost.outputs.cache-hit != 'true' name: Install boost - uses: MarkusJx/install-boost@v1.0.1 + uses: MarkusJx/install-boost@v2.3.0 id: install-boost with: # REQUIRED: Specify the required boost version - # A list of supported versions can be found here: + # A list of supported versions can be found here: # https://github.com/actions/boost-versions/blob/main/versions-manifest.json boost_version: ${{env.BOOST_VERSION}} - # OPTIONAL: Specify a platform version on ubuntu + # OPTIONAL: Specify a platform version platform_version: ${{env.BOOST_PLATFORM_VERSION}} - # OPTIONAL: Specify a custon install location + # OPTIONAL: Specify a custom install location boost_install_dir: ${{env.BOOST_INSTALL_DIR}} - # NOTE: If a boost version matching all requirements cannot be found, - # this build step will fail + # OPTIONAL: Specify a toolset + toolset: ${{env.COMPILER_CC}} + # OPTIONAL: Specify an architecture + arch: x86 - name: Configure env: USE_PCH: ${{ matrix.USE_PCH }} + BOOST_ROOT: "${{env.BOOST_INSTALL_DIR}}/boost/boost" run: cmake -DBoost_ARCHITECTURE=-x64 -DPCH=$USE_PCH -B ${{env.BUILD_DIR}} -S ${{env.REPO_DIR}} - name: Build @@ -84,6 +88,8 @@ jobs: notify: name: Discord Notification runs-on: ubuntu-20.04 + permissions: + contents: none needs: # make sure the notification is sent AFTER the jobs you want included have completed - build if: failure() @@ -110,4 +116,3 @@ jobs: footer: Next time ${{github.event.pusher.name}}! webhookUrl: ${{ secrets.DISCORD_WEBHOOK }} avatarUrl: https://github.githubassets.com/images/modules/logos_page/Octocat.png - diff --git a/.github/workflows/windows-release.yml b/.github/workflows/windows-release.yml index 416c015d5b..c9a496ad2e 100644 --- a/.github/workflows/windows-release.yml +++ b/.github/workflows/windows-release.yml @@ -10,14 +10,16 @@ env: BUILD_TYPE: Release REPO_DIR : ${{github.workspace}} BUILD_DIR: ${{github.workspace}}/bin/builddir - BOOST_TOOLSET: "msvc14.2" - BOOST_VERSION: "1.73.0" + BOOST_TOOLSET: "msvc" + BOOST_VERSION: "1.79.0.beta1" BOOST_INSTALL_DIR: "${{github.workspace}}/bin" jobs: build: + runs-on: windows-2022 + permissions: + contents: read - runs-on: windows-2019 strategy: matrix: include: @@ -45,7 +47,6 @@ jobs: - uses: FranzDiebold/github-env-vars-action@v2 - name: Create Build Environment run: | - echo "BOOST_ROOT=${{env.BOOST_INSTALL_DIR}}/boost/boost-${{env.BOOST_VERSION}}-win32-${{env.BOOST_TOOLSET}}-x86_64" >> $env:GITHUB_ENV echo "ARCHIVE_FILENAME=$env:CI_REPOSITORY_NAME-${{matrix.TYPE}}-$env:CI_SHA_SHORT.zip" >> $env:GITHUB_ENV cmake -E make_directory ${{ env.BUILD_DIR }} @@ -55,25 +56,28 @@ jobs: id: cache-boost with: path: "${{env.BOOST_INSTALL_DIR}}/boost" - key: ${{ runner.os }}-${{ hashFiles('.github/workflows/windows.yml') }} + key: ${{ runner.os }}-${{ hashFiles('.github/workflows/windows-release.yml') }} - if: steps.cache-boost.outputs.cache-hit != 'true' name: Install boost - uses: MarkusJx/install-boost@v1.0.1 + uses: MarkusJx/install-boost@v2.3.0 id: install-boost with: # REQUIRED: Specify the required boost version - # A list of supported versions can be found here: + # A list of supported versions can be found here: # https://github.com/actions/boost-versions/blob/main/versions-manifest.json boost_version: ${{env.BOOST_VERSION}} # OPTIONAL: Specify a toolset on windows toolset: ${{env.BOOST_TOOLSET}} # OPTIONAL: Specify a custon install location boost_install_dir: ${{env.BOOST_INSTALL_DIR}} + platform_version: 2022 # NOTE: If a boost version matching all requirements cannot be found, # this build step will fail - name: Configure + env: + BOOST_ROOT: "${{env.BOOST_INSTALL_DIR}}/boost/boost" run: cmake ${{matrix.OPTIONAL_DEFINES}} -B ${{env.BUILD_DIR}} -S ${{env.REPO_DIR}} - name: Build @@ -92,8 +96,11 @@ jobs: path: "bin/${{env.ARCHIVE_FILENAME}}" upload: - runs-on: windows-2019 + runs-on: windows-2022 + permissions: + contents: write # for marvinpinto/action-automatic-releases to generate pre-release needs: build + steps: - name: Download artifact snapshot-default uses: actions/download-artifact@v1 @@ -134,9 +141,53 @@ jobs: title: "Development Build(${{ steps.date.outputs.date }})" files: all_snapshots + notify-success: + name: Discord release successfully notification + runs-on: ubuntu-20.04 + permissions: + contents: none + needs: + - upload + + steps: + - name: Set environmental variables + run: | + echo "GIT_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV + shortSHA=`echo ${GITHUB_SHA} | cut -c1-8` + echo "GIT_SHORT_SHA=${shortSHA}" >> $GITHUB_ENV + projectNames="${GITHUB_REPOSITORY#*/}" + expension="${projectNames#*-}" + echo "EXPENSION_NAME=${expension}" >> $GITHUB_ENV + echo "DEFAULT_ARCH_NAME=${projectNames}-default-${shortSHA}.zip" >> $GITHUB_ENV + echo "ALL_ARCH_NAME=${projectNames}-with-all-${shortSHA}.zip" >> $GITHUB_ENV + echo "AB_ARCH_NAME=${projectNames}-with-ahbot-${shortSHA}.zip" >> $GITHUB_ENV + echo "PB_ARCH_NAME=${projectNames}-with-playerbot-${shortSHA}.zip" >> $GITHUB_ENV + echo "PB_AB_ARCH_NAME=${projectNames}-with-playerbot-ahbot-${shortSHA}.zip" >> $GITHUB_ENV + + - name: Notify + uses: rjstone/discord-webhook-notify@v1.0.4 + with: + severity: info + username: ${{env.EXPENSION_NAME}}-core + description: | + **${{env.EXPENSION_NAME}} prebuilt have just been released** + details: | + **Branch:** ${{env.GIT_BRANCH}} + __**Winodws prebuild Binaries**__ + - [Default download](${{github.server_url}}/${{ github.repository }}/releases/download/latest/${{env.DEFAULT_ARCH_NAME}}) + - [All options on](${{github.server_url}}/${{ github.repository }}/releases/download/latest/${{env.ALL_ARCH_NAME}}) + - [AhBot enabled](${{github.server_url}}/${{ github.repository }}/releases/download/latest/${{env.AB_ARCH_NAME}}) + - [PlayerBot enabled](${{github.server_url}}/${{ github.repository }}/releases/download/latest/${{env.PB_ARCH_NAME}}) + - [AhBot and PlayerBot enabled](${{github.server_url}}/${{ github.repository }}/releases/download/latest/${{env.PB_AB_ARCH_NAME}}) + footer: By CMaNGOS team! + webhookUrl: ${{ secrets.DISCORD_WEBHOOK_RELEASE }} + avatarUrl: https://github.githubassets.com/images/modules/logos_page/Octocat.png + notify: name: Discord Notification runs-on: ubuntu-20.04 + permissions: + contents: none needs: # make sure the notification is sent AFTER the jobs you want included have completed - build if: failure() @@ -151,7 +202,7 @@ jobs: uses: rjstone/discord-webhook-notify@v1.0.4 with: severity: error - username: ${{ github.event.repository.name }} + username: ${{env.EXPENSION_NAME}}-core description: | **Windows buid failed** details: | diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index bd90be854a..4dd1ae3cad 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -1,4 +1,4 @@ - + name: Windows build on: [push] @@ -8,15 +8,16 @@ env: BUILD_TYPE: Release REPO_DIR : ${{github.workspace}} BUILD_DIR: ${{github.workspace}}/bin/builddir - BOOST_TOOLSET: "msvc14.2" - BOOST_VERSION: "1.73.0" + BOOST_TOOLSET: "msvc" + BOOST_VERSION: "1.79.0" BOOST_INSTALL_DIR: "${{github.workspace}}/bin" jobs: build: - - runs-on: windows-2019 - + runs-on: windows-2022 + permissions: + contents: read + steps: - name: Checkout uses: actions/checkout@v2 @@ -25,7 +26,6 @@ jobs: - name: Create Build Environment run: | - echo "BOOST_ROOT=${{env.BOOST_INSTALL_DIR}}/boost/boost-${{env.BOOST_VERSION}}-win32-${{env.BOOST_TOOLSET}}-x86_64" >> $env:GITHUB_ENV echo "GITHUB_SHORT_REV=$(git rev-parse --short HEAD)" >> $env:GITHUB_ENV echo "ARCHIVE_FILENAME=${{ github.event.repository.name }}-$(git rev-parse --short HEAD).zip" >> $env:GITHUB_ENV cmake -E make_directory ${{ env.BUILD_DIR }} @@ -40,21 +40,24 @@ jobs: - if: steps.cache-boost.outputs.cache-hit != 'true' name: Install boost - uses: MarkusJx/install-boost@v1.0.1 + uses: MarkusJx/install-boost@v2.3.0 id: install-boost with: # REQUIRED: Specify the required boost version - # A list of supported versions can be found here: + # A list of supported versions can be found here: # https://github.com/actions/boost-versions/blob/main/versions-manifest.json boost_version: ${{env.BOOST_VERSION}} # OPTIONAL: Specify a toolset on windows toolset: ${{env.BOOST_TOOLSET}} # OPTIONAL: Specify a custon install location boost_install_dir: ${{env.BOOST_INSTALL_DIR}} + platform_version: 2022 # NOTE: If a boost version matching all requirements cannot be found, # this build step will fail - name: Configure + env: + BOOST_ROOT: "${{env.BOOST_INSTALL_DIR}}/boost/boost" run: cmake -B ${{env.BUILD_DIR}} -S ${{env.REPO_DIR}} - name: Build @@ -76,6 +79,8 @@ jobs: notify: name: Discord Notification runs-on: ubuntu-20.04 + permissions: + contents: none needs: # make sure the notification is sent AFTER the jobs you want included have completed - build if: failure()