-
Notifications
You must be signed in to change notification settings - Fork 17
101 lines (92 loc) · 3.59 KB
/
php.yaml
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
name: PHP Features Testing
on:
workflow_call:
inputs:
php-repo-path:
type: string
default: 'temporal/sdk'
version:
required: true
type: string
# When true, the default version will be used (actually it's the latest tag)
version-is-repo-ref:
required: true
type: boolean
features-repo-path:
type: string
default: 'temporalio/features'
features-repo-ref:
type: string
default: 'main'
# If set, download the docker image for server from the provided artifact name
docker-image-artifact-name:
type: string
required: false
jobs:
test:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
defaults:
run:
working-directory: ./features
steps:
- name: Print git info
run: 'echo head_ref: "$GITHUB_HEAD_REF", ref: "$GITHUB_REF", PHP sdk version: ${{ inputs.version }}'
working-directory: '.'
- name: Download docker artifacts
if: ${{ inputs.docker-image-artifact-name }}
uses: actions/download-artifact@v3
with:
name: ${{ inputs.docker-image-artifact-name }}
path: /tmp/server-docker
- name: Load server Docker image
if: ${{ inputs.docker-image-artifact-name }}
run: docker load --input /tmp/server-docker/temporal-autosetup.tar
working-directory: '.'
- name: Override IMAGE_TAG environment variable
if: ${{ inputs.docker-image-artifact-name }}
run: |
image_tag=latest
# image_tag won't exist on older builds (like 1.22.0), so default to latest
if [ -f /tmp/server-docker/image_tag ]; then
image_tag=$(cat /tmp/server-docker/image_tag)
fi
echo "IMAGE_TAG=${image_tag}" >> $GITHUB_ENV
working-directory: '.'
- name: Checkout SDK features repo
uses: actions/checkout@v4
with:
path: features
repository: ${{ inputs.features-repo-path }}
ref: ${{ inputs.features-repo-ref }}
- uses: actions/setup-go@v2
with:
go-version: '^1.22'
- name: Setup PHP 8.2
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
tools: composer:v2
extensions: dom, sockets, grpc, curl, protobuf
- name: Start containerized server and dependencies
if: inputs.docker-image-artifact-name
run: |
docker compose \
-f ./dockerfiles/docker-compose.for-server-image.yaml \
-f /tmp/server-docker/docker-compose.yml \
up -d temporal-server cassandra elasticsearch
- name: Run SDK-features tests directly
if: inputs.docker-image-artifact-name == ''
run: go run . run --lang php ${{ inputs.docker-image-artifact-name && '--server localhost:7233 --namespace default' || ''}} --version "${{ inputs.version-is-repo-ref && '' || inputs.version }}"
# Running the tests in their own step keeps the logs readable
- name: Run containerized SDK-features tests
if: inputs.docker-image-artifact-name
run: |
docker compose \
-f ./dockerfiles/docker-compose.for-server-image.yaml \
-f /tmp/server-docker/docker-compose.yml \
up --no-log-prefix --exit-code-from features-tests-php features-tests-php
- name: Tear down docker compose
if: inputs.docker-image-artifact-name && (success() || failure())
run: docker compose -f ./dockerfiles/docker-compose.for-server-image.yaml -f /tmp/server-docker/docker-compose.yml down -v