-
Notifications
You must be signed in to change notification settings - Fork 28
104 lines (97 loc) · 4.06 KB
/
Copy pathphp.yml
File metadata and controls
104 lines (97 loc) · 4.06 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
# This workflow will install PHP dependencies, run tests and lint with a variety of PHP versions
# For more information see: https://github.com/marketplace/actions/composer-php-actions
# No particular step needed for publishing, package will be available on https://packagist.org just after release
name: PHP CI
on:
push:
branches:
- master
- "release/**"
pull_request:
branches:
- master
- "release/**"
workflow_dispatch:
release:
types:
- published
schedule:
- cron: "0 15 * * 0" # Every Sunday, 3 hours after midday
permissions:
contents: read
jobs:
integration-tests:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: ["8.3"]
steps:
- uses: actions/checkout@v4
- name: Set up PHP ${{ matrix.php-version }}
uses: php-actions/composer@8a65f0d3c6a1d17ca4800491a40b5756a4c164f3 # v6
with:
php_version: ${{ matrix.php-version }}
- name: Should run integration tests
id: should-run-integration-tests
if: ${{ matrix.php-version == '8.3' &&
github.repository_owner == 'onfido' }}
uses: onfido/onfido-actions/should-run-integration-tests@main
- name: Acquire integration test lock
if: steps.should-run-integration-tests.outputs.result == 'true'
uses: onfido/onfido-actions/lock/acquire@main
with:
app-id: ${{ secrets.ONFIDO_CI_LOCK_APP_ID }}
app-private-key: ${{ secrets.ONFIDO_CI_LOCK_PRIVATE_KEY }}
- name: Test with API token auth
if: steps.should-run-integration-tests.outputs.result == 'true'
run: |
vendor/bin/phpunit
env:
ONFIDO_API_TOKEN: ${{ secrets.ONFIDO_API_TOKEN }}
ONFIDO_SAMPLE_APPLICANT_ID: ${{ secrets.ONFIDO_SAMPLE_APPLICANT_ID }}
ONFIDO_SAMPLE_VIDEO_ID_1: ${{ secrets.ONFIDO_SAMPLE_VIDEO_ID_1 }}
ONFIDO_SAMPLE_VIDEO_ID_2: ${{ secrets.ONFIDO_SAMPLE_VIDEO_ID_2 }}
ONFIDO_SAMPLE_MOTION_ID_1: ${{ secrets.ONFIDO_SAMPLE_MOTION_ID_1 }}
ONFIDO_SAMPLE_MOTION_ID_2: ${{ secrets.ONFIDO_SAMPLE_MOTION_ID_2 }}
- name: Test with OAuth client credentials auth
if: steps.should-run-integration-tests.outputs.result == 'true'
run: |
vendor/bin/phpunit
env:
ONFIDO_OAUTH_CLIENT_ID: ${{ secrets.ONFIDO_OAUTH_CLIENT_ID }}
ONFIDO_OAUTH_CLIENT_SECRET: ${{ secrets.ONFIDO_OAUTH_CLIENT_SECRET }}
ONFIDO_SAMPLE_APPLICANT_ID: ${{ secrets.ONFIDO_SAMPLE_APPLICANT_ID }}
ONFIDO_SAMPLE_VIDEO_ID_1: ${{ secrets.ONFIDO_SAMPLE_VIDEO_ID_1 }}
ONFIDO_SAMPLE_VIDEO_ID_2: ${{ secrets.ONFIDO_SAMPLE_VIDEO_ID_2 }}
ONFIDO_SAMPLE_MOTION_ID_1: ${{ secrets.ONFIDO_SAMPLE_MOTION_ID_1 }}
ONFIDO_SAMPLE_MOTION_ID_2: ${{ secrets.ONFIDO_SAMPLE_MOTION_ID_2 }}
- name: Release integration test lock
if: always() && steps.should-run-integration-tests.outputs.result == 'true'
uses: onfido/onfido-actions/lock/release@main
with:
app-id: ${{ secrets.ONFIDO_CI_LOCK_APP_ID }}
app-private-key: ${{ secrets.ONFIDO_CI_LOCK_PRIVATE_KEY }}
publish:
runs-on: ubuntu-latest
needs: integration-tests
environment: delivery
permissions:
contents: write
if: github.event_name == 'release'
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GH_ACTION_ACCESS_TOKEN }}
ref: master
- name: Validate release
uses: onfido/onfido-actions/release-check@main
- name: Notify packagist.org about the new package
run: |
curl -XPOST -H'content-type:application/json' \
"https://packagist.org/api/update-package?username=${PACKAGIST_API_USER}&apiToken=${PACKAGIST_API_TOKEN}" \
-d'{"repository":{"url":"${{ github.server_url }}/${{ github.repository }}"}}'
env:
PACKAGIST_API_USER: ${{ secrets.PACKAGIST_API_USER }}
PACKAGIST_API_TOKEN: ${{ secrets.PACKAGIST_API_TOKEN }}
- name: Update and commit CHANGELOG.md
uses: onfido/onfido-actions/update-changelog@main