Dmitry Novikov 837c731ab4
Migrated the CI/CD to GitHub Actions (#3)
Migrates the project's CI/CD to GitHub Actions from Travis CI. Adds CMake support along with the improved build script for Linux builds and adds `README.md` with build steps.

Co-authored-by: Artem Golubikhin <wpmgprostotema@live.ru>
2022-02-05 18:36:36 +03:00

106 lines
2.5 KiB
YAML

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-latest
env:
solution: 'SafeNameAndChat.sln'
buildPlatform: 'x86'
buildRelease: 'Release'
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1.0.2
- 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\bin\win32
move ${{ env.buildRelease }}\SafeNameAndChat.dll publish\bin\win32\SafeNameAndChat.dll
- name: Deploy artifacts
uses: actions/upload-artifact@v2
with:
name: win32
path: publish/*
linux:
name: 'Linux'
runs-on: ubuntu-latest
container: s1lentq/linux86buildtools:latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install dependencies
run: |
apt-get install -y g++-8 g++-8-multilib
- name: Build
run: |
rm -rf build && CC=gcc-8 CXX=g++-8 cmake -B build -DUSE_STATIC_LIBSTDC=ON && cmake --build build -j8
- name: Move files
run: |
mkdir -p publish/bin/linux32
mv build/SafeNameAndChat.so publish/bin/linux32/SafeNameAndChat.so
- name: Deploy artifacts
uses: actions/upload-artifact@v2
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@v2
with:
name: linux32
- name: Deploying windows artifacts
uses: actions/download-artifact@v2
with:
name: win32
- name: Publish artifacts
uses: softprops/action-gh-release@v1
id: publish-job
if: |
github.event_name == 'release' &&
github.event.action == 'published' &&
startsWith(github.ref, 'refs/tags/')
with:
files: |
bin/linux32/SafeNameAndChat.so
bin/win32/SafeNameAndChat.dll