From 08578c9a48a95125ec9fdaffd6ffc1cafe751853 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Wed, 16 Oct 2024 09:46:14 +1300 Subject: [PATCH] CI: added some "basic" GitHub Actions. --- .github/workflows/ci.yml | 103 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..2d24cc009 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,103 @@ +name: CI + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + workflow_dispatch: + +jobs: + cpp: + name: ${{ matrix.name }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - name: 'Windows static (B&T)' + os: windows-latest + build_shared: OFF + unit_tests: ON + set_path: $env:Path="C:\libxml2\bin;C:\zlib\bin;"+$env:Path + additional_cmake_options: -DLIBXML2_INCLUDE_DIR="C:\libxml2\include\libxml2" -DLIBXML2_LIBRARY="C:\libxml2\lib\libxml2.lib" -DZLIB_INCLUDE_DIR="C:\zlib\include" -DZLIB_LIBRARY="C:\zlib\lib\z_dll.lib" + - name: 'Windows shared (B&T)' + os: windows-latest + build_shared: ON + unit_tests: ON + set_path: $env:Path="C:\libxml2\bin;C:\zlib\bin;"+$env:Path + additional_cmake_options: -DLIBXML2_INCLUDE_DIR="C:\libxml2\include\libxml2" -DLIBXML2_LIBRARY="C:\libxml2\lib\libxml2.lib" -DZLIB_INCLUDE_DIR="C:\zlib\include" -DZLIB_LIBRARY="C:\zlib\lib\z_dll.lib" + # - name: 'Linux static (B)' + # os: ubuntu-latest + # build_shared: OFF + # unit_tests: OFF + # - name: 'Linux shared (B&T)' + # os: ubuntu-latest + # build_shared: ON + # unit_tests: ON + # - name: 'macOS static (Intel) (B&T)' + # os: macos-13 + # build_shared: OFF + # unit_tests: ON + # - name: 'macOS shared (Intel) (B&T)' + # os: macos-13 + # build_shared: ON + # unit_tests: ON + # - name: 'macOS static (ARM) (B&T)' + # os: macos-latest + # build_shared: OFF + # unit_tests: ON + # - name: 'macOS shared (ARM) (B&T)' + # os: macos-latest + # build_shared: ON + # unit_tests: ON + env: + BUILDCACHE_ACCURACY: STRICT + BUILDCACHE_COMPRESS_FORMAT: ZSTD + BUILDCACHE_DEBUG: -1 + BUILDCACHE_LOG_FILE: "" + steps: + - name: Check out libCellML + uses: actions/checkout@v4 + - name: Install CMake and Ninja + uses: lukka/get-cmake@latest + - name: Install buildcache + uses: mikehardy/buildcache-action@v2 + with: + cache_key: ${{ matrix.os }}-${{ matrix.build_shared }} + - name: Configure MSVC (Windows only) + if: ${{ runner.os == 'Windows' }} + uses: ilammy/msvc-dev-cmd@v1 + - name: Install libxml2 (Windows only) + if: ${{ runner.os == 'Windows' }} + shell: cmd + run: | + C: + curl -s -L -O https://github.com/cellml/gha/releases/download/gha/libxml2.zip + 7z x libxml2.zip -olibxml2 + - name: Install zlib (Windows only) + if: ${{ runner.os == 'Windows' }} + shell: cmd + run: | + C: + curl -s -L -O https://github.com/cellml/gha/releases/download/gha/zlib.zip + 7z x zlib.zip -ozlib + - name: Configure libCellML + run: | + mkdir build + cd build + ${{ matrix.set_path }} + dir C:\ + dir C:/zlib + dir C:/zlib/lib + dir C:/zlib/lib/z_dll.lib + cmake -G Ninja -DBINDINGS_PYTHON=OFF -DBUILD_SHARED=${{ matrix.build_shared }} -DCOVERAGE=OFF -DLLVM_COVERAGE=OFF -DMEMCHECK=OFF -DUNIT_TESTS=${{ matrix.unit_tests }} ${{ matrix.additional_cmake_options }} .. + - name: Build libCellML + run: | + cd build + ninja + - name: Unit testing + if: ${{ matrix.unit_tests == 'ON' }} + run: | + cd build + ninja test