Skip to content

Commit a96eca1

Browse files
committed
Resolve suggestions from code review memfault#1
1 parent eecf4b8 commit a96eca1

File tree

1 file changed

+64
-9
lines changed

1 file changed

+64
-9
lines changed

_posts/2022-11-01-setup-a-ci-pipeline-using-github-actions-and-docker.md

Lines changed: 64 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ So, to complete these steps, we will use the following tools:
3333

3434
## Board and IDE
3535

36-
To give you an example of how to set up a continuous integration pipeline in a firmware project, I will use the [Silicon Labs Thunderboard Sense Board](https://www.silabs.com/development-tools/thunderboard/thunderboard-sense-two-kit?tab=overview) to run a simple project on [Simplicity Studio IDE](https://www.silabs.com/developers/simplicity-studio) that we will use to build and perform static analysis.
36+
This tutorial is specific to the Simplicity Studio build system, but the general approach should apply to other build systems. I will use the [Silicon Labs Thunderboard Sense Board](https://www.silabs.com/development-tools/thunderboard/thunderboard-sense-two-kit?tab=overview) to run a simple project on [Simplicity Studio IDE](https://www.silabs.com/developers/simplicity-studio) that we will use to build and perform static analysis.
3737

3838
![Thunderboard](/img/setup-a-ci-pipeline-using-github-actions-and-docker/0-thunderboard.png)
3939

@@ -83,7 +83,7 @@ Now the project can be built from the terminal, which is necessary for building
8383

8484
# Test the compilation on a Docker Container
8585

86-
We will use a docker image with Simplicity Studio to build our project on a container. This will allow us to configure GitHub Actions to use the docker image to do the same.
86+
We will use a docker image with [Simplicity Studio v5](https://www.silabs.com/documents/login/software/SimplicityStudio-5.tgz) and the necessary SDKs installed to build our project on a container. It will allow us to configure GitHub Actions to use the docker image to do the same.
8787

8888
So let's pull the image to our computer:
8989

@@ -116,16 +116,15 @@ cppcheck . --output-file=cpplog.txt
116116
Since the project was created, let's create a git repository.
117117

118118
For this tutorial, this is the repository I've used for my project:
119+
[https://github.com/leoribg/memfault-empty-example](https://github.com/leoribg/memfault-empty-example)
119120

120-
121-
122-
To start and add your project to a git repository, run the following commands on your project directory:
121+
[To start and add your project to a git repository](https://docs.github.com/en/get-started/quickstart/create-a-repo), run the following commands on your project directory:
123122

124123
```bash
125124
git init
126125
git add .
127126
git commit -m "first commit"
128-
git remote add origin [email protected]:"user"/"repository".git
127+
git remote add origin [email protected]:leoribg/memfault-empty-example.git
129128
git push -u origin master
130129
```
131130

@@ -143,15 +142,71 @@ Choose the right template:
143142

144143
This tutorial will use a single workflow to execute our jobs. So, it will only have a single .yml file.
145144

146-
The .yml file starts like this, we will modify it.
145+
The c-cpp.yml file starts like this, we will modify it.
146+
147+
```yaml
148+
name: C/C++ CI
149+
150+
on: #These are the trigger that will run our jobs
151+
push:
152+
branches: [ "master" ]
153+
pull_request:
154+
branches: [ "master" ]
155+
156+
jobs: #Jobs are set of steps that will execute our tasks
157+
build:
147158

148-
![Cpp Workflow](/img/setup-a-ci-pipeline-using-github-actions-and-docker/12-cpp-workflow.png)
159+
runs-on: ubuntu-latest
160+
161+
steps:
162+
- uses: actions/checkout@v3
163+
- name: configure
164+
run: ./configure
165+
- name: make
166+
run: make
167+
- name: make check
168+
run: make check
169+
- name: make distcheck
170+
run: make distcheck
171+
```
149172
150173
Let's modify the content of our .yml file to execute the build and the static analysis of the project.
151174
152175
We will indicate the Docker Image we use to execute the workflow's steps. After we will build the project, upload the image as an artifact. Finally, we will make a static analysis in the code and upload the artifact with the results.
153176
154-
![Cpp Editing](/img/setup-a-ci-pipeline-using-github-actions-and-docker/13-cpp-editing.png)
177+
```yaml
178+
name: C/C++ CI
179+
180+
on:
181+
push:
182+
branches: [ "master" ]
183+
pull_request:
184+
branches: [ "master" ]
185+
186+
jobs:
187+
build:
188+
189+
runs-on: ubuntu-latest
190+
container:
191+
image: leoribg/simplicity-studio-5:latest #Docker Image
192+
193+
steps:
194+
- uses: actions/checkout@v3
195+
- name: make #Build
196+
run: make -f empty.Makefile
197+
- name: binary artifact #Upload the image artifact
198+
uses: actions/upload-artifact@v3
199+
with:
200+
name: empty.s37
201+
path: ./build/debug/empty.s37
202+
- name: static analisys #Lint
203+
run: cppcheck . --output-file=cpplog.txt
204+
- name: lint artifact #Upload the lint artifact
205+
uses: actions/upload-artifact@v3
206+
with:
207+
name: lint_output.txt
208+
path: ./cpplog.txt
209+
```
155210
156211
# Trigger our GitHub Action
157212

0 commit comments

Comments
 (0)