From 435be2295c3ed10f822cc1674a6f94f46906d52c Mon Sep 17 00:00:00 2001 From: SChernykh Date: Wed, 23 Aug 2023 09:47:27 +0200 Subject: [PATCH] Create c-cpp.yml --- .github/workflows/c-cpp.yml | 181 ++++++++++++++++++++++++++++++++++++ 1 file changed, 181 insertions(+) create mode 100644 .github/workflows/c-cpp.yml diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml new file mode 100644 index 0000000..f0ba7ea --- /dev/null +++ b/.github/workflows/c-cpp.yml @@ -0,0 +1,181 @@ +name: C/C++ CI + +on: [push, pull_request] + +jobs: + build-alpine: + + timeout-minutes: 75 + runs-on: ubuntu-22.04 + + strategy: + matrix: + config: + - {arch: x86_64} + - {arch: aarch64} + - {arch: armhf} + - {arch: armv7} + - {arch: ppc64le} + - {arch: s390x} + + steps: + - name: Setup Alpine Linux + uses: jirutka/setup-alpine@v1 + with: + arch: ${{ matrix.config.arch }} + + - name: Install dependencies + shell: alpine.sh --root {0} + run: | + apk add git cmake gcc g++ make + + - name: Checkout repository + uses: actions/checkout@v3 + with: + submodules: true + + - name: Build RandomX + shell: alpine.sh {0} + run: | + mkdir build + cd build + cmake .. + make -j$(nproc) + + - name: Run tests + shell: alpine.sh {0} + run: | + build/randomx-tests + + build-ubuntu: + + timeout-minutes: 10 + runs-on: ${{ matrix.config.os }} + + strategy: + matrix: + config: + - {os: ubuntu-20.04, c: gcc-11, cpp: g++-11} + - {os: ubuntu-22.04, c: gcc-12, cpp: g++-12} + + steps: + - name: Install dependencies + run: | + sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test + sudo apt update + sudo apt install -y git build-essential cmake ${{ matrix.config.c }} ${{ matrix.config.cpp }} + + - name: Checkout repository + uses: actions/checkout@v3 + with: + submodules: true + + - name: Build RandomX + run: | + mkdir build + cd build + cmake .. + make -j$(nproc) + + - name: Run tests + run: | + build/randomx-tests + + build-windows-msys2: + + timeout-minutes: 45 + runs-on: windows-latest + + strategy: + matrix: + config: + - {c: "gcc", cxx: "g++"} + - {c: "clang", cxx: "clang++"} + + defaults: + run: + shell: msys2 {0} + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Setup MSYS2 + uses: eine/setup-msys2@v2 + with: + update: true + install: mingw-w64-x86_64-toolchain mingw-w64-x86_64-clang mingw-w64-x86_64-lld mingw-w64-x86_64-cmake make + + - name: Build RandomX + run: | + mkdir build + cd build + cmake .. -DCMAKE_C_COMPILER=${{ matrix.config.c }} -DCMAKE_CXX_COMPILER=${{ matrix.config.cxx }} + make -j$(nproc) + + - name: Run tests + run: | + build/randomx-tests.exe + + build-windows-msbuild: + + timeout-minutes: 20 + runs-on: windows-${{ matrix.config.os }} + + strategy: + matrix: + config: + - {vs: Visual Studio 16 2019, os: 2019, msbuild: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\MSBuild\\Current\\Bin\\amd64\\"} + - {vs: Visual Studio 17 2022, os: 2022, msbuild: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\Msbuild\\Current\\Bin\\amd64\\"} + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Setup cmake + uses: lukka/get-cmake@latest + + - name: Build RandomX + run: | + mkdir build + cd build + cmake .. -G "${{ matrix.config.vs }}" + dir /s + & "${{ matrix.config.msbuild }}msbuild" -v:m /m /p:Configuration=Release RandomX.vcxproj + + - name: Run tests + run: | + build/randomx-tests.exe + + build-macos: + + timeout-minutes: 20 + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [macos-11, macos-12, macos-13] + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Install dependencies + run: HOMEBREW_NO_AUTO_UPDATE=1 brew install cmake + + - name: Build RandomX + run: | + mkdir build + cd build + cmake .. + make -j3 + + - name: Run tests + run: | + build/randomx-tests