Skip to content
This repository has been archived by the owner on Aug 18, 2021. It is now read-only.

Commit

Permalink
Build again --build-all (phalcon/cphalcon#15107)
Browse files Browse the repository at this point in the history
Improve code style and scripts

Only depends on PHP Tap for build and test

Cleanup Abstract classes
  • Loading branch information
shivammathur committed Jul 26, 2020
1 parent 2232e1b commit 5db2925
Show file tree
Hide file tree
Showing 5 changed files with 118 additions and 193 deletions.
24 changes: 13 additions & 11 deletions .github/scripts/build_phalcon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ add_log() {
step_log "Housekeeping"
unset HOMEBREW_DISABLE_LOAD_FORMULA
brew update-reset "$(brew --repository)" >/dev/null 2>&1
brew tap shivammathur/homebrew-php
add_log "$tick" "Housekeeping" "Done"

step_log "Adding tap $GITHUB_REPOSITORY"
Expand All @@ -44,8 +43,7 @@ fi
echo "existing label: $existing_version"
echo "new label: $new_version"

if [ "$new_version" != "$existing_version" ]; then
#if true; then
if [[ "$GITHUB_MESSAGE" = *--build-all* ]] || [ "$new_version" != "$existing_version" ]; then
step_log "Filling the Bottle"
sudo ln -sf "$PWD" "$(brew --prefix)/Homebrew/Library/Taps/$GITHUB_REPOSITORY"
brew test-bot "$HOMEBREW_BINTRAY_USER"/"$HOMEBREW_BINTRAY_REPO"/"$PHALCON_VERSION" --root-url=https://dl.bintray.com/"$HOMEBREW_BINTRAY_USER"/"$HOMEBREW_BINTRAY_REPO" --skip-setup --skip-recursive-dependents
Expand All @@ -70,20 +68,24 @@ if [ "$new_version" != "$existing_version" ]; then
add_log "$tick" "$package" "Bottle labeled"

step_log "Stocking the new Bottle"
git stash
sleep $((RANDOM % 200 + 1))s
git pull -f https://"$HOMEBREW_BINTRAY_USER":"$GITHUB_TOKEN"@github.com/"$GITHUB_REPOSITORY".git HEAD:master
git stash apply
if [ $(ls *.json 2>/dev/null | wc -l) != "0" ]; then
if [ "$(find . -name '*.json' | wc -l 2>/dev/null | wc -l)" != "0" ]; then
curl --user "$HOMEBREW_BINTRAY_USER":"$HOMEBREW_BINTRAY_KEY" -X DELETE https://api.bintray.com/packages/"$HOMEBREW_BINTRAY_USER"/"$HOMEBREW_BINTRAY_REPO"/"$package"/versions/"$new_version" >/dev/null 2>&1 || true
brew test-bot --ci-upload --tap="$GITHUB_REPOSITORY" --root-url=https://dl.bintray.com/"$HOMEBREW_BINTRAY_USER"/"$HOMEBREW_BINTRAY_REPO" --bintray-org="$HOMEBREW_BINTRAY_USER"
curl --user "$HOMEBREW_BINTRAY_USER":"$HOMEBREW_BINTRAY_KEY" -X POST https://api.bintray.com/content/"$HOMEBREW_BINTRAY_USER"/"$HOMEBREW_BINTRAY_REPO"/"$package"/"$new_version"/publish >/dev/null 2>&1 || true
add_log "$tick" "Phalcon $PHALCON_VERSION" "Bottle added to stock"


step_log "Updating inventory"
git push https://"$HOMEBREW_BINTRAY_USER":"$GITHUB_TOKEN"@github.com/"$GITHUB_REPOSITORY".git HEAD:master --follow-tags
add_log "$tick" "Inventory" "updated"
git config --local user.email homebrew-test-bot@lists.sfconservancy.org
git config --local user.name BrewTestBot
for try in $(seq 10); do
echo "try: $try" >/dev/null
git fetch origin master && git rebase origin/master
if git push https://"$GITHUB_REPOSITORY_OWNER":"$GITHUB_TOKEN"@github.com/"$GITHUB_REPOSITORY".git HEAD:master --follow-tags; then
break
else
sleep 3s
fi
done
else
add_log "$cross" "bottle" "broke"
fi
Expand Down
23 changes: 13 additions & 10 deletions .github/scripts/build_psr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ add_log() {
step_log "Housekeeping"
unset HOMEBREW_DISABLE_LOAD_FORMULA
brew update-reset "$(brew --repository)" >/dev/null 2>&1
brew tap shivammathur/homebrew-php
add_log "$tick" "Housekeeping" "Done"

step_log "Adding tap $GITHUB_REPOSITORY"
Expand All @@ -41,8 +40,7 @@ new_version=$(brew info Formula/"$PSR_VERSION".rb | head -n 1 | cut -d',' -f 1 |
echo "existing label: $existing_version"
echo "new label: $new_version"

if [ "$new_version" != "$existing_version" ]; then
#if true; then
if [[ "$GITHUB_MESSAGE" = *--build-all* ]] || [ "$new_version" != "$existing_version" ]; then
step_log "Filling the Bottle"
sudo ln -sf "$PWD" "$(brew --prefix)/Homebrew/Library/Taps/$GITHUB_REPOSITORY"
brew test-bot "$HOMEBREW_BINTRAY_USER"/"$HOMEBREW_BINTRAY_REPO"/"$PSR_VERSION" --root-url=https://dl.bintray.com/"$HOMEBREW_BINTRAY_USER"/"$HOMEBREW_BINTRAY_REPO" --skip-setup --skip-recursive-dependents
Expand All @@ -67,19 +65,24 @@ if [ "$new_version" != "$existing_version" ]; then
add_log "$tick" "$package" "Bottle labeled"

step_log "Stocking the new Bottle"
git stash
sleep $((RANDOM % 200 + 1))s
git pull -f https://"$HOMEBREW_BINTRAY_USER":"$GITHUB_TOKEN"@github.com/"$GITHUB_REPOSITORY".git HEAD:master
git stash apply
if [ $(ls *.json 2>/dev/null | wc -l) != "0" ]; then
if [ "$(find . -name '*.json' | wc -l 2>/dev/null | wc -l)" != "0" ]; then
curl --user "$HOMEBREW_BINTRAY_USER":"$HOMEBREW_BINTRAY_KEY" -X DELETE https://api.bintray.com/packages/"$HOMEBREW_BINTRAY_USER"/"$HOMEBREW_BINTRAY_REPO"/"$package"/versions/"$new_version"
brew test-bot --ci-upload --tap="$GITHUB_REPOSITORY" --root-url=https://dl.bintray.com/"$HOMEBREW_BINTRAY_USER"/"$HOMEBREW_BINTRAY_REPO" --bintray-org="$HOMEBREW_BINTRAY_USER"
curl --user "$HOMEBREW_BINTRAY_USER":"$HOMEBREW_BINTRAY_KEY" -X POST https://api.bintray.com/content/"$HOMEBREW_BINTRAY_USER"/"$HOMEBREW_BINTRAY_REPO"/"$package"/"$new_version"/publish
add_log "$tick" "PSR $PSR_VERSION" "Bottle added to stock"

step_log "Updating inventory"
git push https://"$HOMEBREW_BINTRAY_USER":"$GITHUB_TOKEN"@github.com/"$GITHUB_REPOSITORY".git HEAD:master --follow-tags
add_log "$tick" "Inventory" "updated"
git config --local user.email homebrew-test-bot@lists.sfconservancy.org
git config --local user.name BrewTestBot
for try in $(seq 10); do
echo "try: $try" >/dev/null
git fetch origin master && git rebase origin/master
if git push https://"$GITHUB_REPOSITORY_OWNER":"$GITHUB_TOKEN"@github.com/"$GITHUB_REPOSITORY".git HEAD:master --follow-tags; then
break
else
sleep 3s
fi
done
else
add_log "$cross" "bottle" "broke"
fi
Expand Down
40 changes: 24 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ on:
- cron: '30 0 * * *'
jobs:
psr:
runs-on: macOS-latest
runs-on: macos-latest
if: "!contains(github.event.head_commit.message, 'skip-build')"
strategy:
max-parallel: 3
fail-fast: false
matrix:
psr-version:
Expand All @@ -22,25 +22,29 @@ jobs:
- name: build
run: sh ./.github/scripts/build_psr.sh
env:
GIT_URL: https://github.com/shivammathur/homebrew-phalcon.git
GITHUB_ACTIONS: true
GITHUB_MESSAGE: ${{ github.event.head_commit.message }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_NAME: "Shivam Mathur"
HOMEBREW_BINTRAY_USER: shivammathur
GITHUB_REPOSITORY_OWNER: ${{ github.repository_owner }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_URL: ${{ github.event.repository.html_url }}
HOMEBREW_BINTRAY_USER: ${{ github.repository_owner }}
HOMEBREW_BINTRAY_REPO: phalcon
HOMEBREW_BINTRAY_EMAIL: ${{ secrets.email }}
HOMEBREW_BINTRAY_KEY: ${{ secrets.bintray_key }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_NO_ANALYTICS: 1
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
PSR_VERSION: ${{ matrix.psr-version }}
GITHUB_ACTIONS: true
continue-on-error: true
phalcon:
needs: psr
runs-on: macOS-latest
runs-on: macos-latest
if: "!contains(github.event.head_commit.message, 'skip-build')"
strategy:
max-parallel: 3
fail-fast: false
matrix:
psr-version:
phalcon-version:
- 'phalcon@7.0_3'
- 'phalcon@7.1_3'
- 'phalcon@7.2_3'
Expand All @@ -53,15 +57,19 @@ jobs:
- name: build
run: sh ./.github/scripts/build_phalcon.sh
env:
GIT_URL: https://github.com/shivammathur/homebrew-phalcon.git
GITHUB_ACTIONS: true
GITHUB_MESSAGE: ${{ github.event.head_commit.message }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_NAME: "Shivam Mathur"
HOMEBREW_BINTRAY_USER: shivammathur
GITHUB_REPOSITORY_OWNER: ${{ github.repository_owner }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_URL: ${{ github.event.repository.html_url }}
HOMEBREW_BINTRAY_USER: ${{ github.repository_owner }}
HOMEBREW_BINTRAY_REPO: phalcon
HOMEBREW_BINTRAY_EMAIL: ${{ secrets.email }}
HOMEBREW_BINTRAY_KEY: ${{ secrets.bintray_key }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PHALCON_VERSION: ${{ matrix.psr-version }}
GITHUB_ACTIONS: true
HOMEBREW_NO_ANALYTICS: 1
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
PHALCON_VERSION: ${{ matrix.phalcon-version }}
continue-on-error: true

Loading

0 comments on commit 5db2925

Please sign in to comment.