-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create GitHub actions for building and testing the project (#9)
- Loading branch information
1 parent
aac3887
commit 6a22783
Showing
4 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
/.vscode/ | ||
/.venv/ | ||
/.idea/ | ||
/.conan/ | ||
/build/ | ||
/cmake-build-debug/ | ||
|