-
-
Notifications
You must be signed in to change notification settings - Fork 2
123 lines (123 loc) · 4.71 KB
/
test-client.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name: Generate and test client
on:
workflow_call:
inputs:
name:
description: Name of the client to test
required: true
type: string
jobs:
generate-and-test-client:
runs-on: ubuntu-latest
name: Generate and test client (${{ inputs.name }})
container:
image: ghcr.io/wyrihaximusnet/php:8.2-nts-alpine-dev-root
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
persist-credentials: 'false'
- uses: "ramsey/composer-install@v2"
- run: |
mkdir -p example/generated-${{ inputs.name }}
- run: curl -o example/api.github.com.yaml https://raw.githubusercontent.com/github/rest-api-description/main/descriptions-next/api.github.com/api.github.com.yaml
- run: curl -o example/patch-broken-spec-files.php https://raw.githubusercontent.com/php-api-clients/github-root/main/utils/patch-broken-spec-files.php
- run: php example/patch-broken-spec-files.php example/api.github.com.yaml
- run: make generate-example-client-${{ inputs.name }}
- name: Tar example files
run: tar -czf example.tar ./example
- name: Upload Generated Client
uses: actions/upload-artifact@v4
with:
name: example-${{ inputs.name }}-client
path: ./example.tar
supported-versions-matrix:
name: Supported Versions Matrix (${{ inputs.name }})
runs-on: ubuntu-latest
outputs:
version: ${{ steps.supported-versions-matrix.outputs.version }}
upcoming: ${{ steps.supported-versions-matrix.outputs.upcoming }}
steps:
- uses: actions/checkout@v4
- id: supported-versions-matrix
uses: WyriHaximus/github-action-composer-php-versions-in-range@v1
with:
upcomingReleases: true
supported-checks-matrix:
name: Supported Checks Matrix (${{ inputs.name }})
runs-on: ubuntu-latest
needs:
- generate-and-test-client
outputs:
check: ${{ steps.supported-checks-matrix.outputs.check }}
steps:
- uses: actions/checkout@v4
- run: |
mkdir -p example/generated-${{ inputs.name }}
- name: Download Generated Client
uses: actions/download-artifact@v4
with:
name: example-${{ inputs.name }}-client
path: ./
- name: UnTar example files
run: tar -xzf example.tar
- id: supported-checks-matrix
name: Generate check
run: |
cd example/generated-${{ inputs.name }}
printf "Checks found: %s\r\n" $(make task-list-ci)
printf "::set-output name=check::%s" $(make task-list-ci)
qa:
name: Run ${{ matrix.check }} on PHP ${{ matrix.php }} with ${{ matrix.composer }} dependency preference (${{ inputs.name }})
strategy:
fail-fast: false
matrix:
php: ${{ fromJson(needs.supported-versions-matrix.outputs.version) }}
composer: [lowest, locked, highest]
check: ${{ fromJson(needs.supported-checks-matrix.outputs.check) }}
needs:
- supported-checks-matrix
- supported-versions-matrix
- generate-and-test-client
runs-on: ubuntu-latest
container:
image: ghcr.io/wyrihaximusnet/php:${{ matrix.php }}-nts-alpine-dev-root
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Required due to the way Git works, without it this action won't be able to find any or the correct tags
- run: git config --global --add safe.directory $GITHUB_WORKSPACE # Do this ourself because `actions/checkout@v3 doesn't succeed in doing this
- run: |
mkdir -p example/generated-${{ inputs.name }}
- name: Download Generated Client
uses: actions/download-artifact@v4
with:
name: example-${{ inputs.name }}-client
path: ./
- name: UnTar example files
run: tar -xzf example.tar
- uses: ramsey/composer-install@v2
with:
working-directory: "example/generated-${{ inputs.name }}/"
ignore-cache: "yes"
- run: |
cd example/generated-${{ inputs.name }}
make ${{ matrix.check }} || true
if: needs.supported-versions-matrix.outputs.upcoming == matrix.php
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
COVERALLS_RUN_LOCALLY: ${{ secrets.COVERALLS_RUN_LOCALLY }}
- run: |
cd example/generated-${{ inputs.name }}
make ${{ matrix.check }}
if: needs.supported-versions-matrix.outputs.upcoming != matrix.php
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
COVERALLS_RUN_LOCALLY: ${{ secrets.COVERALLS_RUN_LOCALLY }}
check-mark:
name: ✔️
needs:
- qa
runs-on: ubuntu-latest
steps:
- run: echo "✔️"