From f8a093ea306ce01f45936c6b34065ab57f6ccded Mon Sep 17 00:00:00 2001 From: capellancitizen Date: Wed, 28 Aug 2024 20:10:46 -0400 Subject: Additional CI Improvements (#3174) --- .github/workflows/build.yml | 26 +++++++++++++++----------- bin/build-linux | 32 ++++++++++++++++++++++++++++++++ bin/build-linux-dist | 29 ----------------------------- 3 files changed, 47 insertions(+), 40 deletions(-) create mode 100755 bin/build-linux delete mode 100755 bin/build-linux-dist diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f664d594..06d44177 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,18 +16,12 @@ jobs: - uses: actions/setup-python@v5 with: python-version: '3.9.x' - - uses: actions/cache@v4 - id: pip-cache - with: - path: ~/.cache/pip - key: ${{ runner.os }}-20.04-pip-${{ hashFiles('**/requirements.txt') }} - restore-keys: | - ${{ runner.os }}-20.04-pip- + cache: 'pip' - uses: actions/cache@v4 id: geos-build-cache with: path: geos/build - key: ${{ runner.os }}-20.04-geos-build-${{ hashFiles('bin/build-linux') }} + key: ${{ runner.os }}-20.04-geos-build-${{ hashFiles('**/bin/build-linux') }} restore-keys: | ${{ runner.os }}-20.04-geos-build- @@ -75,7 +69,13 @@ jobs: echo "${{ env.pythonLocation }}\bin" >> $GITHUB_PATH - shell: bash run: | - bin/build-linux-dist + bin/build-linux + - shell: bash + run: | + pytest + - shell: bash + run: | + make dist env: BUILD: linux INKSTITCH_GPG_KEY: ${{ secrets.INKSTITCH_GPG_KEY }} @@ -93,11 +93,12 @@ jobs: with: python-version: '3.8.x' architecture: 'x86' + cache: 'pip' - uses: actions/cache@v4 id: geos-build-cache with: path: geos - key: win32-geos-build-${{ hashFiles('bin/geos-win.cmd') }} + key: win32-geos-build-${{ hashFiles('**/bin/build-geos-win.cmd') }} restore-keys: | win32-geos-build- - uses: microsoft/setup-msbuild@v2 @@ -166,11 +167,12 @@ jobs: with: python-version: '3.8.x' architecture: 'x64' + cache: 'pip' - uses: actions/cache@v4 id: geos-build-cache with: path: geos - key: win64-geos-build-${{ hashFiles('bin/geos-win.cmd') }} + key: win64-geos-build-${{ hashFiles('**/bin/build-geos-win.cmd') }} restore-keys: | win64-geos-build- - uses: microsoft/setup-msbuild@v2 @@ -232,6 +234,7 @@ jobs: - uses: actions/setup-python@v5 with: python-version: '3.9.x' + cache: 'pip' - name: install dependencies shell: bash run: | @@ -293,6 +296,7 @@ jobs: - uses: actions/setup-python@v5 with: python-version: '3.9.x' + cache: 'pip' - name: install dependencies shell: bash run: | diff --git a/bin/build-linux b/bin/build-linux new file mode 100755 index 00000000..c7014658 --- /dev/null +++ b/bin/build-linux @@ -0,0 +1,32 @@ +#!/usr/bin/env bash +set -e +# creating folder to install geos +mkdir $HOME/geos-build +GEOS_PATH=$HOME/geos-build +# Downloading geos +curl -L -O https://github.com/libgeos/geos/releases/download/3.12.2/geos-3.12.2.tar.bz2 + +# uzipping geos into the geos directory +mkdir -p geos && cd geos +tar -xf ../geos-3.12.2.tar.bz2 --strip-components=1 +# Building geos +mkdir -p build && cd build && cmake -DCMAKE_INSTALL_PREFIX:PATH=$GEOS_PATH -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF .. +make && make install + +export PATH=$GEOS_PATH/bin:$PATH +export GEOS_INCLUDE_PATH=$GEOS_PATH/include +export GEOS_LIBRARY_PATH=$GEOS_PATH/lib +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GEOS_PATH/lib +if [ ! -z "$CI" ]; then + # Write the geos path to GITHUB_PATH so successive steps can use + echo $GEOS_PATH/bin >> $GITHUB_PATH + # Set these variables in GITHUB_ENV so successive steps can use them. + echo "GEOS_INCLUDE_PATH=$GEOS_INCLUDE_PATH" >> $GITHUB_ENV + echo "GEOS_LIBRARY_PATH=$GEOS_LIBRARY_PATH" >> $GITHUB_ENV + echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" >> $GITHUB_ENV +fi + +cd ../.. +python -m pip uninstall -y shapely +python -m pip cache remove shapely +python -m pip install -v shapely --no-binary shapely diff --git a/bin/build-linux-dist b/bin/build-linux-dist deleted file mode 100755 index 5b591f71..00000000 --- a/bin/build-linux-dist +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env bash -set -e -# creating folder to install geos -mkdir $HOME/geos-build -GEOS_PATH=$HOME/geos-build -# Downloading geos -curl -L -O https://github.com/libgeos/geos/releases/download/3.12.2/geos-3.12.2.tar.bz2 - -# uzipping geos into the geos directory -mkdir -p geos && cd geos -tar -xf ../geos-3.12.2.tar.bz2 --strip-components=1 -# Building geos -mkdir -p build && cd build && cmake -DCMAKE_INSTALL_PREFIX:PATH=$GEOS_PATH -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF .. -make && make install - -export PATH=$GEOS_PATH/bin:$PATH -export GEOS_INCLUDE_PATH=$GEOS_PATH/include -export GEOS_LIBRARY_PATH=$GEOS_PATH/lib -export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GEOS_PATH/lib -cd ../.. -python -m pip uninstall -y shapely -python -m pip cache remove shapely -python -m pip install -v shapely --no-binary shapely -# Future improvement might be to split this out so pytest is a separate step and line on the build log, -# but the LD_LIBRARY_PATH env var needs to be passed between those steps with step outputs or something. -# This works for now. -pytest -make dist - -- cgit v1.2.3