-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
151 lines (137 loc) · 4.58 KB
/
win_build_portable.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: Windows CI / Build Portable Package
on:
workflow_call:
inputs:
release:
required: true
type: boolean
llvm_version:
required: true
type: string
permissions: {}
jobs:
build:
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@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
- name: Install Crystal
uses: crystal-lang/install-crystal@v1
id: install-crystal
with:
crystal: "1.15.0"
- name: Download Crystal source
uses: actions/checkout@v4
- name: Restore libraries
uses: actions/cache/restore@v4
with:
path: |
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
fail-on-cache-miss: true
- name: Restore OpenSSL
uses: actions/cache/restore@v4
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
fail-on-cache-miss: true
- name: Restore DLLs
uses: actions/cache/restore@v4
with:
path: |
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/iconv-2.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
fail-on-cache-miss: true
- name: Restore OpenSSL DLLs
uses: actions/cache/restore@v4
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
fail-on-cache-miss: true
- name: Restore LLVM
uses: actions/cache/restore@v4
with:
path: llvm
key: llvm-libs-${{ inputs.llvm_version }}-msvc
fail-on-cache-miss: true
- name: Restore LLVM DLLs
uses: actions/cache/restore@v4
with:
path: |
libs/llvm_VERSION
libs/llvm-dynamic.lib
dlls/LLVM-C.dll
key: llvm-dlls-${{ inputs.llvm_version }}-${{ hashFiles('etc/win-ci/build-llvm.ps1') }}-msvc
fail-on-cache-miss: true
- name: Set up environment
run: |
echo "CRYSTAL_LIBRARY_PATH=$(pwd)\libs" >> ${env:GITHUB_ENV}
echo "LLVM_CONFIG=$(pwd)\llvm\bin\llvm-config.exe" >> ${env:GITHUB_ENV}
# NOTE: the name of the libiconv DLL has changed, so we manually copy
# the new one to the existing Crystal installation; remove after
# updating the base compiler to 1.14
cp dlls/iconv-2.dll ${{ steps.install-crystal.outputs.path }}
- name: Build LLVM extensions
run: make -f Makefile.win deps
- name: Build Crystal
run: |
bin/crystal.bat env
make -f Makefile.win -B ${{ inputs.release && 'release=1' || '' }} interpreter=1
- name: Download shards release
uses: actions/checkout@v4
with:
repository: crystal-lang/shards
ref: v0.19.1
path: shards
- name: Build shards release
working-directory: ./shards
run: make -f Makefile.win ${{ inputs.release && 'release=1' || '' }}
- name: Gather Crystal binaries
run: |
make -f Makefile.win install prefix=crystal
mkdir crystal/lib
cp shards/bin/shards.exe crystal/
cp shards/bin/shards.pdb crystal/
cp libs/* crystal/lib/
cp dlls/* crystal/
cp README.md crystal/
- name: Upload Crystal binaries
uses: actions/upload-artifact@v4
with:
name: crystal
path: crystal