4444 ${{ runner.os }}-ci-pip-${{ matrix.python-version }}-
4545 ${{ runner.os }}-ci-pip-
4646
47+ - name : Cache BPG tools
48+ uses : actions/cache@v4
49+ id : bpg-cache
50+ with :
51+ path : ~/.local/bin/bpg*
52+ key : ${{ runner.os }}-bpg-tools-v1
53+ restore-keys : |
54+ ${{ runner.os }}-bpg-tools-
55+
56+ - name : Install system dependencies
57+ run : |
58+ echo "🔧 Installing system dependencies for BPG..."
59+ # Install missing libraries
60+ sudo apt-get update -qq
61+ sudo apt-get install -y libtiff5-dev pkg-config wget build-essential
62+ echo "✅ System dependencies installed"
63+
4764 - name : Install BPG tools
4865 run : |
4966 echo "🔧 Installing BPG (Better Portable Graphics) tools..."
@@ -56,10 +73,13 @@ jobs:
5673 echo "$BPG_BIN_DIR" >> $GITHUB_PATH
5774 export PATH="$BPG_BIN_DIR:$PATH"
5875
59- # Check if BPG tools are already installed
76+ # Check if BPG tools are already installed or cached
6077 if command -v bpgenc &> /dev/null && command -v bpgdec &> /dev/null; then
6178 echo "✅ BPG tools already installed"
6279 bpgenc 2>&1 | head -n 3 || true
80+ elif [ "${{ steps.bpg-cache.outputs.cache-hit }}" == "true" ]; then
81+ echo "✅ BPG tools restored from cache"
82+ chmod +x "$BPG_BIN_DIR"/bpg* 2>/dev/null || true
6383 else
6484 echo "📦 Installing BPG tools from source..."
6585
@@ -81,15 +101,38 @@ jobs:
81101 # Download and try to compile BPG (non-blocking)
82102 echo "📥 Downloading BPG source..."
83103 cd /tmp
84- if wget -q https://bellard.org/bpg/bpg-0.9.8.tar.gz; then
104+
105+ # Try multiple sources for BPG
106+ BPG_DOWNLOADED=false
107+
108+ # Primary source
109+ if wget -q --timeout=10 https://bellard.org/bpg/bpg-0.9.8.tar.gz 2>/dev/null; then
110+ echo "✅ Downloaded BPG source from primary location"
111+ BPG_DOWNLOADED=true
112+ # Fallback: try curl
113+ elif curl -sL --max-time 10 https://bellard.org/bpg/bpg-0.9.8.tar.gz -o bpg-0.9.8.tar.gz 2>/dev/null; then
114+ echo "✅ Downloaded BPG source using curl"
115+ BPG_DOWNLOADED=true
116+ # Alternative source (if available)
117+ elif wget -q --timeout=10 https://github.com/mirrorer/libbpg/archive/refs/heads/master.tar.gz -O bpg-master.tar.gz 2>/dev/null; then
118+ echo "✅ Downloaded BPG source from alternative location"
119+ tar xzf bpg-master.tar.gz
120+ mv libbpg-master bpg-0.9.8
121+ BPG_DOWNLOADED=true
122+ fi
123+
124+ if [ "$BPG_DOWNLOADED" = true ]; then
85125 echo "✅ Downloaded BPG source"
86126 tar xzf bpg-0.9.8.tar.gz
87127 cd bpg-0.9.8
88128
89129 # Try to compile BPG tools
90130 echo "🔨 Attempting to compile BPG tools..."
91- if make 2>&1; then
131+
132+ # Redirect make output to avoid stdout issues
133+ if make > make_output.log 2>&1; then
92134 echo "✅ BPG compilation successful"
135+ cat make_output.log | tail -n 10 # Show last 10 lines of build log
93136
94137 # Install to user bin directory
95138 if cp bpgenc bpgdec "$BPG_BIN_DIR/" 2>/dev/null; then
@@ -107,7 +150,8 @@ jobs:
107150 fi
108151 else
109152 echo "⚠️ BPG compilation failed - this is non-critical"
110- echo "🔍 Make output was shown above for debugging"
153+ echo "🔍 Build log (last 20 lines):"
154+ cat make_output.log | tail -n 20 || echo "No build log available"
111155 echo "📝 BPG-dependent tests will be skipped"
112156 fi
113157 else
0 commit comments