Skip to content

Commit d74266a

Browse files
committed
Merge commit 'ad6e70e3c21b80d2fd5743932a69da50712ae066' as 'src/note-c'
2 parents 968a43d + ad6e70e commit d74266a

File tree

189 files changed

+43966
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

189 files changed

+43966
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
2+
// https://github.com/microsoft/vscode-dev-containers/tree/v0.205.2/containers/docker-existing-dockerfile
3+
{
4+
"name": "Note-C Development Environment Dockerfile",
5+
6+
// Sets the run context to one level up instead of the .devcontainer folder.
7+
"context": "..",
8+
9+
// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
10+
"image": "ghcr.io/blues/note_c_ci:latest",
11+
// "dockerFile": "../Dockerfile",
12+
13+
// Set *default* container specific settings.json values on container create.
14+
"settings": {},
15+
16+
// Add the IDs of extensions you want installed when the container is created.
17+
"extensions": [
18+
"ms-vscode.cpptools",
19+
"shardulm94.trailing-spaces",
20+
"twxs.cmake"
21+
],
22+
23+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
24+
// "forwardPorts": [],
25+
26+
// Uncomment the next line to run commands after the container is created - for example installing curl.
27+
// "postCreateCommand": "apt-get update && apt-get install -y curl",
28+
29+
// Uncomment when using a ptrace-based debugger like C++, Go, and Rust
30+
// "runArgs": [
31+
// "--device=/dev/bus/usb/"
32+
// ],
33+
34+
// Uncomment to use the Docker CLI from inside the container. See https://aka.ms/vscode-remote/samples/docker-from-docker.
35+
// "mounts": [ "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" ],
36+
37+
// Uncomment to connect as a non-root user if you've added one. See https://aka.ms/vscode-remote/containers/non-root.
38+
"remoteUser": "blues"
39+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: 'Load note-c CI Docker image'
2+
runs:
3+
using: 'composite'
4+
steps:
5+
- name: Set up Docker Buildx
6+
uses: docker/setup-buildx-action@v2
7+
8+
- name: Download image artifact
9+
uses: actions/download-artifact@v3
10+
with:
11+
name: note_c_ci_image
12+
path: /tmp
13+
14+
- name: Load Docker image
15+
shell: bash
16+
run: |
17+
docker load --input /tmp/note_c_ci_image.tar

src/note-c/.github/workflows/ci.yml

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
name: note-c CI Pipeline
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
check_dockerfile_changed:
11+
runs-on: ubuntu-latest
12+
outputs:
13+
changed: ${{ steps.filter.outputs.changed }}
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v3
18+
19+
# TODO: This is a 3rd party GitHub action from some dude. Ideally, we'd
20+
# use something more "official".
21+
- name: Check if Dockerfile changed
22+
uses: dorny/paths-filter@v2
23+
id: filter
24+
with:
25+
base: 'master'
26+
filters: |
27+
changed:
28+
- 'Dockerfile'
29+
30+
build_ci_docker_image:
31+
runs-on: ubuntu-latest
32+
needs: [check_dockerfile_changed]
33+
if: ${{ needs.check_dockerfile_changed.outputs.changed == 'true' }}
34+
35+
steps:
36+
- name: Checkout code
37+
uses: actions/checkout@v3
38+
39+
- name: Login to GitHub Container Registry
40+
uses: docker/login-action@v2
41+
with:
42+
registry: ghcr.io
43+
username: ${{ github.actor }}
44+
password: ${{ secrets.GITHUB_TOKEN }}
45+
46+
- name: Set up Docker Buildx
47+
uses: docker/setup-buildx-action@v2
48+
49+
- name: Rebuild image
50+
uses: docker/build-push-action@v4
51+
with:
52+
context: .
53+
load: true
54+
tags: ghcr.io/blues/note_c_ci:latest
55+
outputs: type=docker,dest=/tmp/note_c_ci_image.tar
56+
57+
- name: Upload image artifact
58+
uses: actions/upload-artifact@v3
59+
with:
60+
name: note_c_ci_image
61+
path: /tmp/note_c_ci_image.tar
62+
63+
build_docs:
64+
runs-on: ubuntu-latest
65+
if: ${{ always() }}
66+
needs: [build_ci_docker_image]
67+
68+
steps:
69+
- name: Checkout code
70+
uses: actions/checkout@v3
71+
72+
- name: Load CI Docker image
73+
# Only load the Docker image artifact if build_ci_docker_image actually
74+
# ran (e.g. it wasn't skipped and was successful).
75+
if: ${{ needs.build_ci_docker_image.result == 'success' }}
76+
uses: ./.github/actions/load-ci-image
77+
78+
- name: Build docs
79+
run: |
80+
docker run --rm --volume $(pwd):/note-c/ --workdir /note-c/ --entrypoint ./scripts/build_docs.sh ghcr.io/blues/note_c_ci:latest
81+
82+
check_libc_dependencies:
83+
runs-on: ubuntu-latest
84+
if: ${{ always() }}
85+
needs: [build_ci_docker_image]
86+
87+
steps:
88+
- name: Checkout code
89+
uses: actions/checkout@v3
90+
91+
- name: Load CI Docker image
92+
# Only load the Docker image artifact if build_ci_docker_image actually
93+
# ran (e.g. it wasn't skipped and was successful).
94+
if: ${{ needs.build_ci_docker_image.result == 'success' }}
95+
uses: ./.github/actions/load-ci-image
96+
97+
- name: Check note-c's libc dependencies
98+
run: |
99+
docker run --rm --volume $(pwd):/note-c/ --workdir /note-c/ --entrypoint ./scripts/check_libc_dependencies.sh ghcr.io/blues/note_c_ci:latest
100+
101+
run_unit_tests:
102+
runs-on: ubuntu-latest
103+
if: ${{ always() }}
104+
needs: [build_ci_docker_image]
105+
106+
steps:
107+
- name: Checkout code
108+
uses: actions/checkout@v3
109+
110+
- name: Load CI Docker image
111+
if: ${{ needs.build_ci_docker_image.result == 'success' }}
112+
uses: ./.github/actions/load-ci-image
113+
114+
- name: Run tests
115+
run: |
116+
docker run --rm --volume $(pwd):/note-c/ --workdir /note-c/ --entrypoint ./scripts/run_unit_tests.sh ghcr.io/blues/note_c_ci:latest --coverage --mem-check
117+
118+
- name: Adjust lcov source file paths for Coveralls
119+
run: sudo sed -i 's/\/note-c\///g' ./build/test/coverage/lcov.info
120+
121+
- name: Publish test coverage
122+
uses: coverallsapp/github-action@master
123+
with:
124+
github-token: ${{ secrets.GITHUB_TOKEN }}
125+
path-to-lcov: ./build/test/coverage/lcov.info
126+
127+
run_low_mem_unit_tests:
128+
runs-on: ubuntu-latest
129+
if: ${{ always() }}
130+
needs: [build_ci_docker_image]
131+
132+
steps:
133+
- name: Checkout code
134+
uses: actions/checkout@v3
135+
136+
- name: Load CI Docker image
137+
if: ${{ needs.build_ci_docker_image.result == 'success' }}
138+
uses: ./.github/actions/load-ci-image
139+
140+
- name: Run tests with NOTE_LOWMEM defined
141+
run: |
142+
docker run --rm --volume $(pwd):/note-c/ --workdir /note-c/ --entrypoint ./scripts/run_unit_tests.sh ghcr.io/blues/note_c_ci:latest --mem-check --low-mem --single-precision
143+
144+
run_astyle:
145+
runs-on: ubuntu-latest
146+
if: ${{ always() }}
147+
needs: [build_ci_docker_image]
148+
149+
steps:
150+
- name: Checkout Code
151+
uses: actions/checkout@v3
152+
153+
- name: Load CI Docker image
154+
if: ${{ needs.build_ci_docker_image.result == 'success' }}
155+
uses: ./.github/actions/load-ci-image
156+
157+
- name: Run astyle
158+
run: |
159+
docker run --rm --volume $(pwd):/note-c/ --workdir /note-c/ --entrypoint ./scripts/run_astyle.sh ghcr.io/blues/note_c_ci:latest
160+
161+
publish_ci_image:
162+
runs-on: ubuntu-latest
163+
# Make sure unit tests unit tests passed before publishing.
164+
needs: [build_ci_docker_image, run_unit_tests]
165+
# Only publish the image if this is a push event and the Docker image was rebuilt
166+
if: ${{ github.event_name == 'push' && needs.build_ci_docker_image.result == 'success' }}
167+
168+
steps:
169+
- name: Login to GitHub Container Registry
170+
uses: docker/login-action@v2
171+
with:
172+
registry: ghcr.io
173+
username: ${{ github.actor }}
174+
password: ${{ secrets.GITHUB_TOKEN }}
175+
176+
- name: Set up Docker Buildx
177+
uses: docker/setup-buildx-action@v2
178+
179+
- name: Push image to registry
180+
uses: docker/build-push-action@v4
181+
with:
182+
push: true
183+
tags: ghcr.io/blues/note_c_ci:latest
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: MD5 Server Tests
2+
3+
on:
4+
workflow_dispatch:
5+
workflow_call: # reusable workflow
6+
7+
jobs:
8+
test-md5srv: # job id
9+
runs-on: ubuntu-latest
10+
defaults:
11+
run:
12+
shell: bash
13+
env:
14+
TERM: xterm-256color
15+
MD5SRV_TIMEOUT: 5
16+
MD5SRV_DIR: ./test/hitl/scripts
17+
BATS_VERSION: 1.10.0
18+
BATS_LIB_PATH: /usr/lib
19+
# /usr/local/lib on OSX
20+
steps:
21+
- name: Setup Bats and bats libs
22+
uses: brokenpip3/[email protected]
23+
with:
24+
bats-install: true
25+
file-install: false
26+
detik-install: false
27+
- name: Setup BATS_LIB_PATH
28+
run: |
29+
if [ -e /usr/local/lib/bats-support ]; then
30+
echo "BATS_LIB_PATH=/usr/local/lib" >> $GITHUB_ENV
31+
fi
32+
- name: Checkout
33+
uses: actions/checkout@v3
34+
- name: Run Tests
35+
run: |
36+
cd ${{env.MD5SRV_DIR}}
37+
$HOME/.local/bin/bats -p --print-output-on-failure .
38+
- name: Rerun Tests
39+
if: failure()
40+
run: |
41+
cd ${{env.MD5SRV_DIR}}
42+
$HOME/.local/bin/bats -p --print-output-on-failure -x .

0 commit comments

Comments
 (0)