File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ # Prepares an Amp orb: installs PHP, Composer, project dependencies and the coding standard.
3+ set -euo pipefail
4+ cd " $( dirname " ${BASH_SOURCE[0]} " ) /.."
5+
6+ step () {
7+ echo " ==> $( basename " $PWD " ) : $* "
8+ SECONDS=0
9+ }
10+
11+ step " PHP"
12+ packages=(php8.2-cli php8.2-curl php8.2-intl php8.2-mbstring php8.2-xml php8.2-zip unzip)
13+ missing=()
14+ for package in " ${packages[@]} " ; do
15+ dpkg-query -W -f=' ${Status}' " $package " 2> /dev/null | grep -q ' install ok installed' || missing+=(" $package " )
16+ done
17+ if (( ${# missing[@]} )) ; then
18+ sudo apt-get update -qq
19+ sudo DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends " ${missing[@]} "
20+ fi
21+ echo " $( php -r ' echo PHP_VERSION;' ) (${SECONDS} s)"
22+
23+ step " Composer"
24+ if ! command -v composer > /dev/null 2>&1 ; then
25+ tmp=" $( mktemp -d) "
26+ curl -fsSL -o " $tmp /composer.phar" https://getcomposer.org/download/latest-stable/composer.phar
27+ curl -fsSL -o " $tmp /composer.phar.sha256sum" https://getcomposer.org/download/latest-stable/composer.phar.sha256sum
28+ (cd " $tmp " && sed ' s/ .*/ composer.phar/' composer.phar.sha256sum | sha256sum -c --quiet)
29+ sudo install -m 0755 " $tmp /composer.phar" /usr/local/bin/composer
30+ rm -rf " $tmp "
31+ fi
32+ echo " $( composer --version --no-ansi 2> /dev/null | head -n1) (${SECONDS} s)"
33+
34+ step " composer update"
35+ # There is no committed lockfile, so resolve like CI does.
36+ composer update --no-interaction --no-progress --quiet
37+ echo " (${SECONDS} s)"
38+
39+ step " make cs-install"
40+ make -s cs-install
41+ echo " (${SECONDS} s)"
Original file line number Diff line number Diff line change 33/vendor
44/composer.lock
55.phpunit.result.cache
6+ /.amp /portals /*
You can’t perform that action at this time.
0 commit comments