Skip to content

Commit

Permalink
Fix #289 Add RTEMS build and test worflows
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

Address PR comments by jphickey:
  Remove monitoring of stdout by correctly using batch-mode option
  Correctly use make SIMULATION variable instead of manually modifying
  targets.cmake during the actions workflow.

Address PR comments by zanzaben:
  Remove forgotten targets.cmake target system
  • Loading branch information
nmullane committed Jul 14, 2021
1 parent 5d80736 commit 16ed8f6
Show file tree
Hide file tree
Showing 4 changed files with 281 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 ../../../
20 changes: 20 additions & 0 deletions .github/scripts/qemu_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash
cd build/exe/cpu1

# Create disk image for tests to use
qemu-img create -f qcow2 qemu_test_disk.cow 1G

for i in *testrunner.exe *UT.exe *test.exe; do \
file=log-${i%%.exe}.txt
rm $file
qemu-system-i386 -no-reboot -display none \
-kernel $i \
-append '--batch-mode --console=/dev/com1' \
-drive file=qemu_test_disk.cow,format=qcow2 \
-device i82557b,netdev=net0,mac=00:04:9F:00:27:61 \
-netdev user,id=net0 \
-serial file:qemu_serial_out.tmp;
mv -v qemu_serial_out.tmp $file
done
# Return to initial directory
cd ../../../
121 changes: 121 additions & 0 deletions .github/workflows/build-cfs-rtems4.11.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
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
# Setup the build system
- name: Make Prep
run: make SIMULATION=i686-rtems4.11 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
# Setup the build system
- name: Make
run: |
make SIMULATION=i686-rtems4.11 prep
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
121 changes: 121 additions & 0 deletions .github/workflows/build-cfs-rtems5.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
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
# Setup the build system
- name: Make Prep
run: make SIMULATION=i686-rtems5 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
# Setup the build system
- name: Make
run: |
make SIMULATION=i686-rtems5 prep
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 16ed8f6

Please sign in to comment.