Skip to content

Merge pull request #92 from imahjoub/add-valgrind-to-ci #508

Merge pull request #92 from imahjoub/add-valgrind-to-ci

Merge pull request #92 from imahjoub/add-valgrind-to-ci #508

Workflow file for this run

# -----------------------------------------------------
# Copyright Iliass Mahjoub 2022 - 2023.
# Distributed under the Boost Software License,
# Version 1.0. (See accompanying file LICENSE_1_0.txt
# or copy at http://www.boost.org/LICENSE_1_0.txt)
# -----------------------------------------------------
name: hash_sha256
on:
push:
branches:
- '**'
pull_request:
jobs:
gcc-clang-native:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
standard: [ c++17, c++2a ]
compiler: [ g++, clang++ ]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0'
- name: gcc-clang-native
run: |
echo "gcc-clang-native"
echo "${{ matrix.compiler }} -Werror -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -O3 -std=${{ matrix.standard }} hash_sha256_test.cpp -DHASH_HASH256_PC -I. -o hash_sha256.exe"
${{ matrix.compiler }} -Werror -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -O3 -std=${{ matrix.standard }} hash_sha256_test.cpp -DHASH_HASH256_PC -I. -o hash_sha256.exe
echo "ls ./hash_sha256.exe"
ls -la ./hash_sha256.exe
./hash_sha256.exe
apple-gcc-clang-native:
runs-on: macos-latest
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
standard: [ c++17, c++2a ]
compiler: [ g++, clang++ ]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0'
- name: apple-gcc-clang-native
run: |
echo "apple-gcc-clang-native"
echo "${{ matrix.compiler }} -Werror -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -O3 -std=${{ matrix.standard }} hash_sha256_test.cpp -DHASH_HASH256_PC -I. -o hash_sha256.exe"
${{ matrix.compiler }} -Werror -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -O3 -std=${{ matrix.standard }} hash_sha256_test.cpp -DHASH_HASH256_PC -I. -o hash_sha256.exe
echo "ls ./hash_sha256.exe"
ls -la ./hash_sha256.exe
./hash_sha256.exe
msvc-release-x64:
runs-on: windows-2022
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0'
- uses: ilammy/msvc-dev-cmd@v1
- name: msvc-release-x64
shell: cmd
run: |
set INCLUDE=%cd%;%INCLUDE%
set CL=/DHASH_HASH256_PC
MSBuild -m hash_sha256.sln -p:useenv=true -p:Configuration=Release -p:Platform=x64 /t:Rebuild
dir %cd%\Out\Bin\Release\hash_sha256.exe
%cd%\Out\Bin\Release\hash_sha256.exe
gnumake-clang-tidy-12-native:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
standard: [ c++20 ]
compiler: [ g++, clang++ ]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0'
- name: update-tools
run:
sudo apt install clang clang-tidy
- name: gnumake-clang-tidy-12-native
run: |
echo "+++ print clang-tidy version"
clang-tidy --version
echo "+++ running clang-tidy"
clang-tidy -checks="*,-cppcoreguidelines-avoid-magic-numbers,-readability-magic-numbers,-llvm-header-guard,-cppcoreguidelines-pro-bounds-constant-array-index,-fuchsia-trailing-return,-readability-identifier-naming" hash_sha256_test.cpp -- -I. -DHASH_HASH256_PC
stm32f429-qemu:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0'
- name: update-tools
run: |
sudo apt install libncurses5 libpython2.7
mkdir -p emu_env && cd emu_env
wget --no-check-certificate https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/10.3-2021.10/gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2
tar -xvf gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2
wget --no-check-certificate https://github.com/xpack-dev-tools/qemu-arm-xpack/releases/download/v2.8.0-13/xpack-qemu-arm-2.8.0-13-linux-x64.tar.gz
tar -xvzf xpack-qemu-arm-2.8.0-13-linux-x64.tar.gz
working-directory: .
- name: build-hash_sha256-stm32f429
run: |
mkdir -p bin
emu_env/gcc-arm-none-eabi-10.3-2021.10/bin/arm-none-eabi-g++ -std=c++20 -Wall -Wextra -pedantic -O0 -g -gdwarf-2 -ffunction-sections -DHASH_HASH256_QEMU -fdata-sections -x c++ -fno-rtti -fno-use-cxa-atexit -fno-exceptions -fno-nonansi-builtins -fno-threadsafe-statics -fno-enforce-eh-specs -ftemplate-depth=32 -mcpu=cortex-m4 -mtune=cortex-m4 -mthumb -mfloat-abi=soft -mno-unaligned-access -mno-long-calls -I. hash_sha256_test.cpp ./qemu_build/stm32f429_startup.cpp -nostartfiles -Wl,--gc-sections -Wl,-Map,./bin/hash_sha256_test.map -T ./qemu_build/stm32f429.ld --specs=nano.specs --specs=nosys.specs -o ./bin/hash_sha256_test.elf
emu_env/gcc-arm-none-eabi-10.3-2021.10/bin/arm-none-eabi-objcopy ./bin/hash_sha256_test.elf -O ihex ./bin/hash_sha256_test.hex
ls -la ./bin/hash_sha256_test.elf ./bin/hash_sha256_test.hex ./bin/hash_sha256_test.map
working-directory: .
- name: emulate-target-stm32f429
run: |
./emu_env/xpack-qemu-arm-2.8.0-13/bin/qemu-system-gnuarmeclipse --verbose --mcu STM32F429ZI --nographic --gdb tcp::9999 -d unimp,guest_errors &
working-directory: .
- name: run-test-on-target
run: |
./emu_env/gcc-arm-none-eabi-10.3-2021.10/bin/arm-none-eabi-gdb-py ./bin/hash_sha256_test.elf -x ./qemu_build/test_hash_sha256_emulator.py
qemu_result=$?
echo "qemu_result" "$qemu_result"
echo "qemu_result" "$qemu_result" | grep 'qemu_result 0'
working-directory: .
valgrind-check:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
standard: [ c++2a ]
compiler: [ g++-12]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: '0'
- name: update-tools
run: sudo apt-get install g++-12 valgrind
- name: valgrind-check
run: |
echo "+++ compile"
${{ matrix.compiler }} -v
${{ matrix.compiler }} -m64 -Werror -Wall -Wextra -Wpedantic -Wconversion -Wsign-conversion -O3 -std=${{ matrix.standard }} hash_sha256_test.cpp -DHASH_HASH256_PC -I. -o hash_sha256.exe
echo "+++ run valgrind"
valgrind --leak-check=yes --log-file=hash_sha256_valgrind.txt ./hash_sha256.exe
grep '0 bytes in 0 blocks' hash_sha256_valgrind.txt
grep '0 errors from 0 contexts' hash_sha256_valgrind.txt