-
Notifications
You must be signed in to change notification settings - Fork 0
139 lines (139 loc) · 5.54 KB
/
ci.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: Continuous Integration
on:
push:
branches:
- 'main'
- 'master'
- 'refs/heads/v[0-9]+.[0-9]+.[0-9]+'
pull_request:
jobs:
package-name:
name: Package Name
runs-on: ubuntu-latest
outputs:
package-name: ${{ steps.package-name.outputs.package-name }}
steps:
- uses: actions/checkout@v1
- id: package-name
run: |
printf "::set-output name=package-name::[\"%s\"]" $(docker run --rm -v "`pwd`:`pwd`" jess/jq jq -r -c '.name' "${GITHUB_WORKSPACE}/composer.json")
supported-versions-matrix:
name: Supported Versions Matrix
runs-on: ubuntu-latest
outputs:
version: ${{ steps.supported-versions-matrix.outputs.version }}
upcoming: ${{ steps.supported-versions-matrix.outputs.upcoming }}
steps:
- uses: actions/checkout@v1
- id: supported-versions-matrix
uses: WyriHaximus/github-action-composer-php-versions-in-range@v1
with:
upcomingReleases: true
generate-checks-strategy:
name: Generate Checks
runs-on: ubuntu-latest
outputs:
check: ${{ steps.generate-checks-strategy.outputs.check }}
steps:
- uses: actions/checkout@v1
- id: generate-checks-strategy
name: Generate check
run: |
printf "Checks found: %s\r\n" $(make task-list-ci)
printf "::set-output name=check::%s" $(make task-list-ci)
composer-install:
strategy:
fail-fast: false
matrix:
php: ${{ fromJson(needs.supported-versions-matrix.outputs.version) }}
composer: [current, highest]
needs:
- supported-versions-matrix
runs-on: ubuntu-latest
container:
image: wyrihaximusnet/php:${{ matrix.php }}-nts-alpine-slim-dev-root
steps:
- uses: actions/checkout@v1
- name: Cache composer packages
uses: actions/cache@v1
with:
path: ./vendor/
key: ${{ matrix.composer }}-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
- name: Install Dependencies
run: composer update --prefer-lowest --no-progress --ansi --no-interaction --prefer-dist -o
if: matrix.composer == 'lowest'
- name: Install Dependencies
run: composer install --ansi --no-progress --no-interaction --prefer-dist -o
if: matrix.composer == 'current'
- name: Install Dependencies
run: composer update --ansi --no-progress --no-interaction --prefer-dist -o
if: matrix.composer == 'highest'
can-require:
name: Test we can require "${{ matrix.package-name }}" on PHP ${{ matrix.php }}
strategy:
fail-fast: false
matrix:
php: ${{ fromJson(needs.supported-versions-matrix.outputs.version) }}
package-name: ${{ fromJson(needs.package-name.outputs.package-name) }}
needs:
- package-name
- supported-versions-matrix
runs-on: ubuntu-latest
container:
image: ghcr.io/wyrihaximusnet/php:${{ matrix.php }}-nts-buster-dev-root
steps:
- uses: actions/checkout@v2
with:
path: checked_out_package
- name: Set Up composer.json
run: |
echo "{\"repositories\": [{\"name\": \"${{ matrix.package-name }}\",\"type\": \"path\",\"url\": \"./checked_out_package\"}]}" > composer.json
- name: Require package
if: needs.supported-versions-matrix.outputs.upcoming != matrix.php
run: |
composer config --no-plugins "allow-plugins.*/*" true
composer require "${{ matrix.package-name }}:dev-${GITHUB_SHA}" --no-progress --ansi --no-interaction --prefer-dist -o -vvv || composer require "${{ matrix.package-name }}:dev-${GITHUB_REF_NAME}" --no-progress --ansi --no-interaction --prefer-dist -o -vvv
qa:
strategy:
fail-fast: false
matrix:
php: ${{ fromJson(needs.supported-versions-matrix.outputs.version) }}
composer: [current, highest]
check: ${{ fromJson(needs.generate-checks-strategy.outputs.check) }}
needs:
- supported-versions-matrix
- composer-install
- generate-checks-strategy
runs-on: ubuntu-latest
container:
image: wyrihaximusnet/php:${{ matrix.php }}-nts-alpine-slim-dev-root
steps:
- uses: actions/checkout@v1
- name: Cache composer packages
uses: actions/cache@v1
with:
path: ./vendor/
key: ${{ matrix.composer }}-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
- name: Install Dependencies
run: composer update --prefer-lowest --no-progress --ansi --no-interaction --prefer-dist -o
if: matrix.composer == 'lowest'
- name: Install Dependencies
run: composer install --ansi --no-progress --no-interaction --prefer-dist -o
if: matrix.composer == 'current'
- name: Install Dependencies
run: composer update --ansi --no-progress --no-interaction --prefer-dist -o
if: matrix.composer == 'highest'
- name: Fetch Tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* || true
if: matrix.check == 'backward-compatibility-check'
- run: make cs-fix || true
- run: 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: 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 }}