Skip to content

Commit

Permalink
modify system libs step
Browse files Browse the repository at this point in the history
Split the system libraries installation into separate steps for Ubuntu and macOS for better error handling
Added a retry mechanism for Homebrew installations on macOS
Added proper environment variable setup for jpeg on macOS
Removed the duplicate cache restore step
Added proper error handling with multiple attempts for package installation

The main improvements are in the "System Libraries (macOS)" step where we:

Update Homebrew first
Install packages one at a time with retry logic (up to 3 attempts)
Add proper waiting time between retries
Set up all the necessary environment variables for jpeg
  • Loading branch information
alex-silverman authored Feb 20, 2025
1 parent 4041019 commit 314d24b
Showing 1 changed file with 38 additions and 10 deletions.
48 changes: 38 additions & 10 deletions .github/workflows/installation_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,45 @@ jobs:
key: ${{ runner.os }}-R-${{ matrix.r-version }}-${{ hashFiles('**/DESCRIPTION') }}
restore-keys: ${{ runner.os }}-R-${{ matrix.r-version }}-

- name: System Libraries
if: runner.os != 'Windows'
- name: System Libraries (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then
sudo apt-get update
sudo apt-get install -y libfontconfig1-dev libudunits2-dev libcairo2-dev libcurl4-openssl-dev \
libharfbuzz-dev libfribidi-dev libfreetype6-dev libpng-dev libtiff5-dev \
libjpeg-dev libgdal-dev libgeos-dev libproj-dev
elif [ "${{ matrix.os }}" == "macOS-latest" ]; then
brew install freetype udunits cairo harfbuzz fribidi libpng libtiff jpeg gdal pkg-config
fi
sudo apt-get update
sudo apt-get install -y \
libfontconfig1-dev \
libudunits2-dev \
libcairo2-dev \
libcurl4-openssl-dev \
libharfbuzz-dev \
libfribidi-dev \
libfreetype6-dev \
libpng-dev \
libtiff5-dev \
libjpeg-dev \
libgdal-dev \
libgeos-dev \
libproj-dev
- name: System Libraries (macOS)
if: matrix.os == 'macOS-latest'
run: |
brew update
# Install dependencies one by one with retry mechanism
for pkg in freetype udunits cairo harfbuzz fribidi libpng libtiff jpeg gdal pkg-config; do
for i in {1..3}; do
if brew install $pkg; then
break
fi
echo "Attempt $i to install $pkg failed. Retrying..."
sleep 5
done
done
# Set up environment variables for jpeg
echo 'export PATH="/opt/homebrew/opt/jpeg/bin:$PATH"' >> $GITHUB_ENV
echo 'export LDFLAGS="-L/opt/homebrew/opt/jpeg/lib"' >> $GITHUB_ENV
echo 'export CPPFLAGS="-I/opt/homebrew/opt/jpeg/include"' >> $GITHUB_ENV
echo 'export PKG_CONFIG_PATH="/opt/homebrew/opt/jpeg/lib/pkgconfig"' >> $GITHUB_ENV
- name: Get latest tar.gz URL
if: matrix.install-method == 'url'
Expand Down

0 comments on commit 314d24b

Please sign in to comment.