Skip to content

Commit d36e5db

Browse files
committed
ci: add Cygwin build workflow
Add a GitHub Actions workflow to build with Cygwin on Windows. Fixes issues by forcing Cygwin bash for all steps, handling temporary script paths, stripping CRLF line endings, and enabling igncr.
1 parent 58d130a commit d36e5db

File tree

1 file changed

+120
-0
lines changed

1 file changed

+120
-0
lines changed

.github/workflows/cygwin-build.yml

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
name: Cygwin
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- master
8+
9+
jobs:
10+
cygwin-build:
11+
runs-on: windows-latest
12+
env:
13+
CYGWIN: winsymlinks:nativestrict
14+
15+
# Use a wrapper that:
16+
# - converts the temp step path ({0}) and the workspace to POSIX with cygpath
17+
# - strips CRLF from the temporary script
18+
# - sets igncr and runs the script under Cygwin bash
19+
defaults:
20+
run:
21+
shell: >
22+
C:\tools\cygwin\bin\bash.EXE --login -eo pipefail -c
23+
"p=$(/usr/bin/cygpath -au '{0}');
24+
w=$(/usr/bin/cygpath -au '${{ github.workspace }}');
25+
/usr/bin/sed -i 's/\r$//' \"$p\" || true;
26+
set -o igncr;
27+
cd \"$w\" || (/usr/bin/pwd; /usr/bin/ls -la; exit 2);
28+
/usr/bin/bash -leo pipefail \"$p\""
29+
30+
steps:
31+
- name: Checkout repository
32+
uses: actions/checkout@v4
33+
with:
34+
fetch-depth: 0
35+
36+
- name: Set up Cygwin with build dependencies
37+
uses: egor-tensin/setup-cygwin@v4
38+
with:
39+
packages: >-
40+
autoconf
41+
automake
42+
libtool
43+
make
44+
pkg-config
45+
autoconf-archive
46+
gcc-core
47+
gettext-devel
48+
git
49+
libncursesw-devel
50+
libglib2.0-devel
51+
libcurl-devel
52+
libreadline-devel
53+
libsqlite3-devel
54+
libexpat-devel
55+
56+
- name: Build and install libstrophe from source
57+
run: |
58+
cd "$GITHUB_WORKSPACE"
59+
mkdir -p deps && cd deps
60+
git clone --depth 1 https://github.com/strophe/libstrophe.git
61+
cd libstrophe
62+
autoreconf -i
63+
./configure --prefix=$PWD/install
64+
make -j2 install
65+
# explicit shell to be extra-safe for this step
66+
shell: >
67+
C:\tools\cygwin\bin\bash.EXE --login -eo pipefail -c
68+
"p=$(/usr/bin/cygpath -au '{0}');
69+
w=$(/usr/bin/cygpath -au '${{ github.workspace }}');
70+
/usr/bin/sed -i 's/\r$//' \"$p\" || true;
71+
set -o igncr;
72+
cd \"$w\" || (/usr/bin/pwd; /usr/bin/ls -la; exit 2);
73+
/usr/bin/bash -leo pipefail \"$p\""
74+
75+
- name: Check repo state
76+
run: |
77+
cd "$GITHUB_WORKSPACE"
78+
pwd
79+
ls -la
80+
test -f configure.ac && echo "configure.ac present" || (echo "configure.ac missing"; exit 1)
81+
82+
- name: Autotools bootstrap
83+
run: |
84+
cd "$GITHUB_WORKSPACE"
85+
# don't fail if git is not present inside Cygwin
86+
git config --global core.autocrlf false || true
87+
[ -f ./bootstrap.sh ] && sed -i 's/\r$//' ./bootstrap.sh || true
88+
89+
if [ -x ./bootstrap.sh ]; then
90+
./bootstrap.sh
91+
else
92+
autoreconf -fi
93+
fi
94+
95+
- name: Configure
96+
env:
97+
# ensure pkg-config can find libstrophe we built above
98+
PKG_CONFIG_PATH: ${{ github.workspace }}/deps/libstrophe/install/lib/pkgconfig:$PKG_CONFIG_PATH
99+
run: |
100+
cd "$GITHUB_WORKSPACE"
101+
./configure
102+
103+
- name: Build
104+
run: |
105+
cd "$GITHUB_WORKSPACE"
106+
make -j2
107+
108+
# Optional: non-blocking tests + upload logs for inspection (recommended while tests are unstable)
109+
# - name: Run tests (collect logs)
110+
# continue-on-error: true
111+
# run: |
112+
# cd "$GITHUB_WORKSPACE"
113+
# mkdir -p test-logs
114+
# make check > test-logs/make-check.log 2>&1 || true
115+
#
116+
# - name: Upload test logs
117+
# uses: actions/upload-artifact@v4
118+
# with:
119+
# name: cygwin-make-check-logs
120+
# path: test-logs/

0 commit comments

Comments
 (0)