-
Notifications
You must be signed in to change notification settings - Fork 0
193 lines (191 loc) · 6.2 KB
/
Copy pathbuild-cli.yaml
File metadata and controls
193 lines (191 loc) · 6.2 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
name: build-cli
concurrency:
cancel-in-progress: true
group: ${{ github.ref }}-build
on:
release:
types:
- created
push:
branches:
- v2
pull_request:
branches:
- v2
jobs:
build-linux:
strategy:
fail-fast: false
matrix:
platform: [ 'amd64', 'arm64' ]
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- name: Configure QEMU
uses: docker/setup-qemu-action@v3
- name: Configure docker
uses: docker/setup-buildx-action@v3
with:
platforms: ${{ matrix.platform }}
- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v3
- name: Build sources
run: |
echo "${{ secrets.GITHUB_TOKEN }}" > TOKEN
docker buildx build --secret id=github-token,src=./TOKEN --cache-to type=gha,mode=max,scope=${{ matrix.platform }} --cache-from type=gha,scope=${{ matrix.platform }} --pull --load --platform linux/${{ matrix.platform }} --target cli-base-alpine -t builder .
- name: Copy build
run: |
docker create --name builder builder
docker cp builder:/go/src/app/cli/dist/dphp bin/dphp
- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: dphp-${{ runner.os }}-${{ matrix.platform }}
path: bin/dphp
build-docker:
runs-on: self-hosted
outputs:
image: ${{ steps.meta.outputs.tags }}
steps:
- uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Configure QEMU
uses: docker/setup-qemu-action@v3
- name: Configure docker
uses: docker/setup-buildx-action@v3
- name: Calculate version
run: |
if [ "${GITHUB_REF_TYPE}" == "tag" ]; then
export VERSION=${GITHUB_REF_NAME:1}
else
export VERSION=${GITHUB_SHA}
fi
echo "VERSION=${VERSION}" >> "${GITHUB_ENV}"
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/durable-php/runtime
tags: |
type=schedule,pattern=latest
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Build
uses: docker/build-push-action@v6
with:
context: ./
file: Dockerfile
target: durable-php
build-args: |
VERSION=${{ env.VERSION }}
push: true
pull: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
builder: ${{ steps.buildx.outputs.name }}
cache-from: type=gha,scope=image
cache-to: type=gha,mode=max,scope=image
platforms: linux/amd64,linux/arm64
- name: Build Test Image
uses: docker/build-push-action@v6
with:
context: ./
file: Dockerfile
target: test
push: true
pull: true
tags: ghcr.io/${{ github.repository_owner }}/durable-php/runtime-tests:${{ github.sha }}
labels: ${{ steps.meta.outputs.labels }}
builder: ${{ steps.buildx.outputs.name }}
cache-from: type=gha,scope=image
platforms: linux/amd64
build-osx:
strategy:
fail-fast: false
matrix:
platform: [ 'arm64', 'x86_64' ]
runs-on: ${{ matrix.platform == 'arm64' && 'macos-14' || 'macos-13' }}
env:
HOMEBREW_NO_AUTO_UPDATE: 1
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
cache-dependency-path: cli/go.sum
go-version-file: cli/go.mod
- name: Configure Version
run: |
if [ "${GITHUB_REF_TYPE}" == "tag" ]; then
export VERSION=${GITHUB_REF_NAME:1}
else
export VERSION=${GITHUB_SHA}
fi
echo "VERSION=${VERSION}" >> "${GITHUB_ENV}"
- name: Configure cache
uses: actions/cache@v4
with:
path: dist
key: ${{ matrix.platform }}-${{ hashFiles('cli/*.mod') }}
- name: Run doctor
run: |
export GITHUB_TOKEN "${{ secrets.GITHUB_TOKEN }}"
BUILD=no cli/build-php.sh
- name: Build php
run: |
export GITHUB_TOKEN "${{ secrets.GITHUB_TOKEN }}"
cli/build-php.sh
- name: Build cli
run: |
export GITHUB_TOKEN "${{ secrets.GITHUB_TOKEN }}"
cd cli && ./build.sh
- run: ls -lah cli/dist/
- run: ls -lah dist/ || true
- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: dphp-${{ runner.os }}-${{ matrix.platform }}
path: cli/dist/dphp
performance-test:
name: Performance Test
needs:
- build-docker
runs-on: self-hosted
container: ghcr.io/${{ github.repository_owner }}/durable-php/runtime-tests:${{ github.sha }}
services:
dphp:
image: ghcr.io/${{ github.repository_owner }}/durable-php/runtime-tests:${{ github.sha }}
ports:
- 8080:8080
volumes:
- ${{ github.workspace }}:/app
env:
DPHP_HOST: http://dphp:8080
steps:
- uses: actions/checkout@v4
- run: |
dphp composer install --ignore-platform-reqs
- run: |
echo "Running perf test"
dphp exec tests/PerformanceTests/PerformanceClient.php
echo "Running fan out/in test"
dphp exec tests/PerformanceTests/FanOutFanInClient.php
- uses: peter-evans/find-comment@v3
continue-on-error: true
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
body-includes: Performance Metrics
- uses: peter-evans/create-or-update-comment@v4
continue-on-error: true
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body-path: report.md