-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14702 from phalcon/4.0.x
4.0.1
- Loading branch information
Showing
314 changed files
with
369,571 additions
and
367,832 deletions.
There are no files selected for viewing
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,111 @@ | ||
<?php | ||
|
||
namespace PhalconCi; | ||
|
||
class PackageCloud | ||
{ | ||
protected const API_ENDPOINT = "packagecloud.io"; | ||
|
||
private $apiKey; | ||
private $user; | ||
private $repo; | ||
|
||
public function __construct($apiKey, $user, $repo) | ||
{ | ||
$this->apiKey = $apiKey; | ||
$this->user = $user; | ||
$this->repo = $repo; | ||
} | ||
|
||
protected function buildRequestUrl($url) | ||
{ | ||
$baseUrl = "https://" . $this->apiKey . ":@" . self::API_ENDPOINT; | ||
return $baseUrl . $url; | ||
} | ||
|
||
protected function getCurl() | ||
{ | ||
$ch = curl_init(); | ||
curl_setopt($ch, CURLOPT_TIMEOUT, 30); | ||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | ||
|
||
return $ch; | ||
} | ||
|
||
public function query($url) | ||
{ | ||
echo "Opening: " . $url . PHP_EOL; | ||
|
||
$ch = $this->getCurl(); | ||
|
||
curl_setopt($ch, CURLOPT_URL, $this->buildRequestUrl($url)); | ||
|
||
if (false === ($retval = curl_exec($ch))) { | ||
print_r(curl_error($ch)); | ||
curl_close($ch); | ||
} else { | ||
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); | ||
curl_close($ch); | ||
switch ($httpCode) { | ||
case "200": | ||
return json_decode($retval); | ||
break; | ||
default: | ||
exit("Unable to connect to api"); | ||
} | ||
} | ||
} | ||
|
||
public function getOutdatedPackages($days = 30) | ||
{ | ||
$now = new \DateTime(); | ||
|
||
$packages = $this->query("/api/v1/repos/" . $this->user . "/" . $this->repo . "/packages.json?per_page=100"); | ||
$outdatedPackages = []; | ||
foreach ($packages as $package) { | ||
$packageDate = \DateTime::createFromFormat("Y-m-d\TH:i:s.u\Z", $package->created_at); | ||
$age = $packageDate->diff($now)->days; | ||
if ($age > $days) { | ||
$package->age = $age; | ||
$outdatedPackages[] = $package; | ||
} | ||
} | ||
return $outdatedPackages; | ||
} | ||
|
||
public function deleteOutdatedPackages($days = 30) | ||
{ | ||
$packages = $this->getOutdatedPackages($days); | ||
foreach ($packages as $package) { | ||
$this->deletePackage($package->destroy_url, $package->age); | ||
} | ||
} | ||
|
||
public function deletePackage($packageUrl, $age) | ||
{ | ||
echo "Deleting: " . $packageUrl . " [" . $age . " days old]... "; | ||
$ch = $this->getCurl(); | ||
|
||
curl_setopt($ch, CURLOPT_URL, $this->buildRequestUrl($packageUrl)); | ||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); | ||
|
||
if (false === ($retval = curl_exec($ch))) { | ||
print_r(curl_error($ch)); | ||
curl_close($ch); | ||
} else { | ||
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); | ||
curl_close($ch); | ||
switch ($httpCode) { | ||
case "200": | ||
echo "done" . PHP_EOL; | ||
break; | ||
default: | ||
echo "fail" . PHP_EOL; | ||
} | ||
return json_decode($retval); | ||
} | ||
} | ||
} | ||
|
||
$packageCloud = new PackageCloud(getenv('PACKAGECLOUD_TOKEN'), "phalcon", "nightly"); | ||
$packageCloud->deleteOutdatedPackages(30); //days |
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
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,17 @@ | ||
name: Cleanup Packagecloud packages | ||
on: | ||
schedule: | ||
- cron: '0 2 * * *' # Daily at 02:00 | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@master | ||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v1 | ||
with: | ||
php-version: '7.4' | ||
- name: Cleanup Packagecloud | ||
run: php .ci/cleanup-packages.php | ||
env: | ||
PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }} |
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,92 @@ | ||
name: Pecl builder | ||
|
||
on: | ||
create: | ||
tags: | ||
push: | ||
paths: | ||
- .github/workflows/pecl.yml | ||
- package.xml | ||
- 'build/php7/safe/**' | ||
- LICENSE.txt | ||
- CHANGELOG-4.0.md | ||
- CODE_OF_CONDUCT.md | ||
- CODE_OWNERS.TXT | ||
pull_request: | ||
paths: | ||
- .github/workflows/pecl.yml | ||
- package.xml | ||
- 'build/php7/safe/**' | ||
- LICENSE.txt | ||
- CHANGELOG-4.0.md | ||
- CODE_OF_CONDUCT.md | ||
- CODE_OWNERS.TXT | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
name: Build Phalcon Pecl Package | ||
steps: | ||
- name: Show system info | ||
run: uname -m | ||
- name: Git checkout | ||
uses: actions/checkout@v2-beta | ||
with: | ||
fetch-depth: 1 | ||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v1 | ||
with: | ||
php-version: '7.4' | ||
extensions: mbstring, intl, json | ||
pecl: true | ||
- name: Create pecl package | ||
id: pecl_create | ||
run: | | ||
cp build/php7/safe/config.w32 config.w32 | ||
cp build/php7/safe/phalcon.zep.c phalcon.zep.c | ||
cp build/php7/safe/config.m4 config.m4 | ||
cp build/php7/safe/php_phalcon.h php_phalcon.h | ||
cp build/php7/safe/phalcon.zep.h phalcon.zep.h | ||
pecl package | ||
phalcon_package="`ls | grep phalcon-*tgz`" | ||
mv $phalcon_package phalcon-pecl.tgz | ||
- name: Validate pecl package | ||
run: pecl package-validate phalcon-pecl.tgz | ||
- uses: actions/upload-artifact@v1 | ||
with: | ||
name: 'phalcon-pecl' | ||
path: phalcon-pecl.tgz | ||
install-nix: | ||
needs: build | ||
runs-on: ${{ matrix.operating-system }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
operating-system: [ubuntu-latest, macOS-latest] | ||
php-versions: ['7.2', '7.3', '7.4'] | ||
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }} | ||
steps: | ||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v1 | ||
with: | ||
php-version: ${{ matrix.php-versions }} | ||
extensions: mbstring, intl, json | ||
pecl: true | ||
- name: Testing PHP version | ||
run: | | ||
php -m | ||
php -v | head -n 1 | ||
php-cgi -v | head -n 1 | ||
phpdbg -V | head -n 1 | ||
pecl -V | ||
php-config --version | ||
phpize -v | ||
- name: Download phalcon pecl package | ||
uses: actions/download-artifact@v1 | ||
with: | ||
name: phalcon-pecl | ||
- name: Install package | ||
run: | | ||
export MAKEFLAGS="-j$(getconf _NPROCESSORS_ONLN)" | ||
sudo pecl -v install phalcon-pecl/phalcon-pecl.tgz | ||
- name: Verify install | ||
run: php -m | grep phalcon |
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,30 @@ | ||
This file is a list of the people responsible for ensuring that patches for a | ||
particular part of Phalcon are reviewed, either by themselves or by someone | ||
else. They are also the gatekeepers for their part of Phalcon, with the final | ||
word on what goes in or not. | ||
|
||
The list is sorted by last name and formatted to allow easy grepping and | ||
beautification by scripts. The fields are: name (N), email (E), web-address | ||
(W), PGP key ID and fingerprint (P), description (D), and snail-mail address | ||
(S). | ||
|
||
The sample of querying command to search PECL keyword: | ||
awk -v RS='' -v ORS='\n\n' '/\nD: .*PECL/' CODE_OWNERS.TXT | ||
|
||
N: Ruud Boon | ||
E: ruud@phalcon.io | ||
W: https://ruudboon.io | ||
P: 0xF2E9F914DFA1BCD7 | ||
D: PECL and all parts of Phalcon not covered by someone else | ||
|
||
N: Nikolaos Dimopoulos | ||
E: niden@phalcon.io | ||
W: https://niden.net | ||
P: 0x93F8CA07B9C8C41D | ||
D: All parts of Phalcon not covered by someone else excluding PECL | ||
|
||
N: Serghei Iakovlev | ||
E: serghei@phalcon.io | ||
W: https://serghei.blog | ||
P: 0x1E0B5331219BEA88 | ||
D: CI/CD Integration, Zephir support, Parsers and Scanners, Volt, Annotation, PHQL support |
Oops, something went wrong.