forked from cmangos/mangos-classic
-
Notifications
You must be signed in to change notification settings - Fork 23
141 lines (124 loc) · 4.79 KB
/
ubuntu.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
name: Ubuntu build
# use manual run
on: [workflow_dispatch]
# use schedule
#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_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:
- os: ubuntu-20.04
COMPILER_CC: gcc
COMPILER_PP: g++
USE_PCH: ON
EXTRA_BUILD: "-DBUILD_LOGIN_SERVER=OFF -DBUILD_IKE3_BOTS=ON -DBUILD_AHBOT=ON"
#- os: ubuntu-20.04
# COMPILER_CC: clang
# COMPILER_PP: clang++
# USE_PCH: ON
# EXTRA_BUILD: "-DBUILD_EXTRACTORS=ON -DBUILD_AHBOT=ON -DBUILD_PLAYERBOT=ON "
#- os: ubuntu-20.04
# COMPILER_CC: clang
# COMPILER_PP: clang++
# USE_PCH: OFF
# EXTRA_BUILD: ""
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ike3-bots
path: ${{env.REPO_DIR}}
- name: Checkout Bots
uses: actions/checkout@v2
with:
ref: master
repository: celguar/mangosbot-bots
path: "${{env.REPO_DIR}}/src/Modules/Bots"
- name: Create Build Environment
run: |
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 }}
- 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/[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: ${{env.COMPILER_CC}}
# OPTIONAL: Specify an architecture
arch: x86
- name: Configure
env:
USE_PCH: ${{ matrix.USE_PCH }}
EXTRA_BUILD: ${{ matrix.EXTRA_BUILD }}
BOOST_ROOT: "${{env.BOOST_INSTALL_DIR}}/boost/boost"
run: cmake -DBoost_ARCHITECTURE=-x64 -DPCH=${{env.USE_PCH}} ${{env.EXTRA_BUILD}}-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
permissions:
contents: none
needs: # make sure the notification is sent AFTER the jobs you want included have completed
- build
if: failure()
steps:
- name: Env
run: |
echo "GIT_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
echo "GIT_SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV
coreType="cmangos"
expension="classic"
coreBranch="ike3-bots"
echo "CORE_TYPE=${coreType}" >> $GITHUB_ENV
echo "EXPENSION_NAME=${expension}" >> $GITHUB_ENV
echo "CORE_BRANCH=${coreBranch}" >> $GITHUB_ENV
- name: Notify
uses: rjstone/[email protected]
with:
severity: error
username: ${{env.CORE_TYPE}}-${{env.EXPENSION_NAME}}
description: |
**Linux build failed!**
details: |
- **Core branch:** ${{env.CORE_BRANCH}} - ([Commits](${{github.server_url}}/${{ github.repository }}/commits/${{env.CORE_BRANCH}}))
- **Bots branch:** master - ([Commits](${{github.server_url}}/mangosbot-bots/commits/master))
- **Build log:** [actions/runs/${{github.run_id}}](${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}}
footer: Build fail
webhookUrl: ${{ secrets.DISCORD_WEBHOOK_BUILD }}
avatarUrl: https://github.githubassets.com/favicons/favicon-failure.png