Replace Makefile with CMakeLists.txt build system and optimize CI wor… #18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI - Build and Test Crypto Modules | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main ] | |
| workflow_dispatch: # Allow manual triggering | |
| jobs: | |
| build-and-test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| compiler: [g++, clang++] | |
| fail-fast: false # Continue testing other compilers even if one fails | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y build-essential clang cmake openssl bc | |
| - name: Verify build environment | |
| run: | | |
| echo "=== Build Environment Information ===" | |
| echo "Compiler: ${{ matrix.compiler }}" | |
| ${{ matrix.compiler }} --version | |
| echo "---" | |
| openssl version | |
| echo "---" | |
| bc --version | |
| echo "===================================" | |
| - name: Build project | |
| run: | | |
| # Use CMake build system with specified compiler | |
| mkdir build | |
| cd build | |
| cmake -DCMAKE_CXX_COMPILER=${{ matrix.compiler }} .. | |
| make | |
| - name: Verify binaries were created | |
| run: | | |
| ls -la build/ | |
| file build/hash build/cipher | |
| - name: Run tests | |
| run: | | |
| # Make test scripts executable (in case they weren't) | |
| chmod +x scripts/*.sh | |
| echo "Running all tests with ctest..." | |
| cd build | |
| ctest --verbose | |
| echo "✅ All tests passed successfully" | |
| - name: Clean up | |
| run: rm -rf build |