forked from kabel/homebrew-pecl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
73 lines (73 loc) · 3.16 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
jobs:
- job: Build
strategy:
matrix:
macOS_Monterey:
OS_VERSION: '12.7'
macOS_Ventura:
OS_VERSION: '13.6'
macOS_Sonoma:
OS_VERSION: '14.4'
pool:
name: Default
demands:
- agent.os -equals Darwin
- agent.osversion -equals $(OS_VERSION)
timeoutInMinutes: 120
steps:
- bash: |
HOMEBREW_TAP_DIR="/usr/local/Homebrew/Library/Taps/kabel/homebrew-pecl"
mkdir -p "$HOMEBREW_TAP_DIR"
rm -rf "$HOMEBREW_TAP_DIR"
rm -rf "$BUILD_ARTIFACTSTAGINGDIRECTORY"/*
rm -f *.bottle.tar.gz
rm -f *.bottle.json
git clean -fdq
brew update-reset
brew update
ln -s "$PWD" "$HOMEBREW_TAP_DIR"
sed -i '' -e '/require_relative/{r lib/php_pecl_formula.rb' -e 'd;}' Formula/*.rb
displayName: Setup brew tap
- bash: |
set -e
if [ -z "$SYSTEM_PULLREQUEST_TARGETBRANCH" ]; then export SYSTEM_PULLREQUEST_TARGETBRANCH="main"; fi
if [ "$BUILD_REASON" = "PullRequest" ]; then export GITHUB_EVENT_NAME="pull_request"; fi
export GITHUB_OUTPUT=".output"
export GITHUB_BASE_REF="$SYSTEM_PULLREQUEST_TARGETBRANCH"
export GITHUB_SHA="$BUILD_SOURCEVERSION"
export GITHUB_ACTIONS="fake"
export GITHUB_REPOSITORY="$BUILD_REPOSITORY_NAME"
export GITHUB_REF="$BUILD_SOURCEBRANCH"
export HOMEBREW_GITHUB_ACTIONS=fake
echo "==> Dumping Pipelines Vars..."
echo "BUILD_REPOSITORY_NAME=$BUILD_REPOSITORY_NAME"
echo "BUILD_SOURCEBRANCH=$BUILD_SOURCEBRANCH"
echo "BUILD_SOURCEBRANCHNAME=$BUILD_SOURCEBRANCHNAME"
echo "BUILD_SOURCEVERSION=$BUILD_SOURCEVERSION"
echo "BUILD_REASON=$BUILD_REASON"
echo "SYSTEM_PULLREQUEST_SOURCEBRANCH=$SYSTEM_PULLREQUEST_SOURCEBRANCH"
echo "SYSTEM_PULLREQUEST_TARGETBRANCH=$SYSTEM_PULLREQUEST_TARGETBRANCH"
echo
TEST_PARAMS=""
if [ "$BUILD_REASON" != "PullRequest" -a "$BUILD_SOURCEBRANCHNAME" = "$SYSTEM_PULLREQUEST_TARGETBRANCH" ]; then TEST_PARAMS="--only-tap-syntax"; fi
brew test-bot --skip-dependents --skip-online-checks --tap=kabel/pecl --root-url=https://bottles.kabel.rocks/bottles-pecl $TEST_PARAMS
displayName: Run brew test-bot
- bash: |
rm -rf /usr/local/etc/php
brew list --full-name | grep kabel/pecl | xargs brew rm
brew cleanup
BOTTLE_COUNT=$(find . -name \*.bottle.tar.gz -print | wc -l | xargs)
echo "Found $BOTTLE_COUNT bottles"
if [ "$BOTTLE_COUNT" -gt "0" ]; then
cp *.bottle.tar.gz $BUILD_ARTIFACTSTAGINGDIRECTORY 2>/dev/null
cp *.bottle.json $BUILD_ARTIFACTSTAGINGDIRECTORY 2>/dev/null
fi
echo "##vso[task.setvariable variable=BOTTLE_COUNT]$BOTTLE_COUNT"
condition: succeededOrFailed()
displayName: Cleanup brew
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: 'drop'
publishLocation: 'Container'
condition: gt(variables.BOTTLE_COUNT, 0)