Skip to content

Commit

Permalink
Refactor workflows into scripts [skip ci]
Browse files Browse the repository at this point in the history
Remove bintray
  • Loading branch information
shivammathur committed Mar 20, 2021
1 parent 03688d5 commit 970efe8
Show file tree
Hide file tree
Showing 14 changed files with 185 additions and 350 deletions.
91 changes: 0 additions & 91 deletions .github/workflows/dispatch-all-php-intl.yml

This file was deleted.

50 changes: 0 additions & 50 deletions .github/workflows/dispatch-single-icu.yaml

This file was deleted.

27 changes: 27 additions & 0 deletions .github/workflows/dispatch-single-icu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: 'dispatch-single-icu'
on:
workflow_dispatch:
inputs:
icu:
description: ICU version
required: true
jobs:
icu:
runs-on: ubuntu-latest
name: icu4c
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build icu
env:
ICU: ${{ github.event.inputs.icu }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WORKSPACE: ${{ github.workspace }}
run: |
existing_version=$(gh release view icu4c 2>/dev/null | grep -Po $ICU | head -n 1)
if [ "$ICU" != "$existing_version" ]; then
bash src/build-icu4c.sh
bash src/release-icu4c.sh
else
echo "icu4c $ICU build exists"
fi
80 changes: 14 additions & 66 deletions .github/workflows/dispatch-single-php-intl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,94 +2,42 @@ name: 'dispatch-single-php-intl'
on:
workflow_dispatch:
inputs:
php:
description: PHP version
required: true
icu:
description: ICU version
required: true

jobs:
php-intl:
container: ubuntu:bionic
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
name: php-intl
steps:
- name: ${{github.event.inputs.php}}
id: print_details
run: |
echo sender=${{github.event.sender.login}}
echo PHP=${{github.event.inputs.php}}
echo ICU=${{github.event.inputs.icu}}
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
- name: Update intl
env:
ICU: ${{github.event.inputs.icu}}
BINTRAY_KEY: ${{ secrets.bintray_key }}
BINTRAY_REPO: icu4c
BINTRAY_USER: ${{ github.repository_owner }}
VERSION: ${{github.event.inputs.php}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ICU: ${{ github.event.inputs.icu }}
REPO: ${{ github.repository }}
VERSION: ${{ matrix.php }}
WORKSPACE: ${{ github.workspace }}
run: |
apt-get -y update
apt-get install -y sudo curl
existing_version=$(curl --user "$BINTRAY_USER":"$BINTRAY_KEY" -s https://api.bintray.com/packages/"$BINTRAY_USER"/"$BINTRAY_REPO"/php-intl | grep -Po "$VERSION-$ICU" | head -n 1)
existing_version=$(gh release view intl 2>/dev/null | grep -Po "$VERSION-$ICU" | head -n 1)
if [ "$VERSION-$ICU" != "$existing_version" ]; then
sudo apt-get install -y gnupg make automake zstd software-properties-common pkg-config
LC_ALL=C.UTF-8 sudo DEBIAN_FRONTEND=noninteractive apt-add-repository ppa:ondrej/php -y
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php$VERSION php$VERSION-xml php$VERSION-dev
ext_dir=$(php -i | grep "extension_dir => /" | sed -e "s|.*=> s*||")
scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
pecl_file="$scan_dir"/99-pecl.ini
get_tag() {
echo "php-$(php -v | head -n 1 | cut -f 2 -d ' ' | cut -f 1 -d '-')"
}
get_php() {
curl -sL "https://github.com/php/php-src/archive/$tag.tar.gz" | tar xzf - -C "/tmp"
}
check_extension() {
extension=$1
if [ "$extension" != "mysql" ]; then
php -m | grep -i -q -w "$extension"
else
php -m | grep -i -q "$extension"
fi
}
enable_extension() {
if ! check_extension "$1" && [ -e "$ext_dir/$1.so" ]; then
echo "$2=$1.so" >>"$pecl_file"
fi
}
install_icu() {
sudo curl -o /tmp/icu.tar.zst -sL https://dl.bintray.com/shivammathur/icu4c/icu4c-$ICU.tar.zst
sudo tar -I zstd -xf /tmp/icu.tar.zst -C /usr/local
sudo cp -r /usr/local/icu/* /usr/
sudo cp -r /usr/local/icu/lib/* /usr/lib/x86_64-linux-gnu/
}
install_intl() {
tag=$(get_tag)
get_php
(
cd "/tmp/php-src-$tag/ext/intl" || exit 1
phpize && sudo ./configure --with-php-config="$(command -v php-config)" --enable-intl
echo "#define FALSE 0" >> config.h
echo "#define TRUE 1" >> config.h
sudo make CXXFLAGS="-O2 -std=c++11 -DU_USING_ICU_NAMESPACE=1 -DTRUE=1 -DFALSE=0 $CXXFLAGS"
sudo cp ./modules/* "$ext_dir/"
enable_extension intl extension
)
}
install_icu
install_intl
icu_version=$(php -i | grep "ICU version =>" | sed -e "s|.*=> s*||")
[ "$icu_version" != "$ICU" ] && exit 1
cd "$ext_dir" || exit 1
curl --user "$BINTRAY_USER":"$BINTRAY_KEY" -X DELETE https://api.bintray.com/content/"$BINTRAY_USER"/"$BINTRAY_REPO"/php"$VERSION"-intl-"$ICU".so || true
curl --user "$BINTRAY_USER":"$BINTRAY_KEY" -T intl.so https://api.bintray.com/content/"$BINTRAY_USER"/"$BINTRAY_REPO"/php-intl/"$VERSION-$ICU"/php"$VERSION"-intl-"$ICU".so || true
curl --user "$BINTRAY_USER":"$BINTRAY_KEY" -X POST https://api.bintray.com/content/"$BINTRAY_USER"/"$BINTRAY_REPO"/php-intl/"$VERSION-$ICU"/publish || true
bash src/build-intl.sh
bash src/release-intl.sh
else
echo "intl $VERSION-$ICU build exists"
fi
49 changes: 0 additions & 49 deletions .github/workflows/icu.yaml

This file was deleted.

27 changes: 27 additions & 0 deletions .github/workflows/icu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: 'icu'
on:
workflow_dispatch:
jobs:
icu:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
icu: [50.2, 51.3, 52.2, 53.2, 54.2, 55.2, 56.2, 57.2, 58.3, 59.2, 60.3, 61.2, 62.2, 63.2, 64.2, 65.1, 66.1, 67.1, 68.1, 68.2]
name: icu4c
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build icu
env:
ICU: ${{ matrix.icu }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WORKSPACE: ${{ github.workspace }}
run: |
existing_version=$(gh release view icu4c 2>/dev/null | grep -Po $ICU | head -n 1)
if [ "$ICU" != "$existing_version" ]; then
bash src/build-icu4c.sh
bash src/release-icu4c.sh
else
echo "icu4c $ICU build exists"
fi
Loading

0 comments on commit 970efe8

Please sign in to comment.