Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

github actions for MinGW #211

Open
VA-GS opened this issue Oct 3, 2024 · 1 comment
Open

github actions for MinGW #211

VA-GS opened this issue Oct 3, 2024 · 1 comment

Comments

@VA-GS
Copy link
Contributor

VA-GS commented Oct 3, 2024

I had a quick look after this discussion but there are a bit too many issues for me to fix them cleanly in a PR right now.

With the following change in the ci.yml:

name: CI

on: [push, pull_request]

jobs:
  build_and_test:
    name: Build & test

    strategy:
      fail-fast: false # Do not stop all jobs when one job fails.
      matrix:
        os: [macos-latest, windows-latest, ubuntu-latest]
        configuration: [release, debug]
        compiler: [default]
        include:
          - os: windows-latest
            configuration: debug
            compiler: gcc
          - os: windows-latest
            configuration: debug
            compiler: clang
          - os: windows-latest
            configuration: release
            compiler: gcc
          - os: windows-latest
            configuration: release
            compiler: clang

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

    steps:
    - uses: actions/checkout@master
      with:
        submodules: recursive
    - name: Setup premake
      uses: abel0b/setup-premake@v1

    # Install gcc and premake for MSYS2.
    - name: Setup (MSYS2 gcc)
      if: runner.os == 'Windows' && matrix.compiler == 'gcc'
      uses: msys2/setup-msys2@v2
      with:
        msystem: ucrt64
        release: false # Re-use the existing MSYS2 installation which is part of the official GitHub Actions Runner Images
        install: |
          make
          mingw-w64-ucrt-x86_64-premake
          mingw-w64-ucrt-x86_64-gcc

    # Install clang and premake for MSYS2.
    - name: Setup (MSYS2 clang)
      if: runner.os == 'Windows' && matrix.compiler == 'clang'
      uses: msys2/setup-msys2@v2
      with:
        msystem: clang64
        release: false # Re-use the existing MSYS2 installation which is part of the official GitHub Actions Runner Images
        install: |
          make
          mingw-w64-clang-x86_64-premake
          mingw-w64-clang-x86_64-clang

    # Install libsodium from apt
    - name: Setup (Linux)
      if: runner.os == 'Linux'
      run: |
        sudo apt-get install libsodium-dev
  
    # Install libsodium from brew
    - name: Setup (MacOS)
      if: runner.os == 'MacOS'
      run: brew install libsodium

    # Build with premake + make
    - name: Build (gmake)
      if: runner.os != 'Windows'
      run: |
        premake5 gmake
        make clean
        make all config=${{ matrix.configuration }}

    # Build with premake + make on MSYS2
    - name: Build (gmake)
      if: runner.os == 'Windows' && (matrix.compiler == 'gcc' || matrix.compiler == 'clang')
      shell: msys2 {0}
      run: |
        premake5 gmake
        make clean
        make all config=${{ matrix.configuration }}

    # Run the tests with sh syntax
    - name: Test (gmake)
      if: runner.os != 'Windows'
      run: ./bin/test

    # Run the tests with sh syntax on MSYS2
    - name: Test (MSYS2)
      if: runner.os == 'Windows' && (matrix.compiler == 'gcc' || matrix.compiler == 'clang')
      shell: msys2 {0}
      run: ./bin/test

    ## Windows-specific build steps
    # Set up PATH variables to point to MSBuild from at least VS 16.1 (2019)
    - name: Setup (vs2019)
      if: runner.os == 'Windows'
      uses: microsoft/[email protected]
      with:
        vs-version: '16.1.0'

    # Build with premake + msbuild
    - name: Build (vs2019)
      if: runner.os == 'Windows'
      run: |
        premake5 vs2019
        msbuild yojimbo.sln -nologo -m -t:Clean  -p:Configuration=${{ matrix.configuration }}
        msbuild yojimbo.sln -nologo -m -p:Configuration=${{ matrix.configuration }}

    # Run the tests with Powershell syntax
    - name: Test (vs2019)
      if: runner.os == 'Windows'
      run: "& ./bin/${{ matrix.configuration }}/test.exe"

Triggers some errors:

  • 'thread' attribute directive ignored [-Werror=attributes] for gcc on Windows
  • error: unknown attribute 'thread' ignored [-Werror,-Wunknown-attributes] for clang on Windows
  • unknown-pragmas for both due to the usage of #pragma comment( lib, "WS2_32.lib" )

I did not try to fix those cleanly in the premake5 as I integrated yojimbo in my own CMake instead. The changes I had to do there are some extra "-Wno-" for the above and a few more issues and linking against ws2_32 and Qwave from the CMake instead of by pragma.

@VA-GS
Copy link
Contributor Author

VA-GS commented Oct 3, 2024

For the thread attribute, it might work with the latest libsodium as I see a change around that in randombytes_internal_random.c.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant