Skip to content

Commit

Permalink
Fix nasa#289 Add RTEMS build and test workflows
Browse files Browse the repository at this point in the history
Add two workflows for building and testing cFS in both RTEMS 4.11 and 5
Add scripts folder into .github for running all unit tests inside QEMU
Use dockerhub to store docker image containing all QEMU and RTEMS
toolchain and dependencies
  • Loading branch information
nmullane committed Jul 1, 2021
1 parent 5d80736 commit 045b28e
Show file tree
Hide file tree
Showing 4 changed files with 282 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/scripts/log_failed_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh
cd build/exe/cpu1

rm failed-tests.txt
rm bug-summary.txt
for i in log*.txt; do \
log_name=${i%%.txt}
test_name=${log_name##log-}
if grep -n -E "(FAIL|MIR|TTF|N\/A)::[1-9]" $i > 0; then
echo $test_name >> failed-tests.txt
grep -E "(FAIL|MIR|TTF|N\/A)::[1-9]" $i >> failed-tests.txt
fi
if grep -n "*BUG*" $i > 0; then
echo $test_name >> bug-summary.txt
grep "*BUG*" $i >> bug-summary.txt;
fi
done
# Return to initial directory
cd ../../../
17 changes: 17 additions & 0 deletions .github/scripts/qemu_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
cd build/exe/cpu1
for i in *testrunner.exe *UT.exe *test.exe; do \
file=log-${i%%.exe}.txt
rm $file
qemu-system-i386 -m 128 -kernel $i -nographic -no-reboot -append "--console=/dev/com1 --video=off" \
| while read line
do
echo $line | tee -a $file;
echo $line | grep "Init thread idle" | while read line2
do
pkill qemu-system-
done
done
done
# Return to initial directory
cd ../../../
123 changes: 123 additions & 0 deletions .github/workflows/build-cfs-rtems4.11.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
name: Build and Test rtems 4.11 [OMIT_DEPRECATED=true]

# Run every time a new commit pushed or for pull requests
on:
push:
pull_request:

env:
OMIT_DEPRECATED: true

jobs:
#Checks for duplicate actions. Skips push actions if there is a matching or duplicate pull-request action.
check-for-duplicates:
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@master
with:
concurrent_skipping: 'same_content'
skip_after_successful_duplicate: 'true'
do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]'

build-cfs:
#Continue if check-for-duplicates found no duplicates. Always runs for pull-requests.
needs: check-for-duplicates
if: ${{ needs.check-for-duplicates.outputs.should_skip != 'true' }}
name: Build
runs-on: ubuntu-18.04
container: nmullane/qemu_rtems:4.11

strategy:
fail-fast: false
matrix:
buildtype: [debug, release]

# Set the type of machine to run on
env:
BUILDTYPE: ${{ matrix.buildtype }}
# Set home to where rtems is located
HOME: /root

steps:
# Check out the cfs bundle
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: true

# Setup the build system
- name: Copy Files
run: |
cp ./cfe/cmake/Makefile.sample Makefile
cp -r ./cfe/cmake/sample_defs sample_defs
# Make sure we are building for the correct target
echo "SET(cpu1_SYSTEM i686-rtems4.11)" >> sample_defs/targets.cmake
# Setup the build system
- name: Make Prep
run: make prep

- name: Make
run: make

test-cfs:
name: Test
runs-on: ubuntu-18.04
container: nmullane/qemu_rtems:4.11

needs: build-cfs

strategy:
fail-fast: false
matrix:
buildtype: [debug, release]

# Set the type of machine to run on
env:
BUILDTYPE: ${{ matrix.buildtype }}
ENABLE_UNIT_TESTS: true
# Set home to where rtems is located
HOME: /root


steps:
# Checks out a copy of your repository on the ubuntu-latest machine
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: true

