Implement Check* Hooks #375
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: C/C++ CI | |
on: | |
push: | |
branches: [master] | |
paths-ignore: | |
- '**.md' | |
pull_request: | |
types: [opened, reopened, synchronize] | |
release: | |
types: [published] | |
jobs: | |
windows: | |
name: 'Windows' | |
runs-on: windows-2019 | |
env: | |
solution: 'msvc/reapi.sln' | |
buildPlatform: 'Win32' | |
buildRelease: 'Release' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup MSBuild | |
uses: microsoft/setup-msbuild@v1.1.3 | |
with: | |
vs-version: '16.8' | |
- name: Build | |
run: | | |
msbuild ${{ env.solution }} -p:Configuration="${{ env.buildRelease }}" /t:Clean,Build /p:Platform=${{ env.buildPlatform }} /p:PlatformToolset=v140_xp /p:XPDeprecationWarning=false | |
- name: Move files | |
run: | | |
mkdir publish\debug | |
mkdir publish\addons\amxmodx\modules | |
move msvc\${{ env.buildRelease }}\reapi_amxx.dll publish\addons\amxmodx\modules\reapi_amxx.dll | |
move msvc\${{ env.buildRelease }}\reapi_amxx.pdb publish\debug\reapi_amxx.pdb | |
- name: Deploy artifacts | |
uses: actions/upload-artifact@v3.1.1 | |
with: | |
name: win32 | |
path: publish/* | |
linux: | |
name: 'Linux' | |
runs-on: ubuntu-20.04 | |
outputs: | |
app-version: ${{ steps.app-version.outputs.version }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Check dependencies | |
run: | | |
sudo dpkg --add-architecture i386 | |
sudo apt-get update | |
sudo apt-get install -y gcc-multilib g++-multilib | |
- name: Build | |
run: | | |
rm -rf build && CC=gcc CXX=g++ cmake -B build && cmake --build build -j8 | |
- name: Reading appversion.h | |
id: app-version | |
run: | | |
if [ -e "reapi/version/appversion.h" ]; then | |
APP_VERSION=$(cat "reapi/version/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') | |
if [ $? -ne 0 ]; then | |
APP_VERSION="" | |
else | |
# Remove quotes | |
APP_VERSION=$(echo $APP_VERSION | xargs) | |
fi | |
fi | |
echo "version=${APP_VERSION}" >> "$GITHUB_OUTPUT" | |
shell: bash | |
- name: Prepare AMXX | |
run: | | |
mkdir -p publish/addons/amxmodx/modules | |
rsync -a reapi/extra/amxmodx/ publish/addons/amxmodx/ | |
rsync -a reapi/version/reapi_version.inc publish/addons/amxmodx/scripting/include/ | |
- name: Move files | |
run: | | |
mv build/reapi/reapi_amxx_i386.so publish/addons/amxmodx/modules/reapi_amxx_i386.so | |
- name: Run GLIBC/ABI version compat test | |
run: | | |
binaries=( | |
"publish/addons/amxmodx/modules/reapi_amxx_i386.so" | |
) | |
bash ./reapi/version/glibc_test.sh ${binaries[@]} | |
if [[ $? -ne 0 ]]; then | |
exit 1 # Assertion failed | |
fi | |
shell: bash | |
- name: Deploy artifacts | |
uses: actions/upload-artifact@v3.1.1 | |
id: upload-job | |
with: | |
name: linux32 | |
path: publish/* | |
publish: | |
name: 'Publish' | |
runs-on: ubuntu-latest | |
needs: [windows, linux] | |
steps: | |
- name: Deploying linux artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: linux32 | |
- name: Deploying windows artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: win32 | |
- name: Packaging binaries | |
id: packaging-job | |
if: | | |
github.event_name == 'release' && | |
github.event.action == 'published' && | |
startsWith(github.ref, 'refs/tags/') | |
run: | | |
7z a -tzip reapi-bin-${{ needs.linux.outputs.app-version }}.zip addons/ | |
- name: Publish artifacts | |
uses: softprops/action-gh-release@v1 | |
id: publish-job | |
if: | | |
startsWith(github.ref, 'refs/tags/') && | |
steps.packaging-job.outcome == 'success' | |
with: | |
files: | | |
*.zip | |
env: | |
GITHUB_TOKEN: ${{ secrets.API_TOKEN }} |