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

Add: cross-build test for windows using LLVM-MinGW in Ubuntu. #288

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 75 additions & 2 deletions .github/workflows/github_actions_build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Build

on: [push, pull_request]
on: [push, pull_request, workflow_dispatch]

jobs:
buildUbuntu:
Expand All @@ -26,7 +26,7 @@ jobs:
make CLANG=Y demos

buildWindows:
runs-on: windows-2022
runs-on: windows-latest

steps:
- uses: actions/checkout@master
Expand All @@ -40,3 +40,76 @@ jobs:
cd ..\vt
nmake CHTYPE_32=Y -f Makefile.vc demos
shell: cmd

XbuildWindows:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- { name: VT_W32, arch: _w32, ENV: vt, UTF8: N, PREFIX: i686-w64-mingw32 }
- { name: WINCON_W32, arch: _w32, ENV: wincon, UTF8: N, PREFIX: i686-w64-mingw32 }
- { name: WINGUI_W32, arch: _w32, ENV: wingui, UTF8: N, PREFIX: i686-w64-mingw32 }
- { name: SDL2_W32, arch: _w32, ENV: sdl2, UTF8: N, PREFIX: i686-w64-mingw32 }
- { name: VT_W64, arch: _w64, ENV: vt, UTF8: N, PREFIX: x86_64-w64-mingw32 }
- { name: WINCON_W64, arch: _w64, ENV: wincon, UTF8: N, PREFIX: x86_64-w64-mingw32 }
- { name: WINGUI_W64, arch: _w64, ENV: wingui, UTF8: N, PREFIX: x86_64-w64-mingw32 }
- { name: SDL2_W64, arch: _w64, ENV: sdl2, UTF8: N, PREFIX: x86_64-w64-mingw32 }
- { name: VT_WoA, arch: _a64, ENV: vt, UTF8: N, PREFIX: aarch64-w64-mingw32 }
- { name: WINCON_WoA, arch: _a64, ENV: wincon, UTF8: N, PREFIX: aarch64-w64-mingw32 }
- { name: WINGUI_WoA, arch: _a64, ENV: wingui, UTF8: N, PREFIX: aarch64-w64-mingw32 }
- { name: VT_W32_UTF8, arch: _w32, ENV: vt, UTF8: Y, PREFIX: i686-w64-mingw32 }
- { name: WINCON_W32_UTF8, arch: _w32, ENV: wincon, UTF8: Y, PREFIX: i686-w64-mingw32 }
- { name: WINGUI_W32_UTF8, arch: _w32, ENV: wingui, UTF8: Y, PREFIX: i686-w64-mingw32 }
- { name: SDL2_W32_UTF8, arch: _w32, ENV: sdl2, UTF8: Y, PREFIX: i686-w64-mingw32 }
- { name: VT_W64_UTF8, arch: _w64, ENV: vt, UTF8: Y, PREFIX: x86_64-w64-mingw32 }
- { name: WINCON_W64_UTF8, arch: _w64, ENV: wincon, UTF8: Y, PREFIX: x86_64-w64-mingw32 }
- { name: WINGUI_W64_UTF8, arch: _w64, ENV: wingui, UTF8: Y, PREFIX: x86_64-w64-mingw32 }
- { name: SDL2_W64_UTF8, arch: _w64, ENV: sdl2, UTF8: Y, PREFIX: x86_64-w64-mingw32 }
- { name: VT_WoA_UTF8, arch: _a64, ENV: vt, UTF8: Y, PREFIX: aarch64-w64-mingw32 }
- { name: WINCON_WoA_UTF8, arch: _a64, ENV: wincon, UTF8: Y, PREFIX: aarch64-w64-mingw32 }
- { name: WINGUI_WoA_UTF8, arch: _a64, ENV: wingui, UTF8: Y, PREFIX: aarch64-w64-mingw32 }
steps:
- uses: actions/checkout@master
- name: ${{ matrix.name }}
shell: bash
run: |
## download llvm-MinGW
assetsUrl=$(wget -qO- https://github.com/mstorsjo/llvm-mingw/releases/latest | grep "expanded_assets" | grep -Po 'https[^"]+')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

downloading each time seems too much, as far as I remember there's an option to store and re-use later

Copy link
Contributor Author

@okibcn okibcn Mar 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It really doesn't matter, the source is in github, so it is as fast as using caches. Using caches is the method you mention, but it needs to download it no matter what as github store caches internally in .tar.xz format. So it won't be any faster.

I am using that method for nano for windows but for another reason. I use an optimized version of LLVM-MinGW there using musl under Alpine. So, I had to build my own tweaked version. I refresh the cache every week as it takes about 4 hours to build all the tools for all the environments.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It really doesn't matter, the source is in github, so it is as fast as using caches.

Just out of interest: Do you have any docs that the "storage on github" is identical between the release artifacts and the caches? The first is reasonable to be kept with a CDN, while it makes more sense to keep the cache "as near as possible" to its single using worker(s).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checking back again - using caches (which also allows to check its state and drop the cache if necessary) really seems to be preferable. Please modify and we can pull this in.

pkgUrl="http://github.com$(wget -qO- $assetsUrl | grep 'href.*ucrt.*x86_64.tar.xz' | grep -Po '/[^"]+')"
wget -qO- $pkgUrl | tar -Jxvf -
mv llvm* llvm-mingw
LLVMBASE="$(pwd)/llvm-mingw"

if [[ "${{ matrix.ENV }}" == "sdl2" ]]; then
## download SDL2
assetsUrl=$(wget -qO- https://github.com/libsdl-org/SDL/releases/latest | grep "expanded_assets" | grep -Po 'https[^"]+')
pkgUrl="http://github.com$(wget -qO- $assetsUrl | grep 'href.*mingw.tar.gz' | grep -Po '/[^"]+')"
wget -qO- $pkgUrl | tar xzvf -
mv SDL2-* SDL2-dev
export SDLBASE="$(pwd)/SDL2-dev"
cp $SDLBASE/${{ matrix.PREFIX }}/bin/*.dll sdl2

## download SDL2_ttf
assetsUrl=$(wget -qO- https://github.com/libsdl-org/SDL_ttf/releases/latest | grep "expanded_assets" | grep -Po 'https[^"]+')
pkgUrl="http://github.com$(wget -qO- $assetsUrl | grep 'href.*mingw.tar.gz' | grep -Po '/[^"]+')"
wget -qO- $pkgUrl | tar xzvf -
mv SDL2_ttf* SDL2_ttf-dev
export TTFBASE="$(pwd)/SDL2_ttf-dev"
cp $TTFBASE/${{ matrix.PREFIX }}/bin/*.dll sdl2

export PATH="$SDLBASE/${{ matrix.PREFIX }}/bin:$TTFBASE/${{ matrix.PREFIX }}/bin:$PATH"
fi

export PATH="$LLVMBASE/bin:$PATH"

cd ${{ matrix.ENV }}
[[ "${{ matrix.UTF8 }}" == "Y" ]] && make -j$(nproc) demos ${{ matrix.ARCH }}=Y WIDE=Y UTF8=Y || make -j$(nproc) demos ${{ matrix.ARCH }}=Y
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for adding UTF8/non-wide.

But actually there are three options:

  • UTF8=Y (implies WIDE=Y)
  • WIDE=Y (with the default UTF8=N)
  • WIDE=N (the default)

Can you please add the missing option (second one) to the build matrix?


- name: "Upload Artifact"
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.name }}
path: |
${{ matrix.ENV }}/*.exe
${{ matrix.ENV }}/*.dll