Skip to content

Commit 58bc6d4

Browse files
committed
Add GH workflow for self-hosted device
Signed-off-by: Thirumalai Nagalingam <thirumalai.nagalingam@multicorewareinc.com>
1 parent 3dafb95 commit 58bc6d4

2 files changed

Lines changed: 184 additions & 1 deletion

File tree

.github/workflows/cd-workflow.yml

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
name: cygwin-self-hosted
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
windows-build:
8+
runs-on: [self-hosted, Windows, ARM64]
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
include:
13+
- build: x86_64-pc-cygwin
14+
target: aarch64-pc-cygwin
15+
buildarch: x86_64
16+
pkgarch: aarch64
17+
runner: cd-win-arm-11
18+
name: Windows native ${{ matrix.pkgarch }}
19+
20+
defaults:
21+
run:
22+
shell: bash --noprofile --norc -eo pipefail -c "$(s=$(/usr/bin/cygpath '{0}') && /usr/bin/sed -i 's/\r$//' $s && echo $s)"
23+
env:
24+
GH_TOKEN: ${{ github.token }}
25+
26+
steps:
27+
# checkout action uses the native git (we can avoid this messing up line
28+
# endings, but this could still be dangerous e.g if we need symlinks in the
29+
# repo)
30+
- name: Configure git
31+
run: |
32+
git config --global core.autocrlf input
33+
shell: powershell
34+
35+
# remove inheritable permissions since they break assumptions testsuite
36+
# makes about file modes
37+
- name: Adjust permissions
38+
run: |
39+
icacls . /inheritance:r
40+
icacls . /grant Administrators:F
41+
shell: powershell
42+
43+
- uses: actions/checkout@v3
44+
45+
# install cygwin and build tools
46+
- name: Install Cygwin
47+
uses: cygwin/cygwin-install-action@master
48+
with:
49+
platform: ${{ matrix.buildarch }}
50+
packages: >-
51+
autoconf,
52+
automake,
53+
busybox,
54+
cocom,
55+
cygutils-extra,
56+
dblatex,
57+
dejagnu,
58+
docbook-xml45,
59+
docbook-xsl,
60+
docbook2X,
61+
gcc-g++,
62+
gettext-devel,
63+
libiconv,
64+
libiconv-devel,
65+
libzstd-devel,
66+
make,
67+
mingw64-${{ matrix.buildarch }}-gcc-g++,
68+
mingw64-${{ matrix.buildarch }}-zlib,
69+
patch,
70+
perl,
71+
python39-lxml,
72+
python39-ply,
73+
texlive-collection-fontsrecommended,
74+
texlive-collection-latexrecommended,
75+
texlive-collection-pictures,
76+
xmlto,
77+
zlib-devel
78+
79+
# download toolchain
80+
- name: Download toolchain
81+
if: ${{ matrix.pkgarch == 'aarch64' }}
82+
run: |
83+
export PATH=/usr/bin:$(cygpath ${SYSTEMROOT})/system32:$PATH
84+
curl -L -o ${{ matrix.target }}-toolchain.tar.gz \
85+
https://github.com/thiru-mcw/cygwin-own/releases/download/v2/aarch64-pc-cygwin-toolchain.tar.gz
86+
87+
# install toolchain
88+
- name: Install toolchain
89+
if: ${{ matrix.pkgarch == 'aarch64' }}
90+
run: |
91+
mkdir -p toolchain/${{ matrix.target }}
92+
tar -xzf ${{ matrix.target }}-toolchain.tar.gz -C toolchain/${{ matrix.target }}
93+
94+
# build
95+
- name: Build Cygwin
96+
run: |
97+
if [[ "${{ matrix.pkgarch }}" == "aarch64" ]]; then
98+
export PATH=$(pwd)/toolchain/${{ matrix.target }}/bin:/usr/bin:$(cygpath ${SYSTEMROOT})/system32
99+
export CXXFLAGS_FOR_TARGET="-D_WIN64 -I$(pwd)/toolchain/${{ matrix.target }}/include"
100+
export LDFLAGS_FOR_TARGET="-L$(pwd)/toolchain/${{ matrix.target }}/lib"
101+
else
102+
export PATH=/usr/bin:$(cygpath ${SYSTEMROOT})/system32
103+
fi
104+
echo PATH=$PATH
105+
export DESTDIR=$(realpath $(pwd)/install)
106+
mkdir build install
107+
(cd winsup; ./autogen.sh)
108+
cd build
109+
../configure --prefix=/usr --build=${{ matrix.build }} --target=${{ matrix.target }} -v
110+
export MAKEFLAGS=-j$(nproc)
111+
make
112+
export CYGWIN=winsymlinks:sys
113+
make install -j1 tooldir=/usr gcc_tooldir=/usr DESTDIR=${DESTDIR}
114+
(cd */newlib; make info man)
115+
(cd */newlib; make install-info install-man tooldir=/usr gcc_tooldir=/usr DESTDIR=${DESTDIR})
116+
117+
# adjust install so it matches the physical arrangement of directories when
118+
# unpacked by setup
119+
- name: Rearrange for default mountpoints
120+
run: |
121+
mv -v install/usr/bin install/bin
122+
mv -v install/usr/lib install/lib
123+
124+
# upload installed cygwin as an artifact, for subsequent use in
125+
# test job(s)
126+
- name: Make Cygwin installation artifact
127+
uses: actions/upload-artifact@v4
128+
with:
129+
name: cygwin-install-${{ matrix.pkgarch }}
130+
path: |
131+
install
132+
133+
# test
134+
- name: Test Cygwin
135+
run: |
136+
if [[ "${{ matrix.pkgarch }}" == "aarch64" ]]; then
137+
export PATH=$(pwd)/toolchain/${{ matrix.target }}/bin:/usr/bin:$(cygpath ${SYSTEMROOT})/system32
138+
else
139+
export PATH=/usr/bin:$(cygpath ${SYSTEMROOT})/system32
140+
fi
141+
export MAKEFLAGS=-j$(nproc)
142+
cd build
143+
(export PATH=${{ matrix.target }}/winsup/testsuite/testinst/bin:${PATH} && cmd /c $(cygpath -wa ${{ matrix.target }}/winsup/cygserver/cygserver) &)
144+
(cd ${{ matrix.target }}/winsup; make check AM_COLOR_TESTS=always)
145+
continue-on-error: ${{ matrix.pkgarch == 'aarch64' }}
146+
147+
# kill hanging processes
148+
- name: Kill hanging processes
149+
if: ${{ matrix.pkgarch == 'aarch64' && always() }}
150+
run: |
151+
taskkill /F /FI 'MODULES eq cygwin1.dll'
152+
if (Test-Path -Path ${{ github.workspace }}\build\${{ matrix.target }}\winsup\testsuite\testinst\tmp) {
153+
Remove-Item -Recurse -Force ${{ github.workspace }}\build\${{ matrix.target }}\winsup\testsuite\testinst\tmp
154+
}
155+
exit 0
156+
shell: powershell
157+
158+
# upload test logs to facilitate investigation of problems
159+
- name: Upload test logs
160+
uses: actions/upload-artifact@v4
161+
with:
162+
name: testlogs-${{ matrix.pkgarch }}
163+
path: |
164+
build/${{ matrix.target }}/winsup/testsuite/**/*.log
165+
build/${{ matrix.target }}/winsup/testsuite/**/*.trs
166+
if: ${{ !cancelled() }}
167+
168+
- name: Pack build folder
169+
if: failure()
170+
run: |
171+
tar -cjf cygwin-${{ matrix.target }}-build.tar.bz2 build/
172+
173+
- name: Upload build folder
174+
if: failure()
175+
uses: actions/upload-artifact@v4
176+
with:
177+
name: cygwin-${{ matrix.target }}-build
178+
retention-days: 5
179+
path: cygwin-${{ matrix.target }}-build.tar.bz2
180+
181+
# workaround problems with actions/checkout post-run step using cygwin git
182+
- name: Avoid actions/checkout post-run step using Cygwin git
183+
run: bash -c 'rm /usr/bin/git.exe'

.github/workflows/cygwin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: cygwin
22

33
on:
4-
push:
4+
# push:
55
# to be reverted, To run only for our fork main
66
branches:
77
- 'mcw/main'

0 commit comments

Comments
 (0)