Use preprocessors to separate OS specific logic #242
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: Build Binaries | |
on: | |
push: | |
pull_request: | |
release: | |
types: [ created ] | |
permissions: | |
contents: read | |
jobs: | |
windows: | |
name: "Build Windows" | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Add MSBuild to PATH | |
uses: microsoft/setup-msbuild@v2 | |
- name: run-vcpkg | |
uses: lukka/run-vcpkg@v11 | |
with: | |
runVcpkgInstall: true | |
vcpkgGitCommitId: '1de2026f28ead93ff1773e6e680387643e914ea1' | |
- name: Integrate vcpkg | |
run: vcpkg integrate install | |
- name: Build Release | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
run: msbuild /m /p:VcpkgEnableManifest=true /p:Configuration=Release | |
- name: Build Debug | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
run: msbuild /m /p:VcpkgEnableManifest=true /p:Configuration=Debug | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: win64-release | |
path: | | |
x64/Release/SGDBoop.exe | |
x64/Release/libcurl.dll | |
x64/Release/zlib1.dll | |
x64/Release/iup.dll | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: win64-debug | |
path: x64/Debug/* | |
linux: | |
name: "Build Linux" | |
runs-on: ubuntu-latest | |
env: | |
OS: Linux | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install libcurl | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libcurl4-openssl-dev | |
- name: Build | |
run: sudo make | |
- name: Copy libiup.so to linux-release/ | |
run: cp lib/linux/libiup.so linux-release/ | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: linux-build | |
path: linux-release/* | |
release: | |
if: github.event_name == 'release' && github.event.action == 'created' | |
name: "Upload Artifacts to Release" | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
needs: [windows,linux] | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
path: artifacts | |
- name: Archive Windows Release Build | |
run: 7z a sgdboop-win64.zip ./artifacts/win64-release/* | |
- name: Archive Linux Release Build | |
run: | | |
chmod +x artifacts/linux-build/install.sh artifacts/linux-build/SGDBoop | |
cd artifacts/linux-build/ | |
tar -czvf ../../sgdboop-linux64.tar.gz * | |
- uses: ncipollo/release-action@v1 | |
with: | |
allowUpdates: true | |
omitName: true | |
omitBody: true | |
replacesArtifacts: true | |
tag: ${{github.event.release.tag_name}} | |
commit: ${{github.sha}} | |
artifacts: "sgdboop-linux64.tar.gz,sgdboop-win64.zip" |