Skip to content

Some more minor changes #338

Some more minor changes

Some more minor changes #338

Workflow file for this run

name: Build check
on:
push:
branches:
- '**'
tags-ignore:
- '*' # We don't want this to run on release
pull_request:
jobs:
build-windows:
name: Windows
runs-on: windows-2019
env:
MSBUILD_PATH: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/MSBuild/Current/Bin"
BOOST_ROOT: C:\thirdparties\boost-1.72.0
steps:
- uses: actions/checkout@master
with:
fetch-depth: 0
ref: ${{ github.ref }}
- name: Install OpenSSL
run: choco install openssl
- name: Install Boost
shell: powershell
run: |
$Url = "https://sourceforge.net/projects/boost/files/boost-binaries/1.72.0/boost_1_72_0-msvc-14.2-64.exe"
(New-Object System.Net.WebClient).DownloadFile($Url, "$env:TEMP\boost-installer.exe")
Start-Process -Wait -FilePath "$env:TEMP\boost-installer.exe" "/SILENT","/SP-","/SUPPRESSMSGBOXES","/DIR=$env:BOOST_ROOT"
- name: Build
shell: powershell
id: build
run: |
$env:PATH = "$env:PATH;$env:MSBUILD_PATH"
$build_folder = "build"
$sha = "${{ github.sha }}"
$krb_ver = $sha.SubString(0,7)
$release_name = "karbo-cli-win64-${krb_ver}"
mkdir "$build_folder"
cd "$build_folder"
cmake -G "Visual Studio 16 2019" -A x64 -DARCH=default -DBOOST_ROOT="$env:BOOST_ROOT" -DBOOST_INCLUDE_DIRS="$env:BOOST_ROOT/include" ..
MSBuild Karbo.sln /p:Configuration=Release /m
cd src\Release
Compress-Archive -Path *.exe -DestinationPath "$release_name.zip"
$sha256 = (Get-FileHash "$release_name.zip").Hash
$asset_path = "./$build_folder/src/Release/$release_name.zip"
mkdir "$release_name"
cp *.exe "$release_name/"
echo "sha256=${sha256}" >> $env:GITHUB_OUTPUT
echo "release_name=${release_name}.zip" >> $env:GITHUB_OUTPUT
echo "asset_path=${asset_path}" >> $env:GITHUB_OUTPUT
echo "krb_ver=${krb_ver}" >> $env:GITHUB_OUTPUT
echo "artifact_path=$build_folder/src/Release/$release_name" >> $env:GITHUB_OUTPUT
- name: Upload To GH Artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ steps.build.outputs.release_name }}
path: ${{ steps.build.outputs.artifact_path }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-macos:
name: macOS
runs-on: macos-11
steps:
- uses: actions/checkout@master
with:
fetch-depth: 0
ref: ${{ github.ref }}
- name: Build
id: build
run: |
build_folder="build/"
krb_ver=${GITHUB_SHA::7}
release_name="Karbo-cli-macOS-${krb_ver}"
brew install --force boost gcc openssl
brew link boost --force
mkdir "$build_folder"
cd "$build_folder"
cmake -D ARCH=default -DCMAKE_C_FLAGS="-mmacosx-version-min=10.12" -DCMAKE_CXX_FLAGS="-mmacosx-version-min=10.12" ..
make
mkdir "$release_name"
exeFiles=()
for f in src/*; do [[ -x $f && -f $f ]] && strip "$f" && exeFiles+=( "$f" ); done
strip "${exeFiles[@]}"
cp "${exeFiles[@]}" "$release_name/"
zip -r "$release_name".zip "$release_name"
sha256=$(shasum -a 256 "$release_name".zip | awk '{print toupper($1)}')
asset_path="./$build_folder$release_name.zip"
echo "::set-output name=sha256::${sha256}"
echo "::set-output name=release_name::${release_name}.zip"
echo "::set-output name=asset_path::${asset_path}"
echo "::set-output name=krb_ver::${krb_ver}"
echo "::set-output name=artifact_path::$build_folder/$release_name"
- name: Upload To GH Artifacts
uses: actions/[email protected]
with:
name: ${{ steps.build.outputs.release_name }}
path: ${{ steps.build.outputs.artifact_path }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-ubuntu20:
name: Ubuntu 20.04
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@master
with:
fetch-depth: 0
ref: ${{ github.ref }}
- name: Build
id: build
run: |
sudo apt update
sudo apt install -y libboost-all-dev libssl-dev
build_folder="build/release"
krb_ver=${GITHUB_SHA::7}
release_name="Karbo-cli-ubuntu20.04-${krb_ver}"
mkdir -p "$build_folder"
cd "$build_folder"
cmake -DBoost_NO_BOOST_CMAKE=ON -D ARCH=default -D CMAKE_BUILD_TYPE=Release -D CMAKE_POSITION_INDEPENDENT_CODE:BOOL=true ../..
make
mkdir -p "$release_name"
exeFiles=()
for f in src/*; do [[ -x $f && -f $f ]] && exeFiles+=( "$f" ); done
strip "${exeFiles[@]}"
cp "${exeFiles[@]}" "$release_name/"
echo "release_name=${release_name}" >> $GITHUB_OUTPUT
echo "artifact_path=$build_folder/$release_name" >> $GITHUB_OUTPUT
- name: Upload To GH Artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ steps.build.outputs.release_name }}
path: ${{ steps.build.outputs.artifact_path }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-ubuntu22:
name: Ubuntu 22.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@master
with:
fetch-depth: 0
ref: ${{ github.ref }}
- name: Build
id: build
run: |
sudo apt update
sudo apt install -y libboost-all-dev libssl-dev
build_folder="build/release"
krb_ver=${GITHUB_SHA::7}
release_name="Karbo-cli-ubuntu22.04-${krb_ver}"
mkdir -p "$build_folder"
cd "$build_folder"
cmake -D ARCH=default -D CMAKE_BUILD_TYPE=Release -D CMAKE_POSITION_INDEPENDENT_CODE:BOOL=true ../..
make
mkdir -p "$release_name"
exeFiles=()
for f in src/*; do [[ -x $f && -f $f ]] && exeFiles+=( "$f" ); done
strip "${exeFiles[@]}"
cp "${exeFiles[@]}" "$release_name/"
echo "release_name=${release_name}" >> $GITHUB_OUTPUT
echo "artifact_path=$build_folder/$release_name" >> $GITHUB_OUTPUT
- name: Upload To GH Artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ steps.build.outputs.release_name }}
path: ${{ steps.build.outputs.artifact_path }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}