Skip to content

Commit 225ba8f

Browse files
committed
Improve Windows Bash build workflow
Enhanced the GitHub Actions workflow for building Bash on Windows by adding debug steps, safer directory handling, improved path conversions, and additional verification during source extraction and compilation. These changes improve reliability and maintainability of the build process.
1 parent 59e3272 commit 225ba8f

File tree

1 file changed

+37
-8
lines changed

1 file changed

+37
-8
lines changed

.github/workflows/build.yml

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,54 +13,83 @@ jobs:
1313
CYGWIN: winsymlinks:native
1414

1515
steps:
16+
# Configure git for line endings and safe directory
1617
- name: Configure Git
1718
shell: bash
1819
run: |
1920
git config --global core.autocrlf input
21+
# Add workspace as safe directory (Windows path)
22+
git config --global --add safe.directory "$GITHUB_WORKSPACE"
2023
24+
# Checkout repository
2125
- name: Checkout repository
2226
uses: actions/checkout@v4
2327

28+
# Install Cygwin
2429
- name: Install Cygwin
2530
uses: cygwin/cygwin-install-action@master
2631
with:
2732
packages: "gcc-core gcc-g++ make autoconf automake tar curl"
2833

34+
# Download Bash source
2935
- name: Download Bash source
3036
shell: C:\cygwin\bin\bash.exe --login -o igncr -eo pipefail '{0}'
3137
run: |
38+
# Navigate to workspace in Cygwin format
39+
cd "$(cygpath "$GITHUB_WORKSPACE")"
40+
pwd # Debug: show current directory
41+
3242
curl -L https://ftp.gnu.org/gnu/bash/bash-5.1.tar.gz -o bash-5.1.tar.gz
3343
tar xzf bash-5.1.tar.gz
44+
45+
# Verify extraction
46+
echo "Extracted contents:"
47+
ls -la
48+
echo "Bash directory:"
49+
ls -d bash-5.1*
3450
51+
# Compile and install Bash
3552
- name: Compile and install Bash
3653
shell: C:\cygwin\bin\bash.exe --login -o igncr -eo pipefail '{0}'
3754
run: |
55+
# Clean PATH to prioritize Cygwin tools
3856
export PATH=/usr/bin:$(cygpath ${SYSTEMROOT})/system32
3957
40-
DEST=$(cygpath "$GITHUB_WORKSPACE/packages-kib11/bash/files")
58+
# Convert workspace to Cygwin path
59+
WORKSPACE_CYG=$(cygpath "$GITHUB_WORKSPACE")
60+
cd "$WORKSPACE_CYG"
61+
62+
# Verify source directory exists
63+
if [ ! -d "bash-5.1" ]; then
64+
echo "ERROR: bash-5.1 directory not found!"
65+
echo "Current directory: $(pwd)"
66+
ls -la
67+
exit 1
68+
fi
69+
70+
# Set destination path (Cygwin format)
71+
DEST="$WORKSPACE_CYG/packages-kib11/bash/files"
4172
mkdir -p "$DEST"
4273
43-
SRC=$(cygpath "$GITHUB_WORKSPACE/bash-5.1")
44-
cd "$SRC"
74+
cd bash-5.1
4575
76+
# Compile with -fcommon flag to fix linker errors
4677
./configure CFLAGS="-fcommon" --prefix="$DEST" --without-termcap
4778
make
4879
make install
4980
81+
# Commit compiled Bash
5082
- name: Commit compiled Bash to build/bash
5183
shell: bash
5284
run: |
5385
git config user.name "github-actions"
5486
git config user.email "[email protected]"
55-
87+
5688
git fetch origin build/bash || echo "Branch doesn't exist yet"
57-
5889
git checkout -B build/bash origin/build/bash || git checkout -B build/bash
59-
90+
6091
git add packages-kib11/bash/files
61-
6292
git commit -m "Update compiled Bash for Windows [skip ci]" || echo "No changes to commit"
63-
6493
git push -u origin build/bash --force
6594
env:
6695
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)