skypjack / uvw

Header-only, event based, tiny and easy to use libuv wrapper in modern C++ - now available as also shared/static library!
MIT License
1.82k stars 207 forks source link

set workflows with only default compiler packages #271

Closed stefanofiorentino closed 1 year ago

stefanofiorentino commented 1 year ago

Closes #270

Signed-off-by: Fiorentino, Stefano stefano.fiorentino@adesso.ch

skypjack commented 1 year ago

I'm not opposed to just reducing the number of compilers used on the CI actually. 🙂 The other option around is to use something like this instead (from EnTT, to adapt to uvw in case):

  linux:
    timeout-minutes: 15

    strategy:
      matrix:
        os: [ubuntu-latest, ubuntu-20.04]
        compiler:
          - { pkg: g++, exe: 'g++', version: 7 }
          - { pkg: g++, exe: 'g++', version: 8 }
          - { pkg: g++, exe: 'g++', version: 9 }
          - { pkg: g++, exe: 'g++', version: 10 }
          - { pkg: g++, exe: 'g++', version: 11 }
          - { pkg: g++, exe: 'g++', version: 12 }
          - { pkg: clang, exe: 'clang++', version: 8 }
          - { pkg: clang, exe: 'clang++', version: 9 }
          - { pkg: clang, exe: 'clang++', version: 10 }
          - { pkg: clang, exe: 'clang++', version: 11 }
          - { pkg: clang, exe: 'clang++', version: 12 }
          - { pkg: clang, exe: 'clang++', version: 13 }
          - { pkg: clang, exe: 'clang++', version: 14 }
        exclude:
          - os: ubuntu-latest
            compiler: { pkg: g++, exe: 'g++', version: 7 }
          - os: ubuntu-latest
            compiler: { pkg: g++, exe: 'g++', version: 8 }
          - os: ubuntu-latest
            compiler: { pkg: g++, exe: 'g++', version: 9 }
          - os: ubuntu-latest
            compiler: { pkg: clang, exe: 'clang++', version: 8 }
          - os: ubuntu-latest
            compiler: { pkg: clang, exe: 'clang++', version: 9 }
          - os: ubuntu-latest
            compiler: { pkg: clang, exe: 'clang++', version: 10 }
          - os: ubuntu-latest
            compiler: { pkg: clang, exe: 'clang++', version: 11 }
          - os: ubuntu-20.04
            compiler: { pkg: g++, exe: 'g++', version: 10 }
          - os: ubuntu-20.04
            compiler: { pkg: g++, exe: 'g++', version: 11 }
          - os: ubuntu-20.04
            compiler: { pkg: g++, exe: 'g++', version: 12 }
          - os: ubuntu-20.04
            compiler: { pkg: clang, exe: 'clang++', version: 12 }
          - os: ubuntu-20.04
            compiler: { pkg: clang, exe: 'clang++', version: 13 }
          - os: ubuntu-20.04
            compiler: { pkg: clang, exe: 'clang++', version: 14 }

    runs-on: ${{ matrix.os }}

    steps:
    - uses: actions/checkout@v3
    - name: Install compiler
      run: |
        sudo apt update
        sudo apt install -y ${{ matrix.compiler.pkg }}-${{ matrix.compiler.version }}
    - name: Compile tests
      working-directory: build
      env:
        CXX: ${{ matrix.compiler.exe }}-${{ matrix.compiler.version }}
      run: |
        cmake -DENTT_BUILD_TESTING=ON -DENTT_BUILD_LIB=ON -DENTT_BUILD_EXAMPLE=ON ..
        make -j4
    - name: Run tests
      working-directory: build
      env:
        CTEST_OUTPUT_ON_FAILURE: 1
      run: ctest --timeout 30 -C Debug -j4

It literally drops the compilers that aren't available on the specific platform. More cumbersome but it's a single shot, not a big issue.

skypjack commented 1 year ago

