Skip to content

Commit f36f80f

Browse files
committed
feat: Incorporate GitHub Actions CI
1 parent 1164324 commit f36f80f

File tree

6 files changed

+55
-31
lines changed

6 files changed

+55
-31
lines changed

test/Dockerfile renamed to .github/actions/run-tests-in-container/Dockerfile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,18 @@
33
# Build development environment
44
# $ docker build . --tag nes-rob-test
55

6-
# Launch development environment
7-
# $ docker run --rm --volume $(pwd)/..:/nes-rob/ nes-rob-test
6+
# Launch development environment (mount source root as /nes-rob/)
7+
# $ docker run --rm --volume $(pwd)/../../../:/nes-rob/ --workdir /nes-rob/ nes-rob-test
88

99
# Base Image
1010
FROM alpine
1111

12-
# Yarn Install Requirements
12+
# Testing Dependencies
1313
RUN ["ash", "-c", "\
1414
apk add --no-cache \
1515
gcovr \
1616
g++ \
1717
valgrind \
1818
"]
1919

20-
WORKDIR /nes-rob/test/
21-
CMD ["./run_all_tests.sh"]
20+
ENTRYPOINT ["./test/run_all_tests.sh"]
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
name: 'Containerized Test'
2+
author: 'Zachary J. Fields'
3+
description: 'Perform unit-test in containerized environment'
4+
runs:
5+
using: 'docker'
6+
image: 'Dockerfile'

.github/workflows/nes-rob-ci.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: NES R.O.B. CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
validate_code: # job id
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout Code
14+
id: checkout
15+
uses: actions/checkout@v2
16+
with:
17+
submodules: true
18+
- name: Run Tests In Container
19+
id: containerized_tests
20+
uses: ./.github/actions/run-tests-in-container

docs/Dockerfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ FROM alpine
1616
COPY .gitconfig /root/
1717
COPY .netrc /root/
1818

19-
# Yarn Install Requirements
19+
# Install Dependencies
2020
RUN ["ash", "-c", "\
2121
apk add --no-cache \
2222
doxygen \
@@ -25,7 +25,5 @@ RUN ["ash", "-c", "\
2525
ttf-freefont \
2626
"]
2727

28-
WORKDIR /nes-rob/
29-
3028
# Remove and Rebuild Documentation
3129
CMD ["/nes-rob/docs/.publish-gh-pages.sh"]

docs/readme.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,19 +101,20 @@ Running Tests
101101
-------------
102102
103103
The tests are designed to be executed using Docker, and the environment required
104-
by the tests is defined in `test/Dockerfile`. The following directions are
105-
provided to aid in executing the tests in a container.
104+
by the tests is defined in `.github/actions/run-tests-in-container/Dockerfile`.
105+
The following directions are provided to aid in executing the tests in
106+
a container.
106107
107108
1. From the `nes-rob` folder, build the container with the following command:
108109
109110
```none
110-
docker build test --tag nes-rob-test
111+
docker build .github/actions/run-tests-in-container/ --tag nes-rob-test
111112
```
112113

113114
2. Execute the tests inside the container using the following command:
114115

115116
```none
116-
docker run --rm --volume $(pwd):/nes-rob/ nes-rob-test
117+
docker run --rm --volume $(pwd):/nes-rob/ --workdir /nes-rob/ nes-rob-test
117118
```
118119

119120
3. Similar test results should print to your terminal for review.

test/run_all_tests.sh

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
#!/bin/sh
22

3-
g++ -fprofile-arcs -ftest-coverage -Wall -Wpedantic -O0 -g \
4-
NesRob.test.cpp \
5-
signal_generator.test.cpp \
6-
../src/signal_generator.cpp \
7-
../src/signal_generator_error.cpp \
8-
led_ntsc_driver.test.cpp \
9-
../src/led_ntsc_driver.cpp \
10-
w_wave_driver.test.cpp \
11-
../src/w_wave_driver.cpp \
12-
../src/pulse_driver_error.cpp \
13-
../src/hal_error.cpp \
14-
-I. \
15-
-I ../src/ \
16-
-I Catch2/single_include/ \
17-
-I FakeIt/single_header/catch/ \
18-
-DRUN_ALL_TESTS \
19-
-o nes_rob_tests \
20-
&& valgrind ./nes_rob_tests \
3+
g++ -fprofile-arcs -ftest-coverage -Wall -Wpedantic -std=c++11 -O0 -g \
4+
test/NesRob.test.cpp \
5+
test/signal_generator.test.cpp \
6+
src/signal_generator.cpp \
7+
src/signal_generator_error.cpp \
8+
test/led_ntsc_driver.test.cpp \
9+
src/led_ntsc_driver.cpp \
10+
test/w_wave_driver.test.cpp \
11+
src/w_wave_driver.cpp \
12+
src/pulse_driver_error.cpp \
13+
src/hal_error.cpp \
14+
-I src/ \
15+
-I test/ \
16+
-I test/Catch2/single_include/ \
17+
-I test/FakeIt/single_header/catch/ \
18+
-DRUN_ALL_TESTS \
19+
-o nes_rob_tests \
20+
&& valgrind --leak-check=full --error-exitcode=66 ./nes_rob_tests \
2121
&& gcovr --print-summary --sort-percentage --exclude-throw-branches --delete \
2222
--object-directory . \
23-
--root ../src \
23+
--root src \
2424
--exclude .*_error.* \
2525
&& rm nes_rob_tests *.gcno

0 commit comments

Comments
 (0)