1+ name : Cache PHP
2+ on :
3+ - push
4+ - repository_dispatch
5+ jobs :
6+ package :
7+ runs-on : ${{ matrix.operating-system }}
8+ strategy :
9+ fail-fast : false
10+ matrix :
11+ operating-system : [ubuntu-20.04, ubuntu-18.04, ubuntu-16.04]
12+ php-versions : ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4']
13+ name : PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
14+ steps :
15+ - name : Checkout
16+ uses : actions/checkout@v2
17+
18+ - name : Clean PHP
19+ run : |
20+ sudo rm -rf /var/cache/apt/archives/*
21+ sudo apt-get remove php*
22+
23+ - name : Restore PHP
24+ run : |
25+ curl -o /tmp/php.sh -sSL https://raw.githubusercontent.com/actions/virtual-environments/master/images/linux/scripts/installers/php.sh
26+ sudo bash /tmp/php.sh || true
27+ - name : Setup PHP
28+ uses : shivammathur/setup-php@develop
29+ with :
30+ php-version : ${{ matrix.php-versions }}
31+ env :
32+ update : true
33+ use_package_cache : false
34+
35+ - name : Test PHP version
36+ run : php -v && php -m
37+
38+ - name : Upload
39+ env :
40+ BINTRAY_KEY : ${{ SECRETS.BINTRAY_KEY }}
41+ BINTRAY_USER : shivammathur
42+ BINTRAY_REPO : php
43+ GITHUB_REPOSITORY : ${{ github.repository }}
44+ VERSION : ${{ matrix.php-versions }}
45+ run : |
46+ . /etc/lsb-release
47+ SEMVER=$(php -v | head -n 1 | cut -f 2 -d ' ' | cut -f 1 -d '-')
48+ curl \
49+ --user "$BINTRAY_USER":"$BINTRAY_KEY" \
50+ --header "Content-Type: application/json" \
51+ --data " \
52+ {\"name\": \"$VERSION-linux\", \
53+ \"vcs_url\": \"$GITHUB_REPOSITORY\", \
54+ \"licenses\": [\"MIT\"], \
55+ \"public_download_numbers\": true, \
56+ \"public_stats\": true \
57+ }" \
58+ https://api.bintray.com/packages/"$BINTRAY_USER"/"$BINTRAY_REPO" || true
59+ curl -sSLO http://archive.ubuntu.com/ubuntu/pool/main/g/gcc-10/gcc-10-base_10-20200411-0ubuntu1_amd64.deb
60+ curl -sSLO http://archive.ubuntu.com/ubuntu/pool/main/g/gcc-10/libgcc-s1_10-20200411-0ubuntu1_amd64.deb
61+ curl -sSLO http://archive.ubuntu.com/ubuntu/pool/universe/libz/libzstd/zstd_1.4.4+dfsg-3_amd64.deb
62+ sudo DEBIAN_FRONTEND=noninteractive dpkg -i --force-conflicts ./*.deb
63+ sudo rm -rf ./*.deb
64+ zstd -V
65+ mkdir "$VERSION" && sudo mv /var/cache/apt/archives/*.deb ./"$VERSION"/
66+ sudo tar cf - "$VERSION" | zstd -22 -T0 --ultra > php_"$VERSION"+ubuntu"$DISTRIB_RELEASE".tar.zst
67+ cp php_"$VERSION"+ubuntu"$DISTRIB_RELEASE".tar.zst php_"$SEMVER"+ubuntu"$DISTRIB_RELEASE".tar.zst
68+ curl --user "$BINTRAY_USER":"$BINTRAY_KEY" -X DELETE https://api.bintray.com/content/"$BINTRAY_USER"/"$BINTRAY_REPO"/php_"$VERSION"+ubuntu"$DISTRIB_RELEASE".tar.zst || true
69+ curl --user "$BINTRAY_USER":"$BINTRAY_KEY" -X DELETE https://api.bintray.com/content/"$BINTRAY_USER"/"$BINTRAY_REPO"/php_"$SEMVER"+ubuntu"$DISTRIB_RELEASE".tar.zst || true
70+ curl --user "$BINTRAY_USER":"$BINTRAY_KEY" -T php_"$VERSION"+ubuntu"$DISTRIB_RELEASE".tar.zst https://api.bintray.com/content/shivammathur/php/"$VERSION"-linux/"$VERSION"+ubuntu"$DISTRIB_RELEASE"/php_"$VERSION"+ubuntu"$DISTRIB_RELEASE".tar.zst || true
71+ curl --user "$BINTRAY_USER":"$BINTRAY_KEY" -T php_"$SEMVER"+ubuntu"$DISTRIB_RELEASE".tar.zst https://api.bintray.com/content/shivammathur/php/"$VERSION"-linux/"$VERSION"+ubuntu"$DISTRIB_RELEASE"/php_"$SEMVER"+ubuntu"$DISTRIB_RELEASE".tar.zst || true
72+ curl --user "$BINTRAY_USER":"$BINTRAY_KEY" -X POST https://api.bintray.com/content/"$BINTRAY_USER"/"$BINTRAY_REPO"/"$VERSION"-linux/"$VERSION"+ubuntu"$DISTRIB_RELEASE"/publish || true
0 commit comments