Skip to content

Commit

Permalink
ci(packages): Consolidate a handful of big-pkgs checks into a single …
Browse files Browse the repository at this point in the history
…docker-build variable
  • Loading branch information
finagolfin authored and licy183 committed Aug 7, 2024
1 parent 0510788 commit 8b99075
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions .github/workflows/packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ jobs:
with:
fetch-depth: 1000
- name: Gather build summary
id: build-info
run: |
if [ "${{ github.event_name }}" != "workflow_dispatch" ]; then
BASE_COMMIT=$(jq --raw-output .pull_request.base.sha "$GITHUB_EVENT_PATH")
Expand Down Expand Up @@ -155,16 +156,19 @@ jobs:
fi
done
docker='true'
[ -n "$packages" ] && if grep -qP "(^|\\s)${packages// /($|\\s)|(^|\\s)}($|\\s)" ./scripts/big-pkgs.list; then
docker='false'
fi
echo "docker-build=$docker" >> $GITHUB_OUTPUT
if [ "${{ github.event_name }}" != "workflow_dispatch" ]; then
# Build local Docker image if setup scripts were changed.
# Useful for pull requests submitting changes for both build environment and packages.
if grep -qP '^scripts/(Dockerfile|properties\.sh|setup-android-sdk\.sh|setup-ubuntu\.sh)$' <<< "$CHANGED_FILES"; then
echo "Detected changes for environment setup scripts. Building custom Docker image now."
if [ -n "$packages" ]; then
if grep -qP "(^|\\s)${packages// /($|\\s)|(^|\\s)}($|\\s)" ./scripts/big-pkgs.list; then
echo "Skipping due to building large packages."
exit 0
fi
if [ $docker == 'false' ]; then
echo "Skipping due to building large packages."
exit 0
fi
cd ./scripts
docker build -t ghcr.io/termux/package-builder:latest .
Expand Down Expand Up @@ -196,16 +200,14 @@ jobs:
fi
done
if [ -n "$packages" ]; then
if grep -qP "(^|\\s)${packages// /($|\\s)|(^|\\s)}($|\\s)" ./scripts/big-pkgs.list; then
./scripts/setup-ubuntu.sh
sudo apt install ninja-build
sudo apt purge -yq $(dpkg -l | grep '^ii' | awk '{ print $2 }' | grep -P '(aspnetcore|cabal-|dotnet-|ghc-|libmono|mongodb-|mysql-|php)') \
firefox google-chrome-stable google-cloud-cli microsoft-edge-stable mono-devel mono-runtime-common monodoc-manual powershell ruby
sudo apt autoremove -yq
sudo apt clean
sudo rm -fr /opt/ghc /opt/hostedtoolcache /usr/lib/node_modules /usr/local/share/boost /usr/share/dotnet /usr/share/swift
fi
if [ ${{ steps.build-info.outputs.docker-build }} == 'false' ]; then
./scripts/setup-ubuntu.sh
sudo apt install ninja-build
sudo apt purge -yq $(dpkg -l | grep '^ii' | awk '{ print $2 }' | grep -P '(aspnetcore|cabal-|dotnet-|ghc-|libmono|mongodb-|mysql-|php)') \
firefox google-chrome-stable google-cloud-cli microsoft-edge-stable mono-devel mono-runtime-common monodoc-manual powershell ruby
sudo apt autoremove -yq
sudo apt clean
sudo rm -fr /opt/ghc /opt/hostedtoolcache /usr/lib/node_modules /usr/local/share/boost /usr/share/dotnet /usr/share/swift
fi
- name: Build packages
Expand All @@ -218,12 +220,10 @@ jobs:
fi
done
if [ -n "$packages" ]; then
if grep -qP "(^|\\s)${packages// /($|\\s)|(^|\\s)}($|\\s)" ./scripts/big-pkgs.list; then
NDK=$ANDROID_NDK_LATEST_HOME ANDROID_HOME=$ANDROID_SDK_ROOT ./build-package.sh -I -a ${{ matrix.target_arch }} $packages
else
./scripts/run-docker.sh ./build-package.sh -I -a ${{ matrix.target_arch }} $packages
fi
if [ ${{ steps.build-info.outputs.docker-build }} == 'false' ]; then
NDK=$ANDROID_NDK ANDROID_HOME=$ANDROID_SDK_ROOT ./build-package.sh -I -a ${{ matrix.target_arch }} $packages
elif [ -n "$packages" ]; then
./scripts/run-docker.sh ./build-package.sh -I -a ${{ matrix.target_arch }} $packages
fi
- name: Generate build artifacts
Expand Down

0 comments on commit 8b99075

Please sign in to comment.