I think in our case it would be something along this line:

  linux:
    timeout-minutes: 60

    strategy:
      matrix:
        mode: [-DBUILD_UVW_SHARED_LIB=ON, -DBUILD_UVW_LIBS=ON, -DBUILD_UVW_LIBS=OFF]
        os: [ubuntu-latest, ubuntu-20.04]
        compiler:
          - { pkg: g++, exe: 'g++', version: 7 }
          - { pkg: g++, exe: 'g++', version: 8 }
          - { pkg: g++, exe: 'g++', version: 9 }
          - { pkg: g++, exe: 'g++', version: 10 }
          - { pkg: g++, exe: 'g++', version: 11 }
          - { pkg: g++, exe: 'g++', version: 12 }
          - { pkg: clang, exe: 'clang++', version: 8 }
          - { pkg: clang, exe: 'clang++', version: 9 }
          - { pkg: clang, exe: 'clang++', version: 10 }
          - { pkg: clang, exe: 'clang++', version: 11 }
          - { pkg: clang, exe: 'clang++', version: 12 }
          - { pkg: clang, exe: 'clang++', version: 13 }
          - { pkg: clang, exe: 'clang++', version: 14 }
        exclude:
          - os: ubuntu-latest
            compiler: { pkg: g++, exe: 'g++', version: 7 }
          - os: ubuntu-latest
            compiler: { pkg: g++, exe: 'g++', version: 8 }
          - os: ubuntu-latest
            compiler: { pkg: g++, exe: 'g++', version: 9 }
          - os: ubuntu-latest
            compiler: { pkg: clang, exe: 'clang++', version: 8 }
          - os: ubuntu-latest
            compiler: { pkg: clang, exe: 'clang++', version: 9 }
          - os: ubuntu-latest
            compiler: { pkg: clang, exe: 'clang++', version: 10 }
          - os: ubuntu-latest
            compiler: { pkg: clang, exe: 'clang++', version: 11 }
          - os: ubuntu-20.04
            compiler: { pkg: g++, exe: 'g++', version: 10 }
          - os: ubuntu-20.04
            compiler: { pkg: g++, exe: 'g++', version: 11 }
          - os: ubuntu-20.04
            compiler: { pkg: g++, exe: 'g++', version: 12 }
          - os: ubuntu-20.04
            compiler: { pkg: clang, exe: 'clang++', version: 12 }
          - os: ubuntu-20.04
            compiler: { pkg: clang, exe: 'clang++', version: 13 }
          - os: ubuntu-20.04
            compiler: { pkg: clang, exe: 'clang++', version: 14 }

    runs-on: ${{ matrix.os }}

    steps:
    - uses: actions/checkout@v3
    - name: Install compiler
      run: |
        sudo apt update
        sudo apt install -y ${{ matrix.compiler.pkg }}-${{ matrix.compiler.version }}
    - name: Compile tests
      working-directory: build
      env:
        CXX: ${{ matrix.compiler.exe }}-${{ matrix.compiler.version }}
      run: |
        cmake ${{ matrix.mode }} -DBUILD_TESTING=ON -Dlibuv_buildtests=OFF ..
        make -j2
    - name: Run tests
      working-directory: build
      env:
        CTEST_OUTPUT_ON_FAILURE: 1
      run: ctest --timeout 5 -C Debug -j2
skypjack commented 1 year ago

Cool, thanks. My only doubt is about the g++ lines. The version is defined in a way for ubuntu 20.something and in a completely different way for ubuntu latest. Is it ok? It looks... odd, at least.

stefanofiorentino commented 1 year ago

It looks... odd, at least.

Sorry it was an experiment, sort of.. I was trying to address the "required" checks but it looks like they are outdated too. Now the files should be fine. I repeat myself, I'll use this style in other repos, but it doesn't mean you should agree on using them here ;) once approved, or overriden by the one proposed by you, I'll just cherry-pick this (squashed) and proceed with meta-uvw

stefanofiorentino commented 1 year ago

The automatic checks are now only blocked by outdated requirement on "required" workflows. For example: image Let me know if I have to add/modify something to have this approved.

stefanofiorentino commented 1 year ago

Thank you a lot for this! ❤️

Thank you to you. I cannot merge because of missing "required" workflow checks, though.