Skip to content

Merge branch 'master' into feat/tool-unreachable-test #2289

Merge branch 'master' into feat/tool-unreachable-test

Merge branch 'master' into feat/tool-unreachable-test #2289

Workflow file for this run

name: Windows CI
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
jobs:
x86_64-windows-libs:
runs-on: windows-2022
steps:
- name: Disable CRLF line ending substitution
run: |
git config --global core.autocrlf false
- name: Enable Developer Command Prompt
uses: ilammy/msvc-dev-cmd@cec98b9d092141f74527d0afa6feb2af698cfe89 # v1.12.1
- name: Download Crystal source
uses: actions/checkout@v4
- name: Cache libraries
id: cache-libs
uses: actions/cache@v3
with:
path: | # openssl and llvm take much longer to build so they are cached separately
libs/pcre.lib
libs/pcre2-8.lib
libs/iconv.lib
libs/gc.lib
libs/ffi.lib
libs/z.lib
libs/mpir.lib
libs/yaml.lib
libs/xml2.lib
key: win-libs-${{ hashFiles('.github/workflows/win.yml', 'etc/win-ci/*.ps1') }}-msvc
- name: Build libgc
if: steps.cache-libs.outputs.cache-hit != 'true'
run: .\etc\win-ci\build-gc.ps1 -BuildTree deps\gc -Version 8.2.2 -AtomicOpsVersion 7.8.0
- name: Build libpcre
if: steps.cache-libs.outputs.cache-hit != 'true'
run: .\etc\win-ci\build-pcre.ps1 -BuildTree deps\pcre -Version 8.45
- name: Build libpcre2
if: steps.cache-libs.outputs.cache-hit != 'true'
run: .\etc\win-ci\build-pcre2.ps1 -BuildTree deps\pcre2 -Version 10.42
- name: Build libiconv
if: steps.cache-libs.outputs.cache-hit != 'true'
run: .\etc\win-ci\build-iconv.ps1 -BuildTree deps\iconv
- name: Build libffi
if: steps.cache-libs.outputs.cache-hit != 'true'
run: .\etc\win-ci\build-ffi.ps1 -BuildTree deps\ffi -Version 3.3
- name: Build zlib
if: steps.cache-libs.outputs.cache-hit != 'true'
run: .\etc\win-ci\build-z.ps1 -BuildTree deps\z -Version 1.2.13
- name: Build mpir
if: steps.cache-libs.outputs.cache-hit != 'true'
run: .\etc\win-ci\build-mpir.ps1 -BuildTree deps\mpir
- name: Build libyaml
if: steps.cache-libs.outputs.cache-hit != 'true'
run: .\etc\win-ci\build-yaml.ps1 -BuildTree deps\yaml -Version 0.2.5
- name: Build libxml2
if: steps.cache-libs.outputs.cache-hit != 'true'
run: .\etc\win-ci\build-xml2.ps1 -BuildTree deps\xml2 -Version 2.11.3
- name: Cache OpenSSL
id: cache-openssl
uses: actions/cache@v3
with:
path: |
libs/crypto.lib
libs/ssl.lib
libs/openssl_VERSION
key: win-openssl-libs-3.1.0-${{ hashFiles('etc/win-ci/build-openssl.ps1') }}-msvc
- name: Set up NASM
if: steps.cache-openssl.outputs.cache-hit != 'true'
uses: ilammy/setup-nasm@321e6ed62a1fc77024a3bd853deb33645e8b22c4 # v1.4.0
- name: Build OpenSSL
if: steps.cache-openssl.outputs.cache-hit != 'true'
run: .\etc\win-ci\build-openssl.ps1 -BuildTree deps\openssl -Version 3.1.0
x86_64-windows-dlls:
runs-on: windows-2022
steps:
- name: Disable CRLF line ending substitution
run: |
git config --global core.autocrlf false
- name: Enable Developer Command Prompt
uses: ilammy/msvc-dev-cmd@cec98b9d092141f74527d0afa6feb2af698cfe89 # v1.12.1
- name: Download Crystal source
uses: actions/checkout@v4
- name: Cache libraries
id: cache-dlls
uses: actions/cache@v3
with:
path: | # openssl and llvm take much longer to build so they are cached separately
libs/pcre-dynamic.lib
libs/pcre2-8-dynamic.lib
libs/iconv-dynamic.lib
libs/gc-dynamic.lib
libs/ffi-dynamic.lib
libs/z-dynamic.lib
libs/mpir-dynamic.lib
libs/yaml-dynamic.lib
libs/xml2-dynamic.lib
dlls/pcre.dll
dlls/pcre2-8.dll
dlls/libiconv.dll
dlls/gc.dll
dlls/libffi.dll
dlls/zlib1.dll
dlls/mpir.dll
dlls/yaml.dll
dlls/libxml2.dll
key: win-dlls-${{ hashFiles('.github/workflows/win.yml', 'etc/win-ci/*.ps1') }}-msvc
- name: Build libgc
if: steps.cache-dlls.outputs.cache-hit != 'true'
run: .\etc\win-ci\build-gc.ps1 -BuildTree deps\gc -Version 8.2.4 -AtomicOpsVersion 7.8.0 -Dynamic
- name: Build libpcre
if: steps.cache-dlls.outputs.cache-hit != 'true'
run: .\etc\win-ci\build-pcre.ps1 -BuildTree deps\pcre -Version 8.45 -Dynamic
- name: Build libpcre2
if: steps.cache-dlls.outputs.cache-hit != 'true'
run: .\etc\win-ci\build-pcre2.ps1 -BuildTree deps\pcre2 -Version 10.42 -Dynamic
- name: Build libiconv
if: steps.cache-dlls.outputs.cache-hit != 'true'
run: .\etc\win-ci\build-iconv.ps1 -BuildTree deps\iconv -Dynamic
- name: Build libffi
if: steps.cache-dlls.outputs.cache-hit != 'true'
run: .\etc\win-ci\build-ffi.ps1 -BuildTree deps\ffi -Version 3.3 -Dynamic
- name: Build zlib
if: steps.cache-dlls.outputs.cache-hit != 'true'
run: .\etc\win-ci\build-z.ps1 -BuildTree deps\z -Version 1.2.13 -Dynamic
- name: Build mpir
if: steps.cache-dlls.outputs.cache-hit != 'true'
run: .\etc\win-ci\build-mpir.ps1 -BuildTree deps\mpir -Dynamic
- name: Build libyaml
if: steps.cache-dlls.outputs.cache-hit != 'true'
run: .\etc\win-ci\build-yaml.ps1 -BuildTree deps\yaml -Version 0.2.5 -Dynamic
- name: Build libxml2
if: steps.cache-dlls.outputs.cache-hit != 'true'
run: .\etc\win-ci\build-xml2.ps1 -BuildTree deps\xml2 -Version 2.11.3 -Dynamic
- name: Cache OpenSSL
id: cache-openssl-dlls
uses: actions/cache@v3
with:
path: |
libs/crypto-dynamic.lib
libs/ssl-dynamic.lib
dlls/libcrypto-3-x64.dll
dlls/libssl-3-x64.dll
key: win-openssl-dlls-3.1.0-${{ hashFiles('etc/win-ci/build-openssl.ps1') }}-msvc
- name: Set up NASM
if: steps.cache-openssl-dlls.outputs.cache-hit != 'true'
uses: ilammy/setup-nasm@321e6ed62a1fc77024a3bd853deb33645e8b22c4 # v1.4.0
- name: Build OpenSSL
if: steps.cache-openssl-dlls.outputs.cache-hit != 'true'
run: .\etc\win-ci\build-openssl.ps1 -BuildTree deps\openssl -Version 3.1.0 -Dynamic
x86_64-windows-llvm:
runs-on: windows-2022
steps:
- name: Enable Developer Command Prompt
uses: ilammy/msvc-dev-cmd@cec98b9d092141f74527d0afa6feb2af698cfe89 # v1.12.1
- name: Cache LLVM
id: cache-llvm
uses: actions/cache@v3
with:
path: llvm
key: llvm-libs-16.0.3-msvc
- name: Download LLVM
if: steps.cache-llvm.outputs.cache-hit != 'true'
run: |
iwr https://github.com/llvm/llvm-project/releases/download/llvmorg-16.0.3/llvm-16.0.3.src.tar.xz -OutFile llvm.tar.xz
(Get-FileHash -Algorithm SHA256 .\llvm.tar.xz).hash -eq "D820E63BC3A6F4F833EC69A1EF49A2E81992E90BC23989F98946914B061AB6C7"
7z x llvm.tar.xz
7z x llvm.tar
mv llvm-* llvm-src
- name: Download LLVM's CMake files
if: steps.cache-llvm.outputs.cache-hit != 'true'
run: |
iwr https://github.com/llvm/llvm-project/releases/download/llvmorg-16.0.3/cmake-16.0.3.src.tar.xz -OutFile cmake.tar.xz
(Get-FileHash -Algorithm SHA256 .\cmake.tar.xz).hash -eq "B6D83C91F12757030D8361DEDC5DD84357B3EDB8DA406B5D0850DF8B6F7798B1"
7z x cmake.tar.xz
7z x cmake.tar
mv cmake-* cmake
- name: Build LLVM
if: steps.cache-llvm.outputs.cache-hit != 'true'
working-directory: ./llvm-src
run: |
cmake . -Thost=x64 -DLLVM_TARGETS_TO_BUILD="X86;AArch64" -DLLVM_USE_CRT_RELEASE=MT -DBUILD_SHARED_LIBS=OFF -DCMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH=OFF -DLLVM_INCLUDE_BENCHMARKS=OFF -DLLVM_INCLUDE_TESTS=OFF -DLLVM_ENABLE_ZSTD=OFF
cmake --build . --config Release
cmake -DCMAKE_INSTALL_PREFIX=$(pwd)\llvm -P cmake_install.cmake
x86_64-windows:
needs: [x86_64-windows-libs, x86_64-windows-dlls, x86_64-windows-llvm]
uses: ./.github/workflows/win_build_portable.yml
with:
release: false
x86_64-windows-test:
runs-on: windows-2022
needs: [x86_64-windows]
steps:
- name: Disable CRLF line ending substitution
run: |
git config --global core.autocrlf false
- name: Enable Developer Command Prompt
uses: ilammy/msvc-dev-cmd@cec98b9d092141f74527d0afa6feb2af698cfe89 # v1.12.1
- name: Download Crystal source
uses: actions/checkout@v4
- name: Download Crystal executable
uses: actions/download-artifact@v3
with:
name: crystal
path: build
- name: Restore LLVM
uses: actions/cache/restore@v3
with:
path: llvm
key: llvm-libs-16.0.3-msvc
fail-on-cache-miss: true
- name: Set up environment
run: |
Add-Content $env:GITHUB_PATH "$(pwd)\build"
Add-Content $env:GITHUB_ENV "CRYSTAL_SPEC_COMPILER_BIN=$(pwd)\build\crystal.exe"
Add-Content $env:GITHUB_ENV "LLVM_CONFIG=$(pwd)\llvm\bin\llvm-config.exe"
- name: Run stdlib specs
run: make -f Makefile.win std_spec
- name: Run compiler specs
run: make -f Makefile.win compiler_spec
- name: Run primitives specs
run: make -f Makefile.win -o .build\crystal.exe primitives_spec # we know the compiler is fresh; do not rebuild it here
- name: Build samples
run: make -f Makefile.win samples
x86_64-windows-release:
if: github.repository_owner == 'crystal-lang' && (startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/ci/'))
needs: [x86_64-windows-libs, x86_64-windows-dlls, x86_64-windows-llvm]
uses: ./.github/workflows/win_build_portable.yml
with:
release: true
x86_64-windows-installer:
if: github.repository_owner == 'crystal-lang' && (startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/ci/'))
runs-on: windows-2022
needs: [x86_64-windows-release]
steps:
- name: Disable CRLF line ending substitution
run: |
git config --global core.autocrlf false
- name: Download Crystal source
uses: actions/checkout@v4
- name: Download Crystal executable
uses: actions/download-artifact@v3
with:
name: crystal-release
path: etc/win-ci/portable
- name: Restore LLVM
uses: actions/cache/restore@v3
with:
path: llvm
key: llvm-libs-16.0.3-msvc
fail-on-cache-miss: true
- name: Set up environment
run: |
Add-Content $env:GITHUB_PATH "$(pwd)\etc\win-ci\portable"
Add-Content $env:GITHUB_ENV "LLVM_CONFIG=$(pwd)\llvm\bin\llvm-config.exe"
- name: Build docs
run: make -f Makefile.win install_docs prefix=etc\win-ci\portable
- name: Build installer
working-directory: ./etc/win-ci
run: |
iscc.exe crystal.iss
- name: Upload Crystal installer
uses: actions/upload-artifact@v3
with:
name: crystal-installer
path: etc/win-ci/Output/crystal-setup.exe