# Setup the build system
- name: Copy Files
run: |
cp ./cfe/cmake/Makefile.sample Makefile
cp -r ./cfe/cmake/sample_defs sample_defs
# Make sure we are building for the correct target
echo "SET(cpu1_SYSTEM i686-rtems4.11)" >> sample_defs/targets.cmake
# Setup the build system
- name: Make
run: make install

- name: Test
run: .github/scripts/qemu_test.sh && .github/scripts/log_failed_tests.sh

# Archive test logs before checking for errors
- name: Archive cFS Test Artifacts
uses: actions/upload-artifact@v2
with:
name: cFS-rtems-log-summary-${{ matrix.buildtype }}
path: ./build/exe/cpu1/*.txt

- name: Check for Errors
run: |
# Check if failed-tests is empty or not
if [ -s ./build/exe/cpu1/failed-tests.txt ]; then
echo "Failing tests found:"
cat ./build/exe/cpu1/failed-tests.txt
exit -1
fi
123 changes: 123 additions & 0 deletions .github/workflows/build-cfs-rtems5.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
name: Build and Test rtems 5 [OMIT_DEPRECATED=true]

# Run every time a new commit pushed or for pull requests
on:
push:
pull_request:

env:
OMIT_DEPRECATED: true

jobs:
#Checks for duplicate actions. Skips push actions if there is a matching or duplicate pull-request action.
check-for-duplicates:
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@master
with:
concurrent_skipping: 'same_content'
skip_after_successful_duplicate: 'true'
do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]'

build-cfs:
#Continue if check-for-duplicates found no duplicates. Always runs for pull-requests.
needs: check-for-duplicates
if: ${{ needs.check-for-duplicates.outputs.should_skip != 'true' }}
name: Build
runs-on: ubuntu-18.04
container: nmullane/qemu_rtems:5

strategy:
fail-fast: false
matrix:
buildtype: [debug, release]

# Set the type of machine to run on
env:
BUILDTYPE: ${{ matrix.buildtype }}
# Set home to where rtems is located
HOME: /root

steps:
# Check out the cfs bundle
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: true

# Setup the build system
- name: Copy Files
run: |
cp ./cfe/cmake/Makefile.sample Makefile
cp -r ./cfe/cmake/sample_defs sample_defs
# Make sure we are building for the correct target
echo "SET(cpu1_SYSTEM i686-rtems5)" >> sample_defs/targets.cmake
# Setup the build system
- name: Make Prep
run: make prep

- name: Make
run: make

test-cfs:
name: Test
runs-on: ubuntu-18.04
container: nmullane/qemu_rtems:5

needs: build-cfs

strategy:
fail-fast: false
matrix:
buildtype: [debug, release]

# Set the type of machine to run on
env:
BUILDTYPE: ${{ matrix.buildtype }}
ENABLE_UNIT_TESTS: true
# Set home to where rtems is located
HOME: /root


steps:
# Checks out a copy of your repository on the ubuntu-latest machine
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: true

# Setup the build system
- name: Copy Files
run: |
cp ./cfe/cmake/Makefile.sample Makefile
cp -r ./cfe/cmake/sample_defs sample_defs
# Make sure we are building for the correct target
echo "SET(cpu1_SYSTEM i686-rtems5)" >> sample_defs/targets.cmake
# Setup the build system
- name: Make
run: make install

- name: Test
run: .github/scripts/qemu_test.sh && .github/scripts/log_failed_tests.sh

# Archive test logs before checking for errors
- name: Archive cFS Test Artifacts
uses: actions/upload-artifact@v2
with:
name: cFS-rtems-log-summary-${{ matrix.buildtype }}
path: ./build/exe/cpu1/*.txt

- name: Check for Errors
run: |
# Check if failed-tests is empty or not
if [ -s ./build/exe/cpu1/failed-tests.txt ]; then
echo "Failing tests found:"
cat ./build/exe/cpu1/failed-tests.txt
exit -1
fi

0 comments on commit 045b28e

Please sign in to comment.