-
Notifications
You must be signed in to change notification settings - Fork 1
561 lines (502 loc) · 19.2 KB
/
Copy pathcygwin.yml
File metadata and controls
561 lines (502 loc) · 19.2 KB
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
name: cygwin
on:
push:
# since master is a symbolic reference to main, don't run for both
branches-ignore:
- 'master'
tags:
- '*'
jobs:
fedora-build:
runs-on: ubuntu-latest
container: fedora:latest
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-pc-cygwin
pkgarch: 64
name: Fedora cross ${{ matrix.target }}
env:
HAS_SSH_KEY: ${{ secrets.SSH_KEY != '' }}
steps:
- uses: actions/checkout@v3
# install build tools
- name: Install build tools
run: |
dnf install -y autoconf automake gawk make patch perl mingw${{ matrix.pkgarch }}-gcc-c++ mingw${{ matrix.pkgarch }}-winpthreads-static mingw${{ matrix.pkgarch }}-zlib-static
# enable 'dnf copr'
- name: Enable 'dnf copr'
run: |
dnf install -y dnf-plugins-core
# install cross-cygwin toolchain and libs from copr
- name: Install cross-cygwin toolchain and libs and cocom from copr
run: |
dnf copr enable -y yselkowitz/cygwin
dnf install -y cygwin${{ matrix.pkgarch }}-gcc-c++ cygwin${{ matrix.pkgarch }}-gettext cygwin${{ matrix.pkgarch }}-libbfd cygwin${{ matrix.pkgarch }}-libiconv cygwin${{ matrix.pkgarch }}-zlib cocom
# install doc tools
- name: Install doc tools
run: |
dnf install -y dblatex docbook2X docbook-xsl xmlto python3 python3-lxml python3-ply openssh-clients
fmtutil-sys --byfmt pdflatex && texhash
# build
- name: Configure, build and install
run: |
mkdir build install
(cd winsup && ./autogen.sh)
(cd build && ../configure --target=${{ matrix.target }} --prefix=$(realpath $(pwd)/../install) )
make -C build
make -C build/*/newlib info man
make -C build install
make -C build/*/newlib install-info install-man
# deploy documentation
- name: Deploy documentation
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
run: |
# pushes to main are deployed as preview
# pushes to cygwin-n.n.n (but not 'cygwin-n.n.n.dev') tags are deployed as stable
# other references are ignored by this step
case "${{ github.ref }}" in
refs/heads/main)
DEST='preview'
;;
refs/tags/cygwin-[0-9.]*)
DEST='stable'
;;
*)
exit 0
;;
esac
# unfuck github fuckery of HOME in a container
unset HOME
# add the hosts public key to known_hosts
mkdir -p ~/.ssh/
echo "cygwin.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKoejTnTCbXaIIMYfbX7t4tYUOQ2bTxZC3e/td3BageF" >> ~/.ssh/known_hosts
# load the key (restricted to scp only) into ssh-agent
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
ssh-add - <<< "${{ secrets.SSH_KEY }}"
# deploy documentation files from install directory
scp -pr install/share/doc/{cygwin-api,cygwin-ug-net,faq}* cygwin-admin@cygwin.com:/sourceware/www/sourceware/htdocs/cygwin/doc/${DEST}/
if: env.HAS_SSH_KEY == 'true'
ubuntu-build:
strategy:
fail-fast: false
matrix:
include:
- arch: aarch64
runs-on: [
Windows,
WSL,
ARM64
]
name: Ubuntu cross ${{ matrix.arch }}-pc-cygwin
defaults:
run:
shell: wsl --user runner bash --noprofile --norc -euo pipefail "$(s="$(wslpath '{0}')" && sed -i 's/\r$//' "$s" && echo "$s")"
env:
GH_TOKEN: ${{ github.token }}
TOOLCHAIN_REPO: Windows-on-ARM-Experiments/mingw-woarm64-build
WSLENV: CYGWIN:GH_TOKEN:GITHUB_ENV/p:GITHUB_OUTPUT/p:GITHUB_STEP_SUMMARY/p
steps:
# prepare non-ephemeral runner environment
- name: Prepare environment
run: |
Get-ChildItem -Force
if (Test-Path -Path newlib-cygwin) {
Remove-Item -Recurse -Force newlib-cygwin
}
if (Test-Path -Path *-msvcrt-toolchain.tar.gz) {
Remove-Item -Recurse -Force *-msvcrt-toolchain.tar.gz
}
if (Test-Path -Path toolchain) {
Remove-Item -Recurse -Force toolchain
}
if (Test-Path -Path build) {
Remove-Item -Recurse -Force build
}
if (Test-Path -Path install) {
Remove-Item -Recurse -Force install
}
shell: powershell
# install build tools
- name: Install build tools
run: |
sudo apt update
sudo apt install -y \
autoconf \
automake \
binutils \
bzip2 \
dblatex \
docbook2x \
docbook-xsl \
gawk \
gcc \
g++ \
gh \
make \
openssh-client \
patch \
perl \
python3 \
python3-lxml \
python3-ply \
xmlto
# checkout
- name: Checkout
run: |
git clone https://github.com/${{ github.repository }} -b ${{ github.ref_name }}
# download toolchain
- name: Download toolchain
run: |
CYGWIN_DIGEST=$(gh api repos/${{ env.TOOLCHAIN_REPO }}/releases/latest \
--jq '.assets[] | select(.name | test("${{ matrix.arch }}-pc-cygwin-msvcrt-toolchain.tar.gz")).digest')
MINGW_DIGEST=$(gh api repos/${{ env.TOOLCHAIN_REPO }}/releases/latest \
--jq '.assets[] | select(.name | test("${{ matrix.arch }}-w64-mingw32-msvcrt-toolchain.tar.gz")).digest')
gh release download \
--repo ${{ env.TOOLCHAIN_REPO }} \
--pattern ${{ matrix.arch }}-*-msvcrt-toolchain.tar.gz
sha256sum -c <<< "${CYGWIN_DIGEST#sha256:} ${{ matrix.arch }}-pc-cygwin-msvcrt-toolchain.tar.gz"
sha256sum -c <<< "${MINGW_DIGEST#sha256:} ${{ matrix.arch }}-w64-mingw32-msvcrt-toolchain.tar.gz"
# install toolchain
- name: Install toolchain
run: |
mkdir -p toolchain/${{ matrix.arch }}-w64-mingw32
mkdir -p toolchain/${{ matrix.arch }}-pc-cygwin
tar -xzf ${{ matrix.arch }}-w64-mingw32-msvcrt-toolchain.tar.gz -C toolchain/${{ matrix.arch }}-w64-mingw32
tar -xzf ${{ matrix.arch }}-pc-cygwin-msvcrt-toolchain.tar.gz -C toolchain/${{ matrix.arch }}-pc-cygwin
# build
- name: Configure, build and install
run: |
WORKSPACE=$(realpath $(pwd))
export PATH="$PATH:$WORKSPACE/build/${{ matrix.arch }}-pc-cygwin/winsup/testsuite/testinst/bin:$WORKSPACE/toolchain/${{ matrix.arch }}-w64-mingw32/bin:$WORKSPACE/toolchain/${{ matrix.arch }}-pc-cygwin/bin"
export CXXFLAGS_FOR_TARGET="-I$WORKSPACE/toolchain/${{ matrix.arch }}-pc-cygwin/include"
export LDFLAGS_FOR_TARGET="-L$WORKSPACE/toolchain/${{ matrix.arch }}-pc-cygwin/lib"
export MINGW_CPPFLAGS="-I$WORKSPACE/toolchain/${{ matrix.arch }}-w64-mingw32/include"
export MINGW_LDFLAGS="-L$WORKSPACE/toolchain/${{ matrix.arch }}-w64-mingw32/lib"
export MAKEFLAGS="V=1 -j$(nproc)"
export CYGWIN=winsymlinks:sys
mkdir -p build install
(cd newlib-cygwin/winsup && ./autogen.sh)
(cd build && ../newlib-cygwin/configure --target=${{ matrix.arch }}-pc-cygwin --prefix=$(realpath $(pwd)/../install) )
make -C build
make -C build/*/newlib info man
make -C build install
make -C build/*/newlib install-info install-man
# test
- name: Test Cygwin
continue-on-error: true
run: |
WORKSPACE=$(realpath $(pwd))
export PATH="$PATH:$WORKSPACE/build/${{ matrix.arch }}-pc-cygwin/winsup/testsuite/testinst/bin:$WORKSPACE/toolchain/${{ matrix.arch }}-w64-mingw32/bin:$WORKSPACE/toolchain/${{ matrix.arch }}-pc-cygwin/bin"
export CXXFLAGS_FOR_TARGET="-I$WORKSPACE/toolchain/${{ matrix.arch }}-pc-cygwin/include"
export LDFLAGS_FOR_TARGET="-L$WORKSPACE/toolchain/${{ matrix.arch }}-pc-cygwin/lib"
export MINGW_CPPFLAGS="-I$WORKSPACE/toolchain/${{ matrix.arch }}-w64-mingw32/include"
export MINGW_LDFLAGS="-L$WORKSPACE/toolchain/${{ matrix.arch }}-w64-mingw32/lib"
export CYGWIN=winsymlinks:sys
(cd build/${{ matrix.arch }}-pc-cygwin/winsup && WSLENV="$WSLENV:PATH/l" make V=1 check AM_COLOR_TESTS=always)
- name: Pack build folder
if: failure()
run: |
tar -cjf build.tar.bz2 build/
- name: Upload build folder
if: failure()
uses: actions/upload-artifact@v4
with:
name: cygwin-build
retention-days: 1
path: build.tar.bz2
windows-build:
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- build: x86_64-pc-cygwin
target: x86_64-pc-cygwin
buildarch: x86_64
pkgarch: x86_64
runner: windows-latest
- build: x86_64-pc-cygwin
target: aarch64-pc-cygwin
buildarch: x86_64
pkgarch: aarch64
runner: windows-11-arm
name: Windows native ${{ matrix.pkgarch }}
defaults:
run:
shell: bash --noprofile --norc -eo pipefail -c "$(s=$(/usr/bin/cygpath '{0}') && /usr/bin/sed -i 's/\r$//' $s && echo $s)"
env:
GH_TOKEN: ${{ github.token }}
steps:
# checkout action uses the native git (we can avoid this messing up line
# endings, but this could still be dangerous e.g if we need symlinks in the
# repo)
- name: Configure git
run: |
git config --global core.autocrlf input
shell: powershell
# remove inheritable permissions since they break assumptions testsuite
# makes about file modes
- name: Adjust permissions
run: |
icacls . /inheritance:r
icacls . /grant Administrators:F
shell: powershell
- uses: actions/checkout@v3
# install cygwin and build tools
- name: Install Cygwin
uses: cygwin/cygwin-install-action@master
with:
platform: ${{ matrix.buildarch }}
packages: >-
autoconf,
automake,
busybox,
cocom,
cygutils-extra,
dblatex,
dejagnu,
docbook-xml45,
docbook-xsl,
docbook2X,
gcc-g++,
gettext-devel,
libiconv,
libiconv-devel,
libzstd-devel,
make,
mingw64-${{ matrix.buildarch }}-gcc-g++,
mingw64-${{ matrix.buildarch }}-zlib,
patch,
perl,
python39-lxml,
python39-ply,
texlive-collection-fontsrecommended,
texlive-collection-latexrecommended,
texlive-collection-pictures,
xmlto,
zlib-devel
# download toolchain
- name: Download toolchain
if: ${{ matrix.pkgarch == 'aarch64' }}
run: |
export PATH=/usr/bin:$(cygpath ${SYSTEMROOT})/system32:$PATH
DIGEST=$(gh api repos/${{ github.repository }}/releases/latest \
--jq '.assets[] | select(.name | test("${{ matrix.target }}-toolchain.tar.xz")).digest')
gh release download \
--repo ${{ github.repository }} \
--pattern ${{ matrix.target }}-toolchain.tar.xz
sha256sum -c <<< "${DIGEST#sha256:} ${{ matrix.target }}-toolchain.tar.xz"
# install toolchain
- name: Install toolchain
if: ${{ matrix.pkgarch == 'aarch64' }}
run: |
mkdir -p toolchain/${{ matrix.target }}
tar -xzf ${{ matrix.target }}-toolchain.tar.xz -C toolchain/${{ matrix.target }}
# build
- name: Build Cygwin
run: |
if [[ "${{ matrix.pkgarch }}" == "aarch64" ]]; then
export PATH=$(pwd)/toolchain/${{ matrix.target }}/bin:/usr/bin:$(cygpath ${SYSTEMROOT})/system32
export CXXFLAGS_FOR_TARGET="-D_WIN64 -I$(pwd)/toolchain/${{ matrix.target }}/include"
export LDFLAGS_FOR_TARGET="-L$(pwd)/toolchain/${{ matrix.target }}/lib"
else
export PATH=/usr/bin:$(cygpath ${SYSTEMROOT})/system32
fi
echo PATH=$PATH
export DESTDIR=$(realpath $(pwd)/install)
mkdir build install
(cd winsup; ./autogen.sh)
cd build
../configure --prefix=/usr --build=${{ matrix.build }} --target=${{ matrix.target }} -v
export MAKEFLAGS=-j$(nproc)
make
export CYGWIN=winsymlinks:sys
make install -j1 tooldir=/usr gcc_tooldir=/usr DESTDIR=${DESTDIR}
(cd */newlib; make info man)
(cd */newlib; make install-info install-man tooldir=/usr gcc_tooldir=/usr DESTDIR=${DESTDIR})
# adjust install so it matches the physical arrangement of directories when
# unpacked by setup
- name: Rearrange for default mountpoints
run: |
mv -v install/usr/bin install/bin
mv -v install/usr/lib install/lib
# upload installed cygwin as an artifact, for subsequent use in
# test job(s)
- name: Make Cygwin installation artifact
uses: actions/upload-artifact@v4
with:
name: cygwin-install-${{ matrix.pkgarch }}
path: |
install
# test
- name: Test Cygwin
run: |
if [[ "${{ matrix.pkgarch }}" == "aarch64" ]]; then
export PATH=$(pwd)/toolchain/${{ matrix.target }}/bin:/usr/bin:$(cygpath ${SYSTEMROOT})/system32
else
export PATH=/usr/bin:$(cygpath ${SYSTEMROOT})/system32
fi
export MAKEFLAGS=-j$(nproc)
cd build
(export PATH=${{ matrix.target }}/winsup/testsuite/testinst/bin:${PATH} && cmd /c $(cygpath -wa ${{ matrix.target }}/winsup/cygserver/cygserver) &)
(cd ${{ matrix.target }}/winsup; make check AM_COLOR_TESTS=always)
continue-on-error: ${{ matrix.pkgarch == 'aarch64' }}
# kill hanging processes
- name: Kill hanging processes
if: ${{ matrix.pkgarch == 'aarch64' && always() }}
run: |
taskkill /F /FI 'MODULES eq cygwin1.dll'
if (Test-Path -Path ${{ github.workspace }}\build\${{ matrix.target }}\winsup\testsuite\testinst\tmp) {
Remove-Item -Recurse -Force ${{ github.workspace }}\build\${{ matrix.target }}\winsup\testsuite\testinst\tmp
}
exit 0
shell: powershell
# upload test logs to facilitate investigation of problems
- name: Upload test logs
uses: actions/upload-artifact@v4
with:
name: testlogs-${{ matrix.pkgarch }}
path: |
build/${{ matrix.target }}/winsup/testsuite/**/*.log
build/${{ matrix.target }}/winsup/testsuite/**/*.trs
if: ${{ !cancelled() }}
- name: Pack build folder
if: failure()
run: |
tar -cjf cygwin-${{ matrix.target }}-build.tar.bz2 build/
- name: Upload build folder
if: failure()
uses: actions/upload-artifact@v4
with:
name: cygwin-${{ matrix.target }}-build
retention-days: 1
path: cygwin-${{ matrix.target }}-build.tar.bz2
# workaround problems with actions/checkout post-run step using cygwin git
- name: Avoid actions/checkout post-run step using Cygwin git
run: bash -c 'rm /usr/bin/git.exe'
windows-stress-test:
needs: windows-build
strategy:
fail-fast: false
matrix:
include:
- pkgarch: x86_64
runarch: x86_64
runner: windows-latest
- pkgarch: x86_64
runarch: arm64
runner: windows-11-arm
runs-on: ${{ matrix.runner }}
name: stress tests ${{ matrix.pkgarch }} on ${{ matrix.runarch }} Windows
steps:
- run: git config --global core.autocrlf input
- uses: actions/checkout@v3
# install cygwin
- name: Install Cygwin
id: cygwin-install
uses: cygwin/cygwin-install-action@master
with:
platform: ${{ matrix.pkgarch }}
packages: |
procps-ng
stress-ng
# fetch the just-built cygwin installation artifact
- name: Unpack just-built Cygwin artifact
uses: actions/download-artifact@v4
with:
name: cygwin-install-${{ matrix.pkgarch }}
# use the install-dir of cygwin-install-action above, so we unpack the
# artifact over it
path: ${{ steps.cygwin-install.outputs.root }}
# This isn't quite right, as it just overwrites existing files, it doesn't
# remove anything which is no longer provided. Ideally, we'd make a cygwin
# package of the just-built cygwin version and install it here, but tools
# don't exist (yet) to let us do that...
# run stress-test
- name: Run stress tests
run: |
export PATH=/usr/bin:$(cygpath ${SYSTEMROOT})/system32
uname -a
export LOGDIR=$(cygpath -a logs)
winsup/testsuite/stress/cygstress CI
shell: bash --noprofile --norc -o igncr -eo pipefail '{0}'
continue-on-error: ${{ matrix.runarch == 'arm64' }}
# upload logs artifact
- name: Capture logs artifact
uses: actions/upload-artifact@v4
with:
name: stress-logs-${{ matrix.pkgarch }}-on-${{ matrix.runarch }}
path: |
logs
if: ${{ !cancelled() }}
windows-stc-regression-test:
needs: windows-build
strategy:
fail-fast: false
matrix:
include:
- pkgarch: x86_64
runarch: x86_64
runner: windows-latest
- pkgarch: x86_64
runarch: arm64
runner: windows-11-arm
runs-on: ${{ matrix.runner }}
name: stc tests ${{ matrix.pkgarch }} on ${{ matrix.runarch }} Windows
steps:
# install cygwin
- name: Install Cygwin
id: cygwin-install
uses: cygwin/cygwin-install-action@master
with:
platform: ${{ matrix.pkgarch }}
packages: |
gcc-core
git
meson
ninja
# The download-artifact action currently seems to fail with EPERM when it
# tries to unpack over a symlink. Remove the only such instance.
- name: Workaround download-artifact issue
run: |
cd /d ${{ steps.cygwin-install.outputs.root }}\lib
bash -c 'rm libg.a'
shell: cmd
# fetch the just-built cygwin installation artifact
- name: Unpack just-built Cygwin artifact
uses: actions/download-artifact@v4
with:
name: cygwin-install-${{ matrix.pkgarch }}
# use the install-dir of cygwin-install-action above, so we unpack the
# artifact over it
path: ${{ steps.cygwin-install.outputs.root }}
# This isn't quite right, as it just overwrites existing files, it doesn't
# remove anything which is no longer provided. Ideally, we'd make a cygwin
# package of the just-built cygwin version and install it here, but tools
# don't exist (yet) to let us do that...
# fetch and build stc test
- name: Fetch and build stc tests
run: |
export PATH=/usr/bin:$(cygpath ${SYSTEMROOT})/system32
uname -a
git clone https://cygwin.com/git/cygwin-apps/stc.git --depth 1
meson setup _build stc
ninja -C _build
shell: bash --noprofile --norc -o igncr -eo pipefail '{0}'
# run stc test
- name: Run stc tests
run: |
export PATH=/usr/bin:$(cygpath ${SYSTEMROOT})/system32
meson test -C _build
shell: bash --noprofile --norc -o igncr -eo pipefail '{0}'
# upload logs artifact
- name: Capture logs artifact
uses: actions/upload-artifact@v4
with:
name: stc-logs-${{ matrix.pkgarch }}-on-${{ matrix.runarch }}
path: |
_build/meson-logs
if: ${{ !cancelled() }}