Skip to content

Commit

Permalink
Switch to github action
Browse files Browse the repository at this point in the history
Use github ci as main ci

build seem a bit faster here and its easier to handle

add scheduled release at 6am for windows version

add failed build notification
  • Loading branch information
cyberium committed Mar 25, 2021
1 parent 2caf7f4 commit 7648ae8
Show file tree
Hide file tree
Showing 7 changed files with 388 additions and 221 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: MacOs build

on: [push]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
REPO_DIR : ${{github.workspace}}
BUILD_DIR: ${{github.workspace}}/bin/builddir

jobs:
build:
runs-on: macos-10.15

steps:
- name: Checkout
uses: actions/checkout@v2
with:
path: ${{env.REPO_DIR}}

- name: Install dependencies
run: |
brew install boost mysql-client
echo "OPENSSL_ROOT_DIR=$(brew --prefix openssl)" >> $GITHUB_ENV
- name: Configure
run: cmake -DBoost_ARCHITECTURE=-x64 -B ${{env.BUILD_DIR}} -S ${{env.REPO_DIR}}

- name: Build
env:
MAKEFLAGS: "-j8"
run: cmake --build ${{env.BUILD_DIR}} --config ${{env.BUILD_TYPE}}

notify:
name: Discord Notification
runs-on: ubuntu-latest
needs: # make sure the notification is sent AFTER the jobs you want included have completed
- build
if: failure()

steps:
- name: Notify
uses: rjstone/discord-webhook-notify@v1.0.4
with:
severity: error
description: MacOS build failed
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}
avatarUrl: https://github.githubassets.com/images/modules/logos_page/Octocat.png



89 changes: 89 additions & 0 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Ubuntu build

on: [push]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
REPO_DIR : ${{github.workspace}}
BUILD_DIR: ${{github.workspace}}/bin/builddir
BOOST_PLATFORM_VERSION: "18.04"
BOOST_VERSION: "1.73.0"
BOOST_INSTALL_DIR: "${{github.workspace}}/bin"

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-20.04
COMPILER_CC: gcc
COMPILER_PP: g++

- os: ubuntu-20.04
COMPILER_CC: clang
COMPILER_PP: clang++

steps:
- name: Checkout
uses: actions/checkout@v2
with:
path: ${{env.REPO_DIR}}

- 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
- name: Cache Windows boost
uses: actions/cache@v2
id: cache-boost
with:
path: "${{env.BOOST_INSTALL_DIR}}/boost"
key: ${{ runner.os }}-${{ hashFiles('.github/workflows/ubuntu.yml') }}

- if: steps.cache-boost.outputs.cache-hit != 'true'
name: Install boost
uses: MarkusJx/install-boost@v1.0.1
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 on ubuntu
platform_version: ${{env.BOOST_PLATFORM_VERSION}}
# OPTIONAL: Specify a custon 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

- name: Configure
run: cmake -DBoost_ARCHITECTURE=-x64 -B ${{env.BUILD_DIR}} -S ${{env.REPO_DIR}}

- name: Build
env:
MAKEFLAGS: "-j8"
run: cmake --build ${{env.BUILD_DIR}} --config ${{env.BUILD_TYPE}}

notify:
name: Discord Notification
runs-on: ubuntu-20.04
needs: # make sure the notification is sent AFTER the jobs you want included have completed
- build
if: failure()

steps:
- name: Notify
uses: rjstone/discord-webhook-notify@v1.0.4
with:
severity: error
description: Linux build failed
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}
avatarUrl: https://github.githubassets.com/images/modules/logos_page/Octocat.png
154 changes: 154 additions & 0 deletions .github/workflows/windows-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
name: Windows release build

on:
schedule:
# every day at 6am
- cron: '0 6 * * *'

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
REPO_DIR : ${{github.workspace}}
BUILD_DIR: ${{github.workspace}}/bin/builddir
BOOST_TOOLSET: "msvc14.2"
BOOST_VERSION: "1.73.0"
BOOST_INSTALL_DIR: "${{github.workspace}}/bin"

jobs:
build:

runs-on: windows-2019
strategy:
matrix:
include:
- OPTIONAL_DEFINES: ""
TYPE: "default"

- OPTIONAL_DEFINES: "-DBUILD_EXTRACTORS=ON -DBUILD_PLAYERBOT=ON -DBUILD_AHBOT=ON -DBUILD_RECASTDEMOMOD=ON -DBUILD_GIT_ID=ON"
TYPE: "with-all"

- OPTIONAL_DEFINES: "-DBUILD_PLAYERBOT=ON -DBUILD_AHBOT=ON"
TYPE: "with-playerbot-ahbot"

- OPTIONAL_DEFINES: "-DBUILD_PLAYERBOT=ON"
TYPE: "with-playerbot"

