Skip to content

Commit

Permalink
Update and improve github action script
Browse files Browse the repository at this point in the history
- update boost to 1.79.0
- update to windows 2022 runner
- update macos to 11
- force macos to use boost 1.79.0
  • Loading branch information
cyberium committed May 28, 2022
1 parent 0d6d349 commit ddaa67b
Show file tree
Hide file tree
Showing 4 changed files with 131 additions and 34 deletions.
42 changes: 39 additions & 3 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -20,19 +28,47 @@ 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/[email protected]
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:
MAKEFLAGS: "-j8"
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
Expand Down
31 changes: 18 additions & 13 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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()
Expand All @@ -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

69 changes: 60 additions & 9 deletions .github/workflows/windows-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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 }}
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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/[email protected]
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()
Expand All @@ -151,7 +202,7 @@ jobs:
uses: rjstone/[email protected]
with:
severity: error
username: ${{ github.event.repository.name }}
username: ${{env.EXPENSION_NAME}}-core
description: |
**Windows buid failed**
details: |
Expand Down
23 changes: 14 additions & 9 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

name: Windows build

on: [push]
Expand All @@ -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
Expand All @@ -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 }}
Expand All @@ -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
Expand All @@ -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()
Expand Down

0 comments on commit ddaa67b

Please sign in to comment.