Repository navigation
88 lines (76 loc) · 2.36 KB
/
Copy pathphp.yml
File metadata and controls
88 lines (76 loc) · 2.36 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
name: Sample contract (PHP)
on:
workflow_call:
inputs:
sample:
description: Contract to check against, e.g. voice-record
required: true
type: string
working-directory:
required: false
type: string
default: .
php-version:
required: false
type: string
default: "8.3"
install-command:
required: false
type: string
default: composer install
start-command:
required: false
type: string
default: composer start
permissions:
contents: read
jobs:
contract:
name: PHP Contract
runs-on: ubuntu-latest
steps:
- name: Checkout App
uses: actions/checkout@v7
with:
path: app
- name: Checkout Tooling
uses: actions/checkout@v7
with:
repository: Bandwidth-Samples/sample-app-tooling
path: tooling
- name: Checkout Template
if: github.event_name == 'pull_request'
uses: actions/checkout@v7
with:
repository: Bandwidth-Samples/bandwidth-template
path: template
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ inputs.php-version }}
tools: composer
- name: Setup Python
uses: actions/setup-python@v7
with:
python-version: "3.12"
- name: Install app dependencies
working-directory: app/${{ inputs.working-directory }}
run: ${{ inputs.install-command }}
- name: Install runner dependencies
run: pip install -r tooling/runner/requirements.txt
- name: Run contract
run: >
python tooling/runner/run_contract.py
--contract tooling/contracts/${{ inputs.sample }}.yml
--fixtures-root tooling
--app-dir app/${{ inputs.working-directory }}
--start-command "${{ inputs.start-command }}"
--log-file ${{ runner.temp }}/app.log
- name: Checklist lint
if: ${{ !cancelled() && github.event_name == 'pull_request' }}
run: |
pip install -q -r tooling/runner/requirements.txt
python tooling/runner/lint_sample.py --app-dir app --template-dir template --repo-name ${{ github.event.repository.name }}
- name: Show app log
if: failure()
run: cat ${{ runner.temp }}/app.log