Skip to content

Update build-cli.yaml #361

Update build-cli.yaml

Update build-cli.yaml #361

Workflow file for this run

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-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
- 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
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