Skip to content

Commit 5269af8

Browse files
committed
Initial commit
0 parents  commit 5269af8

File tree

3 files changed

+110
-0
lines changed

3 files changed

+110
-0
lines changed

.github/workflows/build.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
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

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 Shivam Mathur
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# PHP Ubuntu
2+
3+
<a href="https://github.com/shivammathur/php-ubuntu" title="PHP Package Cache"><img alt="Build status" src="https://github.com/shivammathur/php-ubuntu/workflows/Cache%20PHP/badge.svg"></a>
4+
<a href="https://github.com/shivammathur/php-ubuntu/blob/main/LICENSE" title="license"><img alt="LICENSE" src="https://img.shields.io/badge/license-MIT-428f7e.svg"></a>
5+
<a href="https://github.com/shivammathur/php-ubuntu/tree/main/builds" title="builds"><img alt="PHP Versions Supported" src="https://img.shields.io/badge/php-5.6%20to%207.4-8892BF.svg"></a>
6+
7+
> Cache PHP packages for installaing on GitHub Actions
8+
9+
## License
10+
11+
The code in this project is licensed under the [MIT license](LICENSE).
12+
13+
14+
## Dependencies
15+
16+
- [ppa:ondrej/php](https://launchpad.net/~ondrej/+archive/ubuntu/php "ppa:ondrej/php")
17+
- [actions/virtual-environments](https://github.com/actions/virtual-environments "actions/virtual-environments")

0 commit comments

Comments
 (0)