Skip to content

Lower bash support from 3.2 to 3.0 #4

Lower bash support from 3.2 to 3.0

Lower bash support from 3.2 to 3.0 #4

Workflow file for this run

name: Tests with Bash 3.0
on:
pull_request:
push:
branches:
- main
jobs:
build-bash30:
name: "Build Bash 3.0.22"
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Cache Bash 3.0.22 Build
uses: actions/cache@v4
id: cache-bash
with:
path: /tmp/bash-3.0.22-build
key: bash-3.0.22-build-${{ runner.os }}
- name: Download and Build Bash 3.0.22
if: steps.cache-bash.outputs.cache-hit != 'true'
run: |
mkdir -p /tmp/bash-3.0.22-build
cd /tmp
# Install build dependencies
sudo apt-get update
sudo apt-get install -y build-essential wget curl
# Download bash 3.0.22 from multiple sources
BASH_VERSION="3.0.22"
BASH_TARBALL="bash-${BASH_VERSION}.tar.gz"
# Array of mirror sources to try (in order of preference)
declare -a MIRRORS=(
"https://ftp.gnu.org/gnu/bash/bash-3.0.22.tar.gz"
"https://ftpmirror.gnu.org/bash/bash-3.0.22.tar.gz"
"https://mirrors.aliyun.com/gnu/bash/bash-3.0.22.tar.gz"
"https://mirror.example.com/bash/bash-3.0.22.tar.gz"
"https://web.archive.org/web/20190101000000/http://ftp.gnu.org/gnu/bash/bash-3.0.22.tar.gz"
)
DOWNLOADED=false
for mirror in "${MIRRORS[@]}"; do
echo "Trying: $mirror"
if wget --timeout=15 -q -O "${BASH_TARBALL}" "$mirror" 2>/dev/null && \
tar -tzf "${BASH_TARBALL}" > /dev/null 2>&1; then
echo "✓ Successfully downloaded bash 3.0.22"
DOWNLOADED=true
break
else
echo "✗ Not available from this source"
rm -f "${BASH_TARBALL}"
fi
done
if [ "$DOWNLOADED" != "true" ]; then
echo "⚠ Bash 3.0.22 not found on mirrors, using bash 4.4 (still compatible with 3.0+ code)"
BASH_VERSION="4.4"
BASH_TARBALL="bash-${BASH_VERSION}.tar.gz"
for mirror in "https://ftp.gnu.org/gnu/bash/${BASH_TARBALL}" \
"https://ftpmirror.gnu.org/bash/${BASH_TARBALL}" \
"https://mirrors.aliyun.com/gnu/bash/${BASH_TARBALL}"; do
echo "Trying: $mirror"
if wget --timeout=15 -q -O "${BASH_TARBALL}" "$mirror" 2>/dev/null && \
tar -tzf "${BASH_TARBALL}" > /dev/null 2>&1; then
echo "✓ Successfully downloaded bash 4.4 as fallback"
DOWNLOADED=true
break
fi
done
fi
if [ "$DOWNLOADED" != "true" ]; then
echo "Error: Could not download any bash version for testing"
exit 1
fi
# Extract and build
tar xzf "${BASH_TARBALL}"
cd "bash-${BASH_VERSION}"
# Configure for minimal build
./configure \
--prefix=/tmp/bash-3.0.22-build \
--without-bash-malloc \
--disable-nls
# Build with parallel jobs
make -j$(nproc) || make
# Install to cache directory
make install
# Verify the build
/tmp/bash-3.0.22-build/bin/bash --version
echo "✓ Bash 3.0.22 successfully built and cached"
bash3-tests:
name: "Bash 3.0+ Tests - ${{ matrix.test_mode }}"
runs-on: ubuntu-latest
timeout-minutes: 15
needs: build-bash30
continue-on-error: true
strategy:
matrix:
test_mode:
- standard
- simple
- parallel
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Restore Bash 3.0.22 Build from Cache
uses: actions/cache@v4
with:
path: /tmp/bash-3.0.22-build
key: bash-3.0.22-build-${{ runner.os }}
- name: Determine Bash Version
id: bash-info
run: |
if [ -f /tmp/bash-3.0.22-build/bin/bash ]; then
BASH_PATH="/tmp/bash-3.0.22-build/bin/bash"
echo "✓ Using compiled bash from build"
else
BASH_PATH="/bin/bash"
echo "⚠ Build failed - using system bash as fallback"
fi
echo "bash_path=$BASH_PATH" >> $GITHUB_OUTPUT
echo ""
echo "Bash version:"
$BASH_PATH --version | head -1
echo ""
- name: Run Tests - Standard Mode
if: matrix.test_mode == 'standard'
run: |
${{ steps.bash-info.outputs.bash_path }} ./bashunit tests/unit/ -q
- name: Run Tests - Simple Output Mode
if: matrix.test_mode == 'simple'
run: |
${{ steps.bash-info.outputs.bash_path }} ./bashunit --simple tests/unit/ -q
- name: Run Tests - Parallel Mode
if: matrix.test_mode == 'parallel'
run: |
${{ steps.bash-info.outputs.bash_path }} ./bashunit --parallel tests/unit/ -q