diff --git a/.github/workflows/win.yml b/.github/workflows/win.yml new file mode 100644 index 000000000000..5cbc9bb985c1 --- /dev/null +++ b/.github/workflows/win.yml @@ -0,0 +1,94 @@ +name: Windows CI + +on: [push, pull_request] + +jobs: + linux-job: + runs-on: ubuntu-latest + container: crystallang/crystal:0.32.1 + steps: + - name: Download Crystal source + uses: actions/checkout@v2 + - name: Install LLVM + run: | + apt-get -q update; apt-get -qy install llvm-8-dev + - name: Build Crystal + run: | + make + - name: Cross-compile stdlib specs + run: | + bin/crystal build --cross-compile --target x86_64-pc-windows-msvc --exclude-warnings spec/std spec/std_spec.cr + - name: Upload compiled object + uses: actions/upload-artifact@v1 + with: + name: objs + path: std_spec.o + + windows-job: + needs: linux-job + runs-on: windows-latest + steps: + - name: Disable CRLF line ending substitution + run: | + git config --global core.autocrlf false + - name: Download Crystal source + uses: actions/checkout@v2 + - name: Enable Developer Command Prompt + uses: ilammy/msvc-dev-cmd@233eac407f2676fcb3648e3b153b48e60d003803 + - name: Cache libraries + id: cache-libs + uses: actions/cache@v1 + with: + path: libs + key: win-libs-v1 + - name: Download libgc + if: steps.cache-libs.outputs.cache-hit != 'true' + uses: actions/checkout@v2 + with: + repository: ivmai/bdwgc + ref: v7.6.4 + path: bdwgc + - name: Download libatomic_ops + if: steps.cache-libs.outputs.cache-hit != 'true' + uses: actions/checkout@v2 + with: + repository: ivmai/libatomic_ops + ref: v7.6.2 + path: bdwgc/libatomic_ops + - name: Download win32.mak + if: steps.cache-libs.outputs.cache-hit != 'true' + run: | + iwr https://gist.github.com/ynkdir/688e62f419e5374347bf/raw/d250598ddf5129addd212b8390279a01bca12706/win32.mak -OutFile bdwgc\ntwin32.mak + - name: Build libgc + if: steps.cache-libs.outputs.cache-hit != 'true' + working-directory: ./bdwgc + run: | + nmake -f NT_X64_STATIC_THREADS_MAKEFILE nodebug=1 _CL_=-DDONT_USE_USER32_DLL + - name: Download libpcre + if: steps.cache-libs.outputs.cache-hit != 'true' + run: | + iwr https://ftp.pcre.org/pub/pcre/pcre-8.42.zip -OutFile pcre.zip + Expand-Archive pcre.zip -DestinationPath . + mv pcre* pcre + - name: Build libpcre + if: steps.cache-libs.outputs.cache-hit != 'true' + working-directory: ./pcre + run: | + cmake . -G "Visual Studio 16 2019" -DBUILD_SHARED_LIBS=OFF -DPCRE_SUPPORT_UNICODE_PROPERTIES=ON -DPCRE_SUPPORT_JIT=ON -DPCRE_STATIC_RUNTIME=ON + cmake --build . --config release + - name: Gather libraries + if: steps.cache-libs.outputs.cache-hit != 'true' + run: | + mkdir libs + mv pcre/release/pcre.lib libs/pcre.lib + mv bdwgc/gc.lib libs/gc.lib + - name: Download compiled object + uses: actions/download-artifact@v1 + with: + name: objs + - name: Link the executable + run: | + cl objs\std_spec.o /Festd_spec libs\pcre.lib libs\gc.lib advapi32.lib libcmt.lib legacy_stdio_definitions.lib + - name: Run the executable + run: | + .\std_spec.exe