-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cache same PHP packages for all versions Refactor workflow Remove bintray and use cloudsmith for build mirror Use latest zstd from homebrew
- Loading branch information
1 parent
0fd502b
commit 1693db3
Showing
12 changed files
with
186 additions
and
134 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: Cache PHP | ||
on: | ||
- push | ||
- repository_dispatch | ||
- workflow_dispatch | ||
jobs: | ||
cache: | ||
container: ubuntu:${{ matrix.container }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
container: [20.04, 18.04, 16.04] | ||
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0'] | ||
if: "!contains(github.event.head_commit.message, 'skip-build')" | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Install requirements | ||
run: bash src/install-requirements.sh | ||
- name: Set up Homebrew | ||
env: | ||
HOMEBREW_FORCE_HOMEBREW_ON_LINUX: 1 | ||
uses: shivammathur/actions/setup-homebrew@shivammathur-patch-git-retry | ||
- name: Install zstd | ||
run: bash src/install-zstd.sh | ||
- name: Configure git | ||
run: bash src/configure-git.sh | ||
- name: Setup PHP | ||
env: | ||
PHP_VERSION: ${{ matrix.php-versions }} | ||
run: bash src/install-php.sh | ||
- name: Build package | ||
env: | ||
GITHUB_WORKSPACE: ${{ github.workspace }} | ||
PHP_VERSION: ${{ matrix.php-versions }} | ||
run: bash src/package.sh | ||
- name: Upload Artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: ${{ matrix.php-versions }} | ||
path: builds | ||
release: | ||
runs-on: ubuntu-latest | ||
needs: cache | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- run: mkdir builds | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
path: builds | ||
- name: Setup Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.x | ||
- name: Install cloudsmith-cli | ||
run: pip install --upgrade cloudsmith-cli | ||
- name: Release | ||
run: bash src/release.sh | ||
env: | ||
CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }} | ||
GITHUB_REPOSITORY: ${{ github.repository }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GITHUB_WORKSPACE: ${{ github.workspace }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
set -x | ||
|
||
cd / || exit 1 | ||
git config --global user.email "[email protected]" | ||
git init | ||
git add /bin /lib /lib64 /sbin /usr /var | ||
find /etc -maxdepth 1 -mindepth 1 -type d -exec git add {} \; | ||
git commit -m "init" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
set -x | ||
|
||
cd /tmp || exit | ||
curl -o /tmp/php.sh -sSL https://raw.githubusercontent.com/actions/virtual-environments/main/images/linux/scripts/installers/php.sh | ||
sed -i "s/^php_versions.*/php_versions=$PHP_VERSION/" /tmp/php.sh | ||
sed -i '/ snmp\|php-pear\|composer\|phpunit\|invoke_tests\|source/d' /tmp/php.sh | ||
sudo DEBIAN_FRONTEND=noninteractive bash /tmp/php.sh || true | ||
sudo rm -rf /var/cache/apt/archives/*.deb || true | ||
for extension in ast imagick pcov raphf propro http; do | ||
sudo apt-get install "php$PHP_VERSION-$extension" -y || true | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
set -x | ||
|
||
export _APTMGR=apt-get | ||
apt-get update && apt-get install -y curl sudo software-properties-common | ||
add-apt-repository ppa:git-core/ppa | ||
add-apt-repository ppa:apt-fast/stable | ||
LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php | ||
apt-get update | ||
DEBIAN_FRONTEND=noninteractive apt-get install -y git sudo apt-fast gcc make automake pkg-config shtool snmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
set -x | ||
|
||
brew install zstd | ||
zstd -V |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env bash | ||
|
||
get() { | ||
file_path=$1 | ||
shift | ||
links=("$@") | ||
for link in "${links[@]}"; do | ||
status_code=$(sudo curl -w "%{http_code}" -o "$file_path" -sL "$link") | ||
[ "$status_code" = "200" ] && break | ||
done | ||
} | ||
|
||
install() { | ||
sudo mkdir -p /tmp/php | ||
get /tmp/"$tar_file" "https://github.com/shivammathur/php-ubuntu/releases/latest/download/$tar_file" "https://dl.cloudsmith.io/public/shivammathur/php-ubuntu/raw/files/$tar_file" | ||
sudo tar -I zstd -xf /tmp/"$tar_file" -C / | ||
} | ||
|
||
. /etc/lsb-release | ||
version=$1 | ||
tar_file=php_"$version"%2Bubuntu"$DISTRIB_RELEASE".tar.zst | ||
install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
set -x | ||
|
||
cd / || exit 1 | ||
git add /bin /lib /lib64 /sbin /usr /var | ||
find /etc -maxdepth 1 -mindepth 1 -type d -exec git add {} \; | ||
git commit -m "installed php" | ||
mkdir -p /tmp/php | ||
for file in $(git log -p -n 1 --name-only | sed 's/^.*\(\s\).*$/\1/' | xargs -L1 echo); do | ||
sudo cp -r -p --parents "$file" /tmp/php || true | ||
done | ||
|
||
. /etc/lsb-release | ||
SEMVER="$(php -v | head -n 1 | cut -f 2 -d ' ' | cut -f 1 -d '-')" | ||
( | ||
cd /tmp/php || exit 1 | ||
sudo tar cf - ./* | zstd -22 -T0 --ultra > ../php_"$PHP_VERSION"+ubuntu"$DISTRIB_RELEASE".tar.zst | ||
cp ../php_"$PHP_VERSION"+ubuntu"$DISTRIB_RELEASE".tar.zst ../php_"$SEMVER"+ubuntu"$DISTRIB_RELEASE".tar.zst | ||
) | ||
cd "$GITHUB_WORKSPACE" || exit 1 | ||
mkdir builds | ||
sudo mv /tmp/*.zst ./builds |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
set -x | ||
|
||
release_cds() { | ||
for asset in ./builds/*/*; do | ||
assets+=("$asset") | ||
cloudsmith push raw "$repo" "$asset" --republish --summary "$asset" --description "$asset" & | ||
to_wait+=("$!") | ||
done | ||
} | ||
|
||
release_create() { | ||
curl -o install.sh -sL https://dl.cloudsmith.io/public/"$repo"/raw/files/php-ubuntu.sh | ||
release_cds | ||
assets+=("./install.sh") | ||
gh release create "builds" "${assets[@]}" -n "builds $version" -t "builds" | ||
} | ||
|
||
release_upload() { | ||
gh release download -p "build.log" || true | ||
release_cds | ||
gh release upload "builds" "${assets[@]}" --clobber | ||
} | ||
|
||
log() { | ||
echo "$version" | sudo tee -a build.log | ||
gh release upload "builds" build.log --clobber | ||
} | ||
|
||
version=$(date '+%Y.%m.%d') | ||
repo="$GITHUB_REPOSITORY" | ||
assets=() | ||
to_wait=() | ||
cd "$GITHUB_WORKSPACE" || exit 1 | ||
if ! gh release view builds; then | ||
release_create | ||
else | ||
release_upload | ||
fi | ||
wait "${to_wait[@]}" | ||
log |