Skip to content

Commit 03688d5

Browse files
committed
Add dispatch workflows
1 parent d40bcfc commit 03688d5

File tree

3 files changed

+236
-0
lines changed

3 files changed

+236
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: 'dispatch-all-php-intl'
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
icu:
6+
description: ICU version
7+
required: true
8+
jobs:
9+
php-intl:
10+
container: ubuntu:bionic
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
php: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
15+
name: php-intl
16+
steps:
17+
- name: ${{github.event.inputs.php}}
18+
id: print_details
19+
run: |
20+
echo sender=${{github.event.sender.login}}
21+
echo ICU=${{github.event.inputs.icu}}
22+
- name: Checkout
23+
uses: actions/checkout@v2
24+
- name: Update intl
25+
env:
26+
ICU: ${{github.event.inputs.icu}}
27+
BINTRAY_KEY: ${{ secrets.bintray_key }}
28+
BINTRAY_REPO: icu4c
29+
BINTRAY_USER: ${{ github.repository_owner }}
30+
VERSION: ${{matrix.php}}
31+
run: |
32+
apt-get -y update
33+
apt-get install -y sudo curl
34+
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)
35+
if [ "$VERSION-$ICU" != "$existing_version" ]; then
36+
sudo apt-get install -y gnupg make automake zstd software-properties-common pkg-config
37+
LC_ALL=C.UTF-8 sudo DEBIAN_FRONTEND=noninteractive apt-add-repository ppa:ondrej/php -y
38+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php$VERSION php$VERSION-xml php$VERSION-dev
39+
ext_dir=$(php -i | grep "extension_dir => /" | sed -e "s|.*=> s*||")
40+
scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
41+
ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
42+
pecl_file="$scan_dir"/99-pecl.ini
43+
get_tag() {
44+
echo "php-$(php -v | head -n 1 | cut -f 2 -d ' ' | cut -f 1 -d '-')"
45+
}
46+
get_php() {
47+
curl -sL "https://github.com/php/php-src/archive/$tag.tar.gz" | tar xzf - -C "/tmp"
48+
}
49+
check_extension() {
50+
extension=$1
51+
if [ "$extension" != "mysql" ]; then
52+
php -m | grep -i -q -w "$extension"
53+
else
54+
php -m | grep -i -q "$extension"
55+
fi
56+
}
57+
enable_extension() {
58+
if ! check_extension "$1" && [ -e "$ext_dir/$1.so" ]; then
59+
echo "$2=$1.so" >>"$pecl_file"
60+
fi
61+
}
62+
install_icu() {
63+
sudo curl -o /tmp/icu.tar.zst -sL https://dl.bintray.com/shivammathur/icu4c/icu4c-$ICU.tar.zst
64+
sudo tar -I zstd -xf /tmp/icu.tar.zst -C /usr/local
65+
sudo cp -r /usr/local/icu/* /usr/
66+
sudo cp -r /usr/local/icu/lib/* /usr/lib/x86_64-linux-gnu/
67+
}
68+
install_intl() {
69+
tag=$(get_tag)
70+
get_php
71+
(
72+
cd "/tmp/php-src-$tag/ext/intl" || exit 1
73+
phpize && sudo ./configure --with-php-config="$(command -v php-config)" --enable-intl
74+
echo "#define FALSE 0" >> config.h
75+
echo "#define TRUE 1" >> config.h
76+
sudo make CXXFLAGS="-O2 -std=c++11 -DU_USING_ICU_NAMESPACE=1 -DTRUE=1 -DFALSE=0 $CXXFLAGS"
77+
sudo cp ./modules/* "$ext_dir/"
78+
enable_extension intl extension
79+
)
80+
}
81+
install_icu
82+
install_intl
83+
icu_version=$(php -i | grep "ICU version =>" | sed -e "s|.*=> s*||")
84+
[ "$icu_version" != "$ICU" ] && exit 1
85+
cd "$ext_dir" || exit 1
86+
curl --user "$BINTRAY_USER":"$BINTRAY_KEY" -X DELETE https://api.bintray.com/content/"$BINTRAY_USER"/"$BINTRAY_REPO"/php"$VERSION"-intl-"$ICU".so || true
87+
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
88+
curl --user "$BINTRAY_USER":"$BINTRAY_KEY" -X POST https://api.bintray.com/content/"$BINTRAY_USER"/"$BINTRAY_REPO"/php-intl/"$VERSION-$ICU"/publish || true
89+
else
90+
echo "intl $VERSION-$ICU build exists"
91+
fi
+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: 'dispatch-single-icu'
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
icu:
6+
description: ICU version
7+
required: true
8+
jobs:
9+
icu:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
fail-fast: false
13+
name: icu4c
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v2
17+
- name: Build icu
18+
env:
19+
ICU: ${{github.event.inputs.icu}}
20+
BINTRAY_KEY: ${{ secrets.bintray_key }}
21+
BINTRAY_REPO: icu4c
22+
BINTRAY_USER: ${{ github.repository_owner }}
23+
run: |
24+
existing_version=$(curl --user "$BINTRAY_USER":"$BINTRAY_KEY" -s https://api.bintray.com/packages/"$BINTRAY_USER"/"$BINTRAY_REPO"/icu4c | grep -Po $ICU | head -n 1)
25+
if [ "$ICU" != "$existing_version" ]; then
26+
sudo curl -o /tmp/icu.tgz -sL http://github.com/unicode-org/icu/releases/download/release-${ICU/./-}/icu4c-${ICU/./_}-src.tgz
27+
sudo tar -zxf /tmp/icu.tgz -C /tmp
28+
(
29+
cd /tmp/icu/source || exit 1
30+
sudo mkdir /usr/local/icu
31+
sudo ln -sf /usr/include/locale.h /usr/include/xlocale.h || true
32+
sudo ./configure --prefix=/usr/local/icu
33+
sudo make -j$(nproc)
34+
sudo make install
35+
)
36+
curl -sSLO http://archive.ubuntu.com/ubuntu/pool/main/g/gcc-10/gcc-10-base_10-20200411-0ubuntu1_amd64.deb
37+
curl -sSLO http://archive.ubuntu.com/ubuntu/pool/main/g/gcc-10/libgcc-s1_10-20200411-0ubuntu1_amd64.deb
38+
curl -sSLO http://archive.ubuntu.com/ubuntu/pool/universe/libz/libzstd/zstd_1.4.4+dfsg-3_amd64.deb
39+
sudo DEBIAN_FRONTEND=noninteractive dpkg -i --force-conflicts ./*.deb
40+
rm -rf ./*.deb
41+
zstd -V
42+
sudo chmod -R 777 /usr/local
43+
cd /usr/local || exit
44+
sudo tar cf - icu | zstd -22 -T0 --ultra > icu4c"$ICU".tar.zst
45+
curl --user "$BINTRAY_USER":"$BINTRAY_KEY" -X DELETE https://api.bintray.com/content/"$BINTRAY_USER"/"$BINTRAY_REPO"/icu4c"$ICU".tar.zst || true
46+
curl --user "$BINTRAY_USER":"$BINTRAY_KEY" -T icu4c"$ICU".tar.zst https://api.bintray.com/content/"$BINTRAY_USER"/"$BINTRAY_REPO"/icu4c/"$ICU"/icu4c-"$ICU".tar.zst || true
47+
curl --user "$BINTRAY_USER":"$BINTRAY_KEY" -X POST https://api.bintray.com/content/"$BINTRAY_USER"/"$BINTRAY_REPO"/icu4c/"$ICU"/publish || true
48+
else
49+
echo "icu4c $ICU build exists"
50+
fi
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: 'dispatch-single-php-intl'
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
php:
6+
description: PHP version
7+
required: true
8+
icu:
9+
description: ICU version
10+
required: true
11+
12+
jobs:
13+
php-intl:
14+
container: ubuntu:bionic
15+
runs-on: ubuntu-latest
16+
strategy:
17+
fail-fast: false
18+
name: php-intl
19+
steps:
20+
- name: ${{github.event.inputs.php}}
21+
id: print_details
22+
run: |
23+
echo sender=${{github.event.sender.login}}
24+
echo PHP=${{github.event.inputs.php}}
25+
echo ICU=${{github.event.inputs.icu}}
26+
- name: Checkout
27+
uses: actions/checkout@v2
28+
- name: Update intl
29+
env:
30+
ICU: ${{github.event.inputs.icu}}
31+
BINTRAY_KEY: ${{ secrets.bintray_key }}
32+
BINTRAY_REPO: icu4c
33+
BINTRAY_USER: ${{ github.repository_owner }}
34+
VERSION: ${{github.event.inputs.php}}
35+
run: |
36+
apt-get -y update
37+
apt-get install -y sudo curl
38+
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)
39+
if [ "$VERSION-$ICU" != "$existing_version" ]; then
40+
sudo apt-get install -y gnupg make automake zstd software-properties-common pkg-config
41+
LC_ALL=C.UTF-8 sudo DEBIAN_FRONTEND=noninteractive apt-add-repository ppa:ondrej/php -y
42+
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y php$VERSION php$VERSION-xml php$VERSION-dev
43+
ext_dir=$(php -i | grep "extension_dir => /" | sed -e "s|.*=> s*||")
44+
scan_dir=$(php --ini | grep additional | sed -e "s|.*: s*||")
45+
ini_file=$(php --ini | grep "Loaded Configuration" | sed -e "s|.*:s*||" | sed "s/ //g")
46+
pecl_file="$scan_dir"/99-pecl.ini
47+
get_tag() {
48+
echo "php-$(php -v | head -n 1 | cut -f 2 -d ' ' | cut -f 1 -d '-')"
49+
}
50+
get_php() {
51+
curl -sL "https://github.com/php/php-src/archive/$tag.tar.gz" | tar xzf - -C "/tmp"
52+
}
53+
check_extension() {
54+
extension=$1
55+
if [ "$extension" != "mysql" ]; then
56+
php -m | grep -i -q -w "$extension"
57+
else
58+
php -m | grep -i -q "$extension"
59+
fi
60+
}
61+
enable_extension() {
62+
if ! check_extension "$1" && [ -e "$ext_dir/$1.so" ]; then
63+
echo "$2=$1.so" >>"$pecl_file"
64+
fi
65+
}
66+
install_icu() {
67+
sudo curl -o /tmp/icu.tar.zst -sL https://dl.bintray.com/shivammathur/icu4c/icu4c-$ICU.tar.zst
68+
sudo tar -I zstd -xf /tmp/icu.tar.zst -C /usr/local
69+
sudo cp -r /usr/local/icu/* /usr/
70+
sudo cp -r /usr/local/icu/lib/* /usr/lib/x86_64-linux-gnu/
71+
}
72+
install_intl() {
73+
tag=$(get_tag)
74+
get_php
75+
(
76+
cd "/tmp/php-src-$tag/ext/intl" || exit 1
77+
phpize && sudo ./configure --with-php-config="$(command -v php-config)" --enable-intl
78+
echo "#define FALSE 0" >> config.h
79+
echo "#define TRUE 1" >> config.h
80+
sudo make CXXFLAGS="-O2 -std=c++11 -DU_USING_ICU_NAMESPACE=1 -DTRUE=1 -DFALSE=0 $CXXFLAGS"
81+
sudo cp ./modules/* "$ext_dir/"
82+
enable_extension intl extension
83+
)
84+
}
85+
install_icu
86+
install_intl
87+
icu_version=$(php -i | grep "ICU version =>" | sed -e "s|.*=> s*||")
88+
[ "$icu_version" != "$ICU" ] && exit 1
89+
cd "$ext_dir" || exit 1
90+
curl --user "$BINTRAY_USER":"$BINTRAY_KEY" -X DELETE https://api.bintray.com/content/"$BINTRAY_USER"/"$BINTRAY_REPO"/php"$VERSION"-intl-"$ICU".so || true
91+
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
92+
curl --user "$BINTRAY_USER":"$BINTRAY_KEY" -X POST https://api.bintray.com/content/"$BINTRAY_USER"/"$BINTRAY_REPO"/php-intl/"$VERSION-$ICU"/publish || true
93+
else
94+
echo "intl $VERSION-$ICU build exists"
95+
fi

0 commit comments

Comments
 (0)