Skip to content

Commit b838abd

Browse files
authored
Migrate the CI/CD to GitHub Actions (rehlds#57)
* Implemented CI/CD migration to GitHub * Remove gradle build
1 parent 80145ab commit b838abd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+924
-1333
lines changed

.editorconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ root = true
88
[*]
99
indent_style = tab
1010
indent_size = 4
11+
trim_trailing_whitespace = true
1112
insert_final_newline = true

.github/workflows/build.yml

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
name: C/C++ CI
2+
3+
on:
4+
push:
5+
branches: [master]
6+
paths-ignore:
7+
- '**.md'
8+
9+
pull_request:
10+
types: [opened, reopened, synchronize]
11+
release:
12+
types: [published]
13+
14+
jobs:
15+
windows:
16+
name: 'Windows'
17+
runs-on: windows-2019
18+
19+
env:
20+
solution: 'msvc/metamod.sln'
21+
buildPlatform: 'Win32'
22+
buildRelease: 'Release'
23+
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v2
27+
with:
28+
fetch-depth: 0
29+
30+
- name: Setup MSBuild
31+
uses: microsoft/[email protected]
32+
33+
- name: Build
34+
run: |
35+
msbuild ${{ env.solution }} -p:Configuration="${{ env.buildRelease }}" /t:Clean,Build /p:Platform=${{ env.buildPlatform }} /p:PlatformToolset=v142
36+
37+
- name: Move files
38+
run: |
39+
mkdir publish\debug
40+
mkdir publish\addons\metamod
41+
42+
move msvc\${{ env.buildRelease }}\metamod.dll publish\addons\metamod\metamod.dll
43+
move msvc\${{ env.buildRelease }}\metamod.pdb publish\debug\metamod.pdb
44+
45+
- name: Deploy artifacts
46+
uses: actions/upload-artifact@v2
47+
with:
48+
name: win32
49+
path: publish/*
50+
51+
linux:
52+
name: 'Linux'
53+
runs-on: ubuntu-latest
54+
container: s1lentq/linux86buildtools:latest
55+
56+
steps:
57+
- name: Checkout
58+
uses: actions/checkout@v2
59+
with:
60+
fetch-depth: 0
61+
62+
- name: Build using Intel C++ Compiler 19.0
63+
run: |
64+
rm -rf build && CC=icc CXX=icpc cmake -DCMAKE_BUILD_TYPE=COMPAT_GLIBC -B build && cmake --build build -j8
65+
66+
- name: Prepare SDK
67+
run: |
68+
mkdir -p publish/sdk
69+
mkdir -p publish/addons/metamod
70+
rsync -a \
71+
--include=dllapi.h \
72+
--include=engine_api.h \
73+
--include=enginecallbacks.h \
74+
--include=h_export.h \
75+
--include=meta_api.h \
76+
--include=mutil.h \
77+
--include=plinfo.h \
78+
--exclude='*' metamod/src/ publish/sdk
79+
rsync metamod/extra/config.ini publish/addons/metamod
80+
rsync -a metamod/extra/example/ publish/example_plugin
81+
rsync -a publish/sdk/ publish/example_plugin/include/metamod
82+
83+
- name: Move files
84+
run: |
85+
mv build/metamod/metamod_i386.so publish/addons/metamod/metamod_i386.so
86+
mv metamod/version/appversion.h publish/appversion.h
87+
88+
- name: Run GLIBC/ABI version compat test
89+
run: |
90+
binaries=(
91+
"publish/addons/metamod/metamod_i386.so"
92+
)
93+
bash ./metamod/version/glibc_test.sh ${binaries[@]}
94+
if [[ $? -ne 0 ]]; then
95+
exit 1 # Assertion failed
96+
fi
97+
shell: bash
98+
99+
- name: Deploy artifacts
100+
uses: actions/upload-artifact@v2
101+
id: upload-job
102+
with:
103+
name: linux32
104+
path: publish/*
105+
106+
- name: Cleanup temporary artifacts
107+
if: success() && steps.upload-job.outcome == 'success'
108+
run: |
109+
rm -f appversion.h
110+
111+
publish:
112+
name: 'Publish'
113+
runs-on: ubuntu-latest
114+
needs: [windows, linux]
115+
116+
steps:
117+
- name: Deploying linux artifacts
118+
uses: actions/download-artifact@v2
119+
with:
120+
name: linux32
121+
122+
- name: Deploying windows artifacts
123+
uses: actions/download-artifact@v2
124+
with:
125+
name: win32
126+
127+
- name: Reading appversion.h
128+
run: |
129+
if [ -e appversion.h ]; then
130+
APP_VERSION=$(cat appversion.h | grep -wi '#define APP_VERSION_STRD' | sed -e 's/#define APP_VERSION_STRD[ \t\r\n\v\f]\+\(.*\)/\1/i' -e 's/\r//g')
131+
if [ $? -ne 0 ]; then
132+
APP_VERSION=""
133+
else
134+
# Remove quotes
135+
APP_VERSION=$(echo $APP_VERSION | xargs)
136+
echo "APP_VERSION=${APP_VERSION}" >> $GITHUB_ENV
137+
fi
138+
fi
139+
rm -f appversion.h
140+
141+
- name: Packaging binaries
142+
id: packaging-job
143+
if: |
144+
github.event_name == 'release' &&
145+
github.event.action == 'published' &&
146+
startsWith(github.ref, 'refs/tags/')
147+
run: |
148+
7z a -tzip metamod-bin-${{ env.APP_VERSION }}.zip addons/ example_plugin/ sdk/
149+
150+
- name: Publish artifacts
151+
uses: softprops/action-gh-release@v1
152+
id: publish-job
153+
if: |
154+
startsWith(github.ref, 'refs/tags/') &&
155+
steps.packaging-job.outcome == 'success'
156+
with:
157+
files: |
158+
*.zip
159+
160+
- name: Cleanup temporary artifacts
161+
if: success() && steps.publish-job.outcome == 'success'
162+
run: |
163+
rm -rf addons debug example_plugin sdk
164+
rm -f *.zip appversion.h

.gitignore

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
**/build
2-
**/.gradle
3-
.idea
4-
*.iml
52
*.bat
63
**/msvc/Debug*
74
**/msvc/Release*
@@ -19,5 +16,5 @@
1916
**/PublishPath*.txt
2017
**/*.log
2118

19+
metamod/version/appversion.h
2220
publish
23-
**/appversion.h

CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
cmake_minimum_required(VERSION 3.1)
2+
project(metamod CXX)
3+
4+
if (WIN32)
5+
message(FATAL_ERROR "CMakeLists.txt Windows platform isn't supported yet. Use msvc/metamod.sln instead it!")
6+
endif()
7+
8+
add_custom_target(appversion DEPENDS
9+
COMMAND "${PROJECT_SOURCE_DIR}/metamod/version/appversion.sh" "${PROJECT_SOURCE_DIR}"
10+
)
11+
12+
add_subdirectory(metamod)

README.md

Lines changed: 76 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,94 @@
1-
# metamod-r
2-
3-
4-
**Metamod-r** is based on the original version of [Metamod](http://metamod.org/) written by _Will Day_ for Half-Life 1 with some improvements from [Jussi Kivilinna](https://github.com/jkivilin) ([Metamod-p](https://github.com/jkivilin/metamod-p)). This product contains a large number of performance optimizations and more pure code. The core was written using JIT compiler.
1+
# Metamod-r [![Download](https://camo.githubusercontent.com/3d98e8552f23d02a71bc35672904ccc9a1e2201ae6eff9c892539a57035b290d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f74686541736d6f6461692f6d6574616d6f642d722e737667)](https://github.com/theAsmodai/metamod-r/releases/latest) [![Downloads](https://camo.githubusercontent.com/a49efb6ce75429709e735ce0c7ba994ace3f6c93241fc2b42ea523dea39c2abc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f646f776e6c6f6164732f74686541736d6f6461692f6d6574616d6f642d722f746f74616c3f636f6c6f723d696d706f7274616e74)]() [![Percentage of issues still open](http://isitmaintained.com/badge/open/theAsmodai/metamod-r.svg)](http://isitmaintained.com/project/theAsmodai/metamod-r "Percentage of issues still open") [![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
52

3+
**Metamod-r** is based on the original version of [Metamod](http://metamod.org/) written by _Will Day_ for Half-Life 1 with some improvements from [Jussi Kivilinna](https://github.com/jkivilin) ([Metamod-p](https://github.com/jkivilin/metamod-p)). This product contains a large number of performance optimizations and more pure code. The core was written using JIT compiler.
64

75
**Metamod-r is incompatible with original `HLDS`. It's necessary to have installed [ReHLDS](https://github.com/dreamstalker/ReHLDS) (`API 3.1+`). There is no guarantee that the product will work in a different environment.**
86

9-
|HLDS | [ReHLDS](https://github.com/dreamstalker/ReHLDS) | OS | Download |
10-
|---------| -------| --- | --- |
11-
| :x: | `API 3.1+` |![](https://i.imgur.com/AzhAYR4.png) ![](https://i.imgur.com/t23p9tU.png) | [![Download](https://camo.githubusercontent.com/2b15ec2fc402e02b66fde9eab7e896406caeddac/687474703a2f2f7265686c64732e6f72672f76657273696f6e2f6d6574616d6f642d2d722e737667)](http://teamcity.rehlds.org/guestAuth/downloadArtifacts.html?buildTypeId=Metamod_Publish&buildId=lastSuccessful)
7+
|HLDS | [ReHLDS](https://github.com/dreamstalker/ReHLDS) | OS | Download |
8+
|---------| -------| --- | --- |
9+
| :x: | `API 3.1+` |![](https://i.imgur.com/AzhAYR4.png) ![](https://i.imgur.com/t23p9tU.png) | [![Download](https://camo.githubusercontent.com/3d98e8552f23d02a71bc35672904ccc9a1e2201ae6eff9c892539a57035b290d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f74686541736d6f6461692f6d6574616d6f642d722e737667)](https://github.com/theAsmodai/metamod-r/releases/latest)
1210

1311
[![Official Site](https://img.shields.io/badge/Link-Official%20site-3CB371.svg?longCache=true&style=flat-square)](https://metamod-r.org/)
1412
[![Experimental](https://img.shields.io/badge/status-experimental-orange.svg?style=flat-square)](https://github.com/theAsmodai/metamod-r/)
15-
[![Build Status](https://img.shields.io/teamcity/http/teamcity.rehlds.org/e/Metamod_Publish.svg?style=flat-square&label=TC%20Build)](http://teamcity.rehlds.org/viewType.html?buildTypeId=Metamod_Publish&guest=1)
16-
[![GitHub issues](https://img.shields.io/github/issues/theAsmodai/metamod-r.svg?longCache=true&style=flat-square)](https://github.com/theAsmodai/metamod-r/issues)
17-
[![GitHub forks](https://img.shields.io/github/forks/theAsmodai/metamod-r.svg?longCache=true&style=flat-square)](https://github.com/theAsmodai/metamod-r/network)
18-
[![GitHub stars](https://img.shields.io/github/stars/theAsmodai/metamod-r.svg?longCache=true&style=flat-square)](https://github.com/theAsmodai/metamod-r/stargazers)
13+
[![GitHub issues](https://img.shields.io/github/issues/theAsmodai/metamod-r.svg?longCache=true&style=flat-square)](https://github.com/theAsmodai/metamod-r/issues)
14+
[![GitHub forks](https://img.shields.io/github/forks/theAsmodai/metamod-r.svg?longCache=true&style=flat-square)](https://github.com/theAsmodai/metamod-r/network)
15+
[![GitHub stars](https://img.shields.io/github/stars/theAsmodai/metamod-r.svg?longCache=true&style=flat-square)](https://github.com/theAsmodai/metamod-r/stargazers)
1916

2017

21-
Distributed under
18+
Distributed under
2219
[![GitHub license](https://img.shields.io/github/license/theAsmodai/metamod-r.svg?longCache=true&style=flat-square)](https://github.com/theAsmodai/metamod-r/blob/master/LICENSE).
2320

2421
## Documentation
25-
* All actual documentation in ![en](https://i.imgur.com/rm67tUZ.png) **English** and ![ru](https://i.imgur.com/ItziiKg.png) **Russian** languages is placed at [this link](https://github.com/theAsmodai/metamod-r/wiki).
22+
* All actual documentation in ![en](https://i.imgur.com/rm67tUZ.png) **English** and ![ru](https://i.imgur.com/ItziiKg.png) **Russian** languages is placed at [this link](https://github.com/theAsmodai/metamod-r/wiki).
2623

2724
### Supported games
2825
* ![en](https://i.imgur.com/rm67tUZ.png) Actual [list of supported games](https://github.com/theAsmodai/metamod-r/wiki/Supported-games).
2926
* ![ru](https://i.imgur.com/ItziiKg.png) Актуальный [список поддерживаемых игр](https://github.com/theAsmodai/metamod-r/wiki/Поддерживаемые-игры).
3027

28+
## Build instructions
29+
### Checking requirements
30+
There are several software requirements for building Metamod-r:
31+
32+
#### Windows
33+
<pre>
34+
Visual Studio 2015 (C++14 standard) and later
35+
</pre>
36+
37+
#### Linux
38+
<pre>
39+
git >= 1.8.5
40+
cmake >= 3.10
41+
GCC >= 4.9.2 (Optional)
42+
ICC >= 15.0.1 20141023 (Optional)
43+
LLVM (Clang) >= 6.0 (Optional)
44+
</pre>
45+
46+
### Building
47+
48+
#### Windows
49+
Use `Visual Studio` to build, open `msvc/metamod.sln` and just select from the solution configurations list `Release` or `Debug`
50+
51+
#### Linux
52+
53+
* Optional options using `build.sh --compiler=[gcc] --jobs=[N] -D[option]=[ON or OFF]` (without square brackets)
54+
55+
<pre>
56+
-c=|--compiler=[icc|gcc|clang] - Select preferred C/C++ compiler to build
57+
-j=|--jobs=[N] - Specifies the number of jobs (commands) to run simultaneously (For faster building)
58+
59+
<sub>Definitions (-D)</sub>
60+
DEBUG - Enables debugging mode
61+
USE_STATIC_LIBSTDC - Enables static linking library libstdc++
62+
</pre>
63+
64+
* ICC <pre>./build.sh --compiler=intel</pre>
65+
* LLVM (Clang) <pre>./build.sh --compiler=clang</pre>
66+
* GCC <pre>./build.sh --compiler=gcc</pre>
67+
68+
##### Checking build environment (Debian / Ubuntu)
69+
70+
<details>
71+
<summary>Click to expand</summary>
72+
73+
<ul>
74+
<li>
75+
Installing required packages
76+
<pre>
77+
sudo dpkg --add-architecture i386
78+
sudo apt-get update
79+
sudo apt-get install -y gcc-multilib g++-multilib
80+
sudo apt-get install -y build-essential
81+
sudo apt-get install -y libc6-dev libc6-dev-i386
82+
</pre>
83+
</li>
84+
85+
<li>
86+
Select the preferred C/C++ Compiler installation
87+
<pre>
88+
1) sudo apt-get install -y gcc g++
89+
2) sudo apt-get install -y clang
90+
</pre>
91+
</li>
92+
</ul>
3193

32-
### Build instructions
33-
* ![en](https://i.imgur.com/rm67tUZ.png) [Build instructions](https://github.com/theAsmodai/metamod-r/wiki/Compilling-metamod-r).
34-
* ![ru](https://i.imgur.com/ItziiKg.png) [Инструкция по сборке](https://github.com/theAsmodai/metamod-r/wiki/Компиляция-metamod-r).
94+
</details>

build.gradle

Lines changed: 0 additions & 54 deletions
This file was deleted.

0 commit comments

Comments
 (0)