Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ feat: add build and release #7

Merged
merged 1 commit into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
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 boost-msvc
- 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@v9

- name: Install dependencies
run: ${{ matrix.install }}

- name: Build project
run: |
if [ "${{ matrix.os }}" == "windows-latest" ]; then
clang++ -o cmr_cache.exe main.cpp -I./vendor/yaml -lboost_system -lpthread -std=c++17 -O3
else
clang++ -o cmr_cache main.cpp -I./vendor/yaml -lboost_system -lpthread -std=c++17 -O3
fi

- 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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
build*
build/*
build.*
*.exe
data/*.dat
.env*
Expand Down
Loading