Skip to content

💚 fix: build and release #7

💚 fix: build and release

💚 fix: build and release #7

name: Build and Release
on:
push:
tags:
- 'v*'
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, fedora-latest, centos-latest]
include:
- os: ubuntu-latest
install: sudo apt-get update && sudo apt-get install -y libboost-all-dev clang
- os: windows-latest
install: |
choco install llvm
curl -L -o boost.zip https://storage.cmr.dev.br/boost.zip
unzip boost.zip -d boost
- os: fedora-latest
install: sudo dnf install -y clang boost-devel
- os: centos-latest
install: sudo yum install -y clang boost-devel
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Clang
if: matrix.os == 'windows-latest'
uses: egor-tensin/setup-clang@v1
- name: Install dependencies
run: ${{ matrix.install }}
- name: Set up Boost environment
if: matrix.os == 'windows-latest'
run: |
echo "BOOST_INCLUDE_PATH=$(pwd)/boost/boost" >> $GITHUB_ENV
echo "BOOST_LIBRARY_PATH=$(pwd)/boost/lib" >> $GITHUB_ENV
- name: Build Windows
if: matrix.os == 'windows-latest'
run: clang++ -o cmr_cache.exe main.cpp -I./vendor/yaml -I$BOOST_INCLUDE_PATH -L$BOOST_LIBRARY_PATH -llibboost_system-vc143-mt-x64-1_85 -std=c++17
- name: Build Others
if: matrix.os != 'windows-latest'
run: clang++ -o cmr_cache main.cpp -I./vendor/yaml -lboost_system -lpthread -std=c++17
- name: Create Release Archive
run: |
mkdir -p release
if [ "${{ matrix.os }}" == "windows-latest" ]; then
cp cmr_cache.exe release/
else
cp cmr_cache release/
fi
tar -czf cmr_cache_${{ matrix.os }}.tar.gz release
- name: Upload Release Archive
uses: actions/upload-artifact@v3
with:
name: cmr_cache_${{ matrix.os }}
path: cmr_cache_${{ matrix.os }}.tar.gz