- OPTIONAL_DEFINES: "-DBUILD_AHBOT=ON"
TYPE: "with-ahbot"

steps:
- name: Checkout
uses: actions/checkout@v2
with:
path: ${{env.REPO_DIR}}

- 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 }}
# install dependencies
- name: Cache Windows boost
uses: actions/cache@v2
id: cache-boost
with:
path: "${{env.BOOST_INSTALL_DIR}}/boost"
key: ${{ runner.os }}-${{ hashFiles('.github/workflows/windows.yml') }}

- if: steps.cache-boost.outputs.cache-hit != 'true'
name: Install boost
uses: MarkusJx/install-boost@v1.0.1
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 toolset on windows
toolset: ${{env.BOOST_TOOLSET}}
# OPTIONAL: Specify a custon 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

- name: Configure
run: cmake ${{matrix.OPTIONAL_DEFINES}} -B ${{env.BUILD_DIR}} -S ${{env.REPO_DIR}}

- name: Build
env:
MAKEFLAGS: "-j8"
run: cmake --build ${{env.BUILD_DIR}} --config ${{env.BUILD_TYPE}}

- name: Archive files
run: |
cd bin
7z a -tzip ${{env.ARCHIVE_FILENAME}} x64_Release
- name: Archive this artefact
uses: actions/upload-artifact@v2
with:
name: snapshot-${{matrix.TYPE}}
path: "bin/${{env.ARCHIVE_FILENAME}}"

upload:
runs-on: windows-2019
needs: build
steps:
- name: Download artifact snapshot-default
uses: actions/download-artifact@v1
with:
name: snapshot-default
path: all_snapshots
- name: Download artifact snapshot-with-all
uses: actions/download-artifact@v1
with:
name: snapshot-with-all
path: all_snapshots
- name: Download artifact snapshot-with-playerbot-ahbot
uses: actions/download-artifact@v1
with:
name: snapshot-with-playerbot-ahbot
path: all_snapshots
- name: Download artifact snapshot-with-playerbot
uses: actions/download-artifact@v1
with:
name: snapshot-with-playerbot
path: all_snapshots
- name: Download artifact snapshot-with-ahbot
uses: actions/download-artifact@v1
with:
name: snapshot-with-ahbot
path: all_snapshots

- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"

- name: Upload snapshot
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: true
title: "Development Build(${{ steps.date.outputs.date }})"
files: all_snapshots

notify:
name: Discord Notification
runs-on: ubuntu-20.04
needs: # make sure the notification is sent AFTER the jobs you want included have completed
- build
if: failure()

steps:
- name: Notify
uses: rjstone/discord-webhook-notify@v1.0.4
with:
severity: error
description: Scheduled release build failed
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}
avatarUrl: https://github.githubassets.com/images/modules/logos_page/Octocat.png



93 changes: 93 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@

name: Windows build

on: [push]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release
REPO_DIR : ${{github.workspace}}
BUILD_DIR: ${{github.workspace}}/bin/builddir
BOOST_TOOLSET: "msvc14.2"
BOOST_VERSION: "1.73.0"
BOOST_INSTALL_DIR: "${{github.workspace}}/bin"

jobs:
build:

runs-on: windows-2019

steps:
- name: Checkout
uses: actions/checkout@v2
with:
path: ${{env.REPO_DIR}}

- 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 }}
# install dependencies
- name: Cache Windows boost
uses: actions/cache@v2
id: cache-boost
with:
path: "${{env.BOOST_INSTALL_DIR}}/boost"
key: ${{ runner.os }}-${{ hashFiles('.github/workflows/windows.yml') }}

- if: steps.cache-boost.outputs.cache-hit != 'true'
name: Install boost
uses: MarkusJx/install-boost@v1.0.1
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 toolset on windows
toolset: ${{env.BOOST_TOOLSET}}
# OPTIONAL: Specify a custon 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

- name: Configure
run: cmake -B ${{env.BUILD_DIR}} -S ${{env.REPO_DIR}}

- name: Build
env:
MAKEFLAGS: "-j8"
run: cmake --build ${{env.BUILD_DIR}} --config ${{env.BUILD_TYPE}}

- name: Archive files
run: |
cd bin
7z a -tzip ${{env.ARCHIVE_FILENAME}} x64_Release
- name: Archive this artefact
uses: actions/upload-artifact@v2
with:
name: snapshot
path: "bin/${{env.ARCHIVE_FILENAME}}"

notify:
name: Discord Notification
runs-on: ubuntu-latest
needs: # make sure the notification is sent AFTER the jobs you want included have completed
- build
if: failure()

steps:
- name: Notify
uses: rjstone/discord-webhook-notify@v1.0.4
with:
severity: error
description: Windows build failed
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}
avatarUrl: https://github.githubassets.com/images/modules/logos_page/Octocat.png



Loading

0 comments on commit 7648ae8

Please sign in to comment.