Skip to content

Commit a071b71

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 a071b71

File tree

1 file changed

+94
-0
lines changed

1 file changed

+94
-0
lines changed

.github/workflows/cygwin-build.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
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+
66+
- name: Autotools bootstrap
67+
run: |
68+
cd "$GITHUB_WORKSPACE"
69+
70+
# convert CRLF -> LF if bootstrap.sh exists
71+
if [ -f ./bootstrap.sh ]; then
72+
sed -i 's/\r$//' ./bootstrap.sh
73+
chmod +x ./bootstrap.sh
74+
fi
75+
76+
if [ -x ./bootstrap.sh ]; then
77+
./bootstrap.sh
78+
else
79+
autoreconf -fi
80+
fi
81+
82+
- name: Configure
83+
env:
84+
# ensure pkg-config can find libstrophe we built above
85+
PKG_CONFIG_PATH: ${{ github.workspace }}/deps/libstrophe/install/lib/pkgconfig:$PKG_CONFIG_PATH
86+
run: |
87+
cd "$GITHUB_WORKSPACE"
88+
./configure
89+
90+
- name: Build
91+
run: |
92+
cd "$GITHUB_WORKSPACE"
93+
make -j2
94+

0 commit comments

Comments
 (0)