shithub: m8c

ref: 1b79d40bcc4f50b05de0ca3982135108371a4cb5
dir: /.github/workflows/build-windows.yml/

View raw version
name: m8c win32/win64 build

on:
  push:
  pull_request:
  workflow_dispatch:

jobs:
  build-win:
    runs-on: windows-latest
    strategy:
      fail-fast: false
      matrix:
        include:
          - { sys: mingw32, env: i686, win: win32 }
          - { sys: mingw64, env: x86_64, win: win64 }
    name: ${{ matrix.win }}
    defaults:
      run:
        shell: msys2 {0}
    env:
      MINGW_ARCH: ${{ matrix.sys }}
    steps:

    - name: 'git config'
      run: git config --global core.autocrlf input
      shell: bash

    - name: 'Checkout'
      uses: actions/checkout@v4
      with:
        fetch-depth: 0

    - name: 'Setup MSYS2'
      uses: msys2/setup-msys2@v2
      with:
        msystem: ${{ matrix.sys }}
        update: true
        install: mingw-w64-${{ matrix.env }}-toolchain make mingw-w64-${{ matrix.env }}-SDL2 mingw-w64-${{ matrix.env }}-libserialport zip dos2unix
  
    - name: Set current date as env variable
      run: echo "NOW=$(date +'%Y-%m-%d')" >> $GITHUB_ENV

    - name: 'Build package'
      run: |
        make
        strip -g m8c.exe
        if [ ${{ matrix.win }} == "win32" ]
        then        
          cp /mingw32/bin/SDL2.dll .
          cp /mingw32/bin/libgcc_s_dw2-1.dll .
          cp /mingw32/bin/libserialport-0.dll .
          cp /mingw32/bin/libwinpthread-1.dll .
        else
          cp /mingw64/bin/SDL2.dll .
          cp /mingw64/bin/libserialport-0.dll .
        fi
        unix2dos README.md LICENSE AUDIOGUIDE.md
    - name: 'Upload artifact (win32)'
      if: matrix.win == 'win32'
      uses: actions/upload-artifact@v4
      with:
        name: m8c-${{ env.NOW }}-${{ matrix.win }}
        path: |
          m8c.exe
          SDL2.dll
          libserialport-0.dll
          libgcc_s_dw2-1.dll
          libwinpthread-1.dll
          gamecontrollerdb.txt
          LICENSE
          README.md
          AUDIOGUIDE.md
    - name: 'Upload artifact (win64)'
      if: matrix.win == 'win64'
      uses: actions/upload-artifact@v4
      with:
        name: m8c-${{ env.NOW }}-${{ matrix.win }}
        path: |
          m8c.exe
          SDL2.dll
          libserialport-0.dll
          gamecontrollerdb.txt
          LICENSE
          README.md
          AUDIOGUIDE.md