Skip to content

Commit

Permalink
Create GitHub actions for building and testing the project (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
filip-szweda authored Sep 21, 2023
1 parent aac3887 commit 6a22783
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/build-and-test-debug-on-push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Build and test Debug binaries on push

on:
push:
branches-ignore:
- main

jobs:
build-debug:
uses: ./.github/workflows/build-and-test.yaml
with:
build-type: Debug
12 changes: 12 additions & 0 deletions .github/workflows/build-and-test-release-on-merge.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Build and test Release binaries on merge

on:
push:
branches:
- main

jobs:
build-release:
uses: ./.github/workflows/build-and-test.yaml
with:
build-type: Release
52 changes: 52 additions & 0 deletions .github/workflows/build-and-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Build and test Release/Debug binaries

on:
workflow_call:
inputs:
build-type:
description: Release or Debug
required: true
type: string

jobs:
build-x86-64:
runs-on: ubuntu-latest
steps:
- name: Checkout source code of the repository
uses: actions/checkout@v3

- name: Update packages
run: |
sudo apt-get update
sudo apt-get upgrade -y
- name: Set environment variables
run: |
buildType=${{ inputs.build-type }}
echo "CAPITALISED_BUILD_TYPE="${buildType}"" >> $GITHUB_ENV
echo "LOWERCASE_BUILD_TYPE="${buildType,,}"" >> $GITHUB_ENV
- name: Install requirements
run: |
sudo apt-get install -y libelf-dev
sudo apt-get install -y libboost-all-dev
sudo apt-get install -y libfmt-dev
sudo apt-get install -y clang
pip install cmake==3.23.3
pip install conan==2.0
conan profile detect
conan install . --build=missing -s build_type=${{ env.CAPITALISED_BUILD_TYPE }}
- name: Configure Release
run: cmake --preset conan-${{ env.LOWERCASE_BUILD_TYPE }} -DBUILD_TESTS=OFF
if: ${{ env.LOWERCASE_BUILD_TYPE == 'release' }}

- name: Configure Debug
run: cmake --preset conan-${{ env.LOWERCASE_BUILD_TYPE }}
if: ${{ env.LOWERCASE_BUILD_TYPE == 'debug' }}

- name: Build
run: cmake --build --preset conan-${{ env.LOWERCASE_BUILD_TYPE }}

- name: Test
run: ctest --preset conan-${{ env.LOWERCASE_BUILD_TYPE }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/.vscode/
/.venv/
/.idea/
/.conan/
/build/
/cmake-build-debug/
Expand Down

0 comments on commit 6a22783

Please sign in to comment.