Skip to content

Commit

Permalink
Update Github Actions CI script to be more compact
Browse files Browse the repository at this point in the history
Signed-off-by: Anjan Roy <[email protected]>
  • Loading branch information
itzmeanjan committed Dec 3, 2024
1 parent d03abe7 commit a7381fe
Showing 1 changed file with 46 additions and 27 deletions.
73 changes: 46 additions & 27 deletions .github/workflows/test_ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Collects inspiration from https://github.com/itzmeanjan/frodoPIR/blob/aa654db3d11384fce73086cbbd37c63e0cb30e33/.github/workflows/test_ci.yml
name: Test Ascon LwC Cipher Suite
# Taken from https://github.com/itzmeanjan/ml-kem/blob/61cf680b1c0e2590bd7b650c07cd477e90cab46d/.github/workflows/test_ci.yml
name: Test Ascon LwC Cipher Suite i.e. NIST SP 800-232

on:
push:
Expand All @@ -16,30 +16,49 @@ jobs:
compiler: [g++, clang++]
build_type: [debug, release]
test_type: [standard, asan, ubsan]
max-parallel: 4

steps:
- uses: actions/checkout@v4
- name: Setup Google-Test
run: |
pushd ~
git clone https://github.com/google/googletest.git -b v1.15.2
pushd googletest
mkdir build
pushd build
cmake .. -DBUILD_GMOCK=OFF
make -j
sudo make -j install
popd
popd
popd
- name: Execute Tests on ${{matrix.os}}, compiled with ${{matrix.compiler}}
if: ${{matrix.test_type == 'standard'}}
run: |
CXX=${{matrix.compiler}} make test -j
make clean
- name: Execute Tests with ${{matrix.test_type}}, in ${{matrix.build_type}} mode, on ${{matrix.os}}, compiled with ${{matrix.compiler}}
if: ${{matrix.test_type != 'standard'}}
run: |
CXX=${{matrix.compiler}} make ${{matrix.build_type}}_${{matrix.test_type}}_test -j
make clean
- uses: actions/checkout@v4

- name: Setup Google Test
uses: Bacondish2023/setup-googletest@v1
with:
tag: v1.15.2


- name: Build and Test (${{ matrix.compiler }}, ${{ matrix.build_type }}, ${{ matrix.test_type }})
run: |
CXX=${{ matrix.compiler }}
if [[ ${{ matrix.test_type }} == "standard" ]]; then
make test -j 2>&1 | tee build.log
else
make ${{ matrix.build_type }}_${{ matrix.test_type }}_test -j 2>&1 | tee build.log
fi
if [ $? -ne 0 ]; then
echo "Build or Test Failed! See build.log for details."
exit 1
fi
- name: Upload Build Log
uses: actions/upload-artifact@v3
with:
name: build-log-${{ matrix.compiler }}-${{ matrix.build_type }}-${{ matrix.test_type }}
path: build.log


- name: Run Examples
if: ${{ matrix.test_type == 'standard' && matrix.build_type == 'release' }}
run: |
CXX=${{ matrix.compiler }} make example -j 2>&1 | tee example.log
if [ $? -ne 0 ]; then
echo "Example execution Failed! See example.log for details."
exit 1
fi
- name: Upload Example Log (if failed)
if: ${{ steps.Run_Examples.outcome != 'success' && matrix.test_type == 'standard' && matrix.build_type == 'release' }}
uses: actions/upload-artifact@v3
with:
name: example-log-${{ matrix.compiler }}
path: example.log

0 comments on commit a7381fe

Please sign in to comment.