|
6 | 6 | - 'master' |
7 | 7 | - 'refs/heads/v[0-9]+.[0-9]+.[0-9]+' |
8 | 8 | pull_request: |
| 9 | +## This workflow needs the `pull-request` permissions to work for the package diffing |
| 10 | +## Refs: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#permissions |
| 11 | +permissions: |
| 12 | + pull-requests: write |
| 13 | + contents: read |
9 | 14 | jobs: |
10 | | - package-name: |
11 | | - name: Package Name |
12 | | - runs-on: ubuntu-latest |
13 | | - needs: |
14 | | - - lint-json |
15 | | - outputs: |
16 | | - package-name: ${{ steps.package-name.outputs.package-name }} |
17 | | - steps: |
18 | | - - uses: actions/checkout@v3 |
19 | | - - id: package-name |
20 | | - run: | |
21 | | - printf "::set-output name=package-name::[\"%s\"]" $(docker run --rm -v "`pwd`:`pwd`" jess/jq jq -r -c '.name' "${GITHUB_WORKSPACE}/composer.json") |
22 | | - supported-versions-matrix: |
23 | | - name: Supported Versions Matrix |
24 | | - runs-on: ubuntu-latest |
25 | | - needs: |
26 | | - - lint-yaml |
27 | | - - lint-json |
28 | | - outputs: |
29 | | - version: ${{ steps.supported-versions-matrix.outputs.version }} |
30 | | - upcoming: ${{ steps.supported-versions-matrix.outputs.upcoming }} |
31 | | - steps: |
32 | | - - uses: actions/checkout@v3 |
33 | | - - id: supported-versions-matrix |
34 | | - uses: WyriHaximus/github-action-composer-php-versions-in-range@v1 |
35 | | - with: |
36 | | - upcomingReleases: true |
37 | | - supported-checks-matrix: |
38 | | - name: Supported Checks Matrix |
39 | | - runs-on: ubuntu-latest |
40 | | - needs: |
41 | | - - lint-yaml |
42 | | - outputs: |
43 | | - check: ${{ steps.supported-checks-matrix.outputs.check }} |
44 | | - steps: |
45 | | - - uses: actions/checkout@v3 |
46 | | - - id: supported-checks-matrix |
47 | | - name: Generate check |
48 | | - run: | |
49 | | - printf "Checks found: %s\r\n" $(make task-list-ci) |
50 | | - printf "::set-output name=check::%s" $(make task-list-ci) |
51 | | - can-require: |
52 | | - name: Test we can require "${{ matrix.package-name }}" on PHP ${{ matrix.php }} |
53 | | - strategy: |
54 | | - fail-fast: false |
55 | | - matrix: |
56 | | - php: ${{ fromJson(needs.supported-versions-matrix.outputs.version) }} |
57 | | - package-name: ${{ fromJson(needs.package-name.outputs.package-name) }} |
58 | | - needs: |
59 | | - - lint-yaml |
60 | | - - lint-json |
61 | | - - package-name |
62 | | - - supported-versions-matrix |
63 | | - runs-on: ubuntu-latest |
64 | | - container: |
65 | | - image: ghcr.io/wyrihaximusnet/php:${{ matrix.php }}-nts-buster-dev-root |
66 | | - steps: |
67 | | - - uses: actions/checkout@v3 |
68 | | - with: |
69 | | - path: checked_out_package |
70 | | - - name: Set Up composer.json |
71 | | - run: | |
72 | | - echo "{\"repositories\": [{\"name\": \"${{ matrix.package-name }}\",\"type\": \"path\",\"url\": \"./checked_out_package\"}]}" > composer.json |
73 | | - - name: Require package |
74 | | - if: needs.supported-versions-matrix.outputs.upcoming != matrix.php |
75 | | - run: | |
76 | | - composer config --no-plugins "allow-plugins.*/*" true |
77 | | - 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 |
78 | | - qa: |
79 | | - name: Run ${{ matrix.check }} on PHP ${{ matrix.php }} with ${{ matrix.composer }} dependency preference |
80 | | - strategy: |
81 | | - fail-fast: false |
82 | | - matrix: |
83 | | - php: ${{ fromJson(needs.supported-versions-matrix.outputs.version) }} |
84 | | - composer: [lowest, locked, highest] |
85 | | - check: ${{ fromJson(needs.supported-checks-matrix.outputs.check) }} |
86 | | - needs: |
87 | | - - lint-yaml |
88 | | - - lint-json |
89 | | - - supported-checks-matrix |
90 | | - - supported-versions-matrix |
91 | | - runs-on: ubuntu-latest |
92 | | - container: |
93 | | - image: ghcr.io/wyrihaximusnet/php:${{ matrix.php }}-nts-buster-dev-root |
94 | | - steps: |
95 | | - - uses: actions/checkout@v3 |
96 | | - - uses: ramsey/composer-install@v2 |
97 | | - with: |
98 | | - dependency-versions: ${{ matrix.composer }} |
99 | | - - run: git config --global --add safe.directory $GITHUB_WORKSPACE # Do this ourself because `actions/checkout@v3 doesn't succeed in doing this |
100 | | - - name: Fetch Tags |
101 | | - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* || true |
102 | | - if: matrix.check == 'backward-compatibility-check' |
103 | | - - run: make ${{ matrix.check }} || true |
104 | | - if: needs.supported-versions-matrix.outputs.upcoming == matrix.php |
105 | | - env: |
106 | | - COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} |
107 | | - COVERALLS_RUN_LOCALLY: ${{ secrets.COVERALLS_RUN_LOCALLY }} |
108 | | - - run: make ${{ matrix.check }} |
109 | | - if: needs.supported-versions-matrix.outputs.upcoming != matrix.php |
110 | | - env: |
111 | | - COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} |
112 | | - COVERALLS_RUN_LOCALLY: ${{ secrets.COVERALLS_RUN_LOCALLY }} |
113 | | - tests-directly-on-os: |
114 | | - name: Run tests on PHP ${{ matrix.php }} with ${{ matrix.composer }} dependency preference (${{ matrix.os }}) |
115 | | - strategy: |
116 | | - fail-fast: false |
117 | | - matrix: |
118 | | - os: [ubuntu-latest, windows-latest, macos-latest] |
119 | | - php: ${{ fromJson(needs.supported-versions-matrix.outputs.version) }} |
120 | | - composer: [lowest, locked, highest] |
121 | | - needs: |
122 | | - - lint-yaml |
123 | | - - lint-json |
124 | | - - supported-checks-matrix |
125 | | - - supported-versions-matrix |
126 | | - runs-on: ${{ matrix.os }} |
127 | | - steps: |
128 | | - - uses: actions/checkout@v3 |
129 | | - - uses: shivammathur/setup-php@v2 |
130 | | - with: |
131 | | - php-version: ${{ matrix.php }} |
132 | | - coverage: pcov |
133 | | - extensions: intl, sodium |
134 | | - - uses: ramsey/composer-install@v2 |
135 | | - with: |
136 | | - dependency-versions: ${{ matrix.composer }} |
137 | | - - run: make unit-testing-raw || true |
138 | | - if: needs.supported-versions-matrix.outputs.upcoming == matrix.php |
139 | | - env: |
140 | | - COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} |
141 | | - COVERALLS_RUN_LOCALLY: ${{ secrets.COVERALLS_RUN_LOCALLY }} |
142 | | - - run: make unit-testing-raw |
143 | | - if: needs.supported-versions-matrix.outputs.upcoming != matrix.php |
144 | | - env: |
145 | | - COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} |
146 | | - COVERALLS_RUN_LOCALLY: ${{ secrets.COVERALLS_RUN_LOCALLY }} |
147 | | - lint-yaml: |
148 | | - name: Lint YAML |
149 | | - runs-on: ubuntu-latest |
150 | | - steps: |
151 | | - - uses: actions/checkout@v3 |
152 | | - - name: yaml-lint |
153 | | - uses: ibiqlik/action-yamllint@v3 |
154 | | - with: |
155 | | - config_data: | |
156 | | - extends: default |
157 | | - ignore: | |
158 | | - /.git/ |
159 | | - rules: |
160 | | - line-length: disable |
161 | | - document-start: disable |
162 | | - truthy: disable |
163 | | - lint-json: |
164 | | - name: Lint JSON |
165 | | - runs-on: ubuntu-latest |
166 | | - steps: |
167 | | - - uses: actions/checkout@v3 |
168 | | - - name: json-syntax-check |
169 | | - uses: limitusus/json-syntax-check@v2 |
170 | | - with: |
171 | | - pattern: "\\.json$" |
172 | | - check-mark: |
173 | | - name: ✔️ |
174 | | - needs: |
175 | | - - lint-yaml |
176 | | - - lint-json |
177 | | - - can-require |
178 | | - - qa |
179 | | - - tests-directly-on-os |
180 | | - runs-on: ubuntu-latest |
181 | | - steps: |
182 | | - - run: echo "✔️" |
| 15 | + ci: |
| 16 | + name: Continuous Integration |
| 17 | + uses: WyriHaximus/github-workflows/.github/workflows/package.yaml@package |
0 commit comments