cmake-cosmo.yml raw

   1  # This workflow is for cmake-based build/test using Cosmo (Cosmopolitan).
   2  name: cmake cosmo
   3  
   4  on: [push, pull_request]
   5  
   6  jobs:
   7    build:
   8      name: ${{ matrix.os }} thr:${{ matrix.enable_threads }} single-obj:${{ matrix.single_obj_compilation }}
   9      runs-on: ${{ matrix.os }}
  10      timeout-minutes: 4
  11  
  12      strategy:
  13        fail-fast: false
  14  
  15        matrix:
  16          os: [ ubuntu-latest ] # TODO: macos-latest, windows-latest
  17          enable_cplusplus: [ on ]
  18          build_type: [ Debug ]
  19          disable_gc_debug: [ off ]
  20          gc_assertions: [ on ]
  21          large_config: [ on ]
  22          enable_threads: [ off ] # TODO: on
  23          enable_rwlock: [ off ]
  24          single_obj_compilation: [ off, on ]
  25          redirect_malloc: [ off ]
  26  
  27      steps:
  28      - uses: actions/checkout@v4
  29      - uses: bjia56/setup-cosmocc@main
  30        with:
  31          version: latest
  32  
  33      - name: Set reusable strings
  34        # Turn repeated input strings into step outputs.
  35        id: strings
  36        shell: bash
  37        run: |
  38          echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
  39  
  40      - name: Configure CMake targetting Cosmo
  41        run: >
  42          cmake -B ${{ steps.strings.outputs.build-output-dir }}
  43          ${{ matrix.cmake_generator_opt }}
  44          -DBUILD_SHARED_LIBS=OFF
  45          -Denable_single_obj_compilation=${{ matrix.single_obj_compilation }}
  46          -DCMAKE_C_COMPILER=cosmocc
  47          -DCMAKE_CXX_COMPILER=cosmoc++
  48          -DCMAKE_AR=`type -p cosmoar`
  49          -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
  50          -Dbuild_tests=ON
  51          -Ddisable_gc_debug=${{ matrix.disable_gc_debug }}
  52          -Denable_cplusplus=${{ matrix.enable_cplusplus }}
  53          -Denable_gc_assertions=${{ matrix.gc_assertions }}
  54          -Denable_large_config=${{ matrix.large_config }}
  55          -Denable_redirect_malloc=${{ matrix.redirect_malloc }}
  56          -Denable_rwlock=${{ matrix.enable_rwlock }}
  57          -Denable_threads=${{ matrix.enable_threads }}
  58          -Denable_werror=ON
  59          -Werror=dev
  60          -S ${{ github.workspace }}
  61  
  62      - name: Build
  63        run: >
  64          cmake --build ${{ steps.strings.outputs.build-output-dir }}
  65          --config ${{ matrix.build_type }} --verbose --parallel
  66  
  67      - name: Test
  68        working-directory: ${{ steps.strings.outputs.build-output-dir }}
  69        run: ctest --build-config ${{ matrix.build_type }} --verbose --parallel 8
  70