Skip to content

Commit

Permalink
Build and distribute binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
maxmouchet committed Oct 27, 2023
1 parent 194bce5 commit 968a366
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 9 deletions.
73 changes: 73 additions & 0 deletions .github/workflows/binaries.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Binaries

on: [ push ]

jobs:
linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/.conan/data
key: binaries-${{ runner.os }}-x86_64
- name: Install dependencies
run: |
sudo apt update
sudo apt install --yes build-essential cmake ninja-build python3-pip
pip3 install "conan<2.0"
- name: Configure project
run: cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DWITH_BINARY=ON -DWITH_CONAN=ON
- name: Build executable
run: cmake --build build --target caracal-bin
- uses: actions/upload-artifact@v3
with:
name: caracal-linux-amd64
path: build/caracal

macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/.conan/data
key: binaries-${{ runner.os }}-x86_64
- name: Install dependencies
run: brew install cmake ninja
- name: Install Conan
run: pip3 install "conan<2.0"
# For some unknown reasons bison fails to build on GitHub macOS 12 runners.
# However, if we call conan twice, it seems to work...¯\(◉‿◉)/¯
- name: Configure project
run: |
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DWITH_BINARY=ON -DWITH_CONAN=ON || true
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DWITH_BINARY=ON -DWITH_CONAN=ON
- name: Build executable
run: cmake --build build --target caracal-bin
- uses: actions/upload-artifact@v3
with:
name: caracal-macos-amd64
path: build/caracal

release:
needs: [ linux, macos ]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: caracal-linux-amd64
path: caracal-linux-amd64
- uses: actions/download-artifact@v3
with:
name: caracal-macos-amd64
path: caracal-macos-amd64
- run:
ls -alh
file caracal*
- uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
caracal-linux-amd64
caracal-macos-amd64
17 changes: 8 additions & 9 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- uses: actions/cache@v3
with:
path: ~/.conan/data
key: ${{ runner.os }}-x86_64
key: tests-${{ runner.os }}-x86_64
- name: Install dependencies
run: |
sudo apt update
Expand All @@ -54,18 +54,17 @@ jobs:
- uses: actions/cache@v3
with:
path: ~/.conan/data
key: ${{ runner.os }}-x86_64
key: tests-${{ runner.os }}-x86_64
- name: Install dependencies
run: brew install cmake gcovr ninja
- name: Install Conan
run: pip3 install "conan<2.0"
- name: Configure project (try 1/2)
run: cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-fprofile-arcs -ftest-coverage -fsanitize=address -fsanitize=undefined" -DWITH_CONAN=ON -DWITH_TESTS=ON
continue-on-error: true
# For some unknown reasons bison fails to build on GitHub macOS 12 runners.
# However, if we call conan twice, it seems to work...¯\(◉‿◉)/¯
- name: Configure project (try 2/2)
run: cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-fprofile-arcs -ftest-coverage -fsanitize=address -fsanitize=undefined" -DWITH_CONAN=ON -DWITH_TESTS=ON
# For some unknown reasons bison fails to build on GitHub macOS 12 runners.
# However, if we call conan twice, it seems to work...¯\(◉‿◉)/¯
- name: Configure project
run: |
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-fprofile-arcs -ftest-coverage -fsanitize=address -fsanitize=undefined" -DWITH_CONAN=ON -DWITH_TESTS=ON || true
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-fprofile-arcs -ftest-coverage -fsanitize=address -fsanitize=undefined" -DWITH_CONAN=ON -DWITH_TESTS=ON
- name: Build tests
run: cmake --build build --target caracal-test
- name: Run tests
Expand Down

0 comments on commit 968a366

Please sign in to comment.