Skip to content

Commit

Permalink
Adding a continuous integration workflow for Github.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dawoodoz committed Jan 26, 2025
1 parent 85666a9 commit e083ede
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 2 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# See ci.yml.tabs for the properly indented version if you are having trouble seeing the indentation in this file.
# This version is only for Github to parse.
name: DFPSR tests
on: [push]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
architecture: [armv6, armv7, armv8, armv9, x86_32, x86_64]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Initialize
if: startsWith(matrix.architecture, 'arm')
run: |
sudo apt-get update
sudo apt-get install -y qemu-base
- name: Run tests
run: |
cd ./Source
if [[ "${{ matrix.architecture }}" == "armv6" ]]; then
qemu-system-arm -L /usr/arm-linux-gnueabi ./test.sh
elif [[ "${{ matrix.architecture }}" == "armv7" ]]; then
qemu-system-arm -L /usr/arm-linux-gnueabi ./test.sh
elif [[ "${{ matrix.architecture }}" == "armv8" ]]; then
qemu-system-aarch64 -L /usr/aarch64-linux-gnu ./test.sh
elif [[ "${{ matrix.architecture }}" == "armv9" ]]; then
qemu-system-aarch64 -L /usr/aarch64-linux-gnu ./test.sh
elif [[ "${{ matrix.architecture }}" == "x86_32" ]]; then
./test.sh
elif [[ "${{ matrix.architecture }}" == "x86_64" ]]; then
./test.sh
fi
33 changes: 33 additions & 0 deletions .github/workflows/ci.yml.tabs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Indentation adjustable version for accessible reading.
name: DFPSR tests
on: [push]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
architecture: [armv6, armv7, armv8, armv9, x86_32, x86_64]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Initialize
if: startsWith(matrix.architecture, 'arm')
run: |
sudo apt-get update
sudo apt-get install -y qemu-base
- name: Run tests
run: |
cd ./Source
if [[ "${{ matrix.architecture }}" == "armv6" ]]; then
qemu-system-arm -L /usr/arm-linux-gnueabi ./test.sh
elif [[ "${{ matrix.architecture }}" == "armv7" ]]; then
qemu-system-arm -L /usr/arm-linux-gnueabi ./test.sh
elif [[ "${{ matrix.architecture }}" == "armv8" ]]; then
qemu-system-aarch64 -L /usr/aarch64-linux-gnu ./test.sh
elif [[ "${{ matrix.architecture }}" == "armv9" ]]; then
qemu-system-aarch64 -L /usr/aarch64-linux-gnu ./test.sh
elif [[ "${{ matrix.architecture }}" == "x86_32" ]]; then
./test.sh
elif [[ "${{ matrix.architecture }}" == "x86_64" ]]; then
./test.sh
fi
12 changes: 10 additions & 2 deletions Source/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,17 @@ for file in ./test/tests/*.cpp; do
# Compile test case that defines main
echo "Compiling ${name}";
g++ ${CPP_VERSION} ${MODE} ${DEBUGGER} -c ${file} -o ${TEMP_DIR}/${base}_test.o;
if [ $? -ne 0 ]
then
exit 1
fi
# Linking with frameworks
echo "Linking ${name}";
g++ ${TEMP_DIR}/*.o ${TEMP_DIR}/*.a -lm -pthread -o ${TEMP_DIR}/application;
if [ $? -ne 0 ]
then
exit 1
fi
# Run the test case
echo "Executing ${name}";
./${TEMP_DIR}/application;
Expand All @@ -44,8 +52,8 @@ for file in ./test/tests/*.cpp; do
else
echo "Failed ${name}!";
# Re-run with a memory debugger.
gdb ./${TEMP_DIR}/application;
break;
#gdb ./${TEMP_DIR}/application;
exit 1
fi
done

0 comments on commit e083ede

Please sign in to comment.