Skip to content

Commit 3d80d25

Browse files
committedFeb 15, 2023
Setup CI on Github
1 parent eee4ec0 commit 3d80d25

File tree

5 files changed

+43
-5
lines changed

5 files changed

+43
-5
lines changed
 

‎.github/workflows/ci.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: CI
2+
on:
3+
push:
4+
branches: []
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
env:
9+
PICO_SDK_PATH: "/opt/pico_sdk"
10+
steps:
11+
- name: Checkout code
12+
uses: actions/checkout@v2
13+
- name: Install dependencies
14+
run: |
15+
sudo apt-get update
16+
sudo apt-get install -y cmake build-essential gcc-arm-none-eabi git freecad googletest google-mock libgtest-dev libgmock-dev
17+
- name: Prepare PICO-SDK
18+
run: |
19+
sudo git clone --depth 1 https://github.com/raspberrypi/pico-sdk $PICO_SDK_PATH && \
20+
pushd $PICO_SDK_PATH && \
21+
sudo git submodule update --init && \
22+
popd
23+
- name: Configure build
24+
run: cmake -B build -S .
25+
- name: Build firmware
26+
run: cmake --build build
27+
- name: Run tests
28+
run: ctest --test-dir build/tests --output-on-failure

‎3dmodels/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
find_file (FREECAD_EXECUTABLE NAMES FreeCADCmd freecad.cmd)
2+
find_file (FREECAD_EXECUTABLE NAMES FreeCADCmd freecad.cmd freecadcmd)
33

44
if (EXISTS ${FREECAD_EXECUTABLE})
55
add_subdirectory(CrealityCR10Smart_DualGearExtruder)

‎README.md

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/slavaz/SmartFilamentSensor/ci.yml)
2+
13
Smart Filament Sensor
24
===
35

‎cmake/version.cmake

+11-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,24 @@
11

2-
execute_process(COMMAND git describe --abbrev=0 --tags
2+
3+
find_file (GIT_EXECUTABLE NAMES git)
4+
5+
if (NOT EXISTS ${GIT_EXECUTABLE})
6+
message( FATAL_ERROR "Git not found!")
7+
endif()
8+
9+
10+
execute_process(COMMAND ${GIT_EXECUTABLE} describe --abbrev=0 --tags
311
OUTPUT_VARIABLE GIT_TAG
412
ERROR_QUIET)
513

614
if(NOT GIT_TAG)
715
set(GIT_TAG "0.0")
816
endif()
917

10-
execute_process(COMMAND git log --pretty=format:'%h' -n 1
18+
execute_process(COMMAND ${GIT_EXECUTABLE} log --pretty=format:'%h' -n 1
1119
OUTPUT_VARIABLE GIT_REV ERROR_QUIET)
1220

13-
execute_process(COMMAND git rev-parse --abbrev-ref HEAD
21+
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
1422
OUTPUT_VARIABLE GIT_BRANCH ERROR_QUIET)
1523

1624
string(STRIP "${GIT_TAG}" GIT_TAG)

‎doc/Development.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Other tools
2424
You also need to install GoogleTest and Freecad.
2525

2626
deb-based distros:
27-
`sudo apt install googletest google-mock freecad`
27+
`sudo apt install googletest google-mock libgtest-dev libgmock-dev freecad`
2828

2929
RPM-based distros:
3030

0 commit comments

Comments
 (0)
Please sign in to comment.