Skip to content

Commit

Permalink
CI: add the first pipeline to build the application and run basic tes…
Browse files Browse the repository at this point in the history
…ts (#16)

This PR should close #6.
Requires
- #2 to be merged

---
This PR adds a slightly modified default action from _GitHub_ for
`CMake`-based projects 👍

I did run the pipeline on my personal fork, which resulted in [this
action
log](https://github.com/amtoine/wiresmash/actions/runs/3670185074/jobs/6204543791)
on the tip of the branch of #2 👍
this means that the tests will pass when the PR is ready 💪 

## NOTES
- this pipeline won't work on `windows` hence the single `ubuntu-latest`
in the matrix of OSes 🤔
- i've let the comments from the default configuration file, just for
reference 👍
- there are not tests to run, so they pass 👌
  • Loading branch information
amtoine authored Jan 19, 2023
1 parent 10f8a0c commit 5c4b9ff
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Build Wiresmash with CMake

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

env:
BUILD_TYPE: Release

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
matrix:
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v3

- name: Install the dependencies
run: sudo apt install build-essential libsfml-dev

# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
- name: Configure CMake
# the equivalent of `cmake -S ./ -B ./build/` in the `README`
run: cmake -S ${{github.workspace}} -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}

# Build your program with the given configuration
- name: Build the application
# the equivalent of `cmake --build ./build/` in the `README`
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}

# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
- name: Test
working-directory: ${{github.workspace}}/build
run: ctest -C ${{env.BUILD_TYPE}}

0 comments on commit 5c4b9ff

Please sign in to comment.