|
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 | | - supported-versions-matrix: |
11 | | - name: Supported Versions Matrix |
12 | | - runs-on: ubuntu-latest |
13 | | - outputs: |
14 | | - version: ${{ steps.supported-versions-matrix.outputs.version }} |
15 | | - steps: |
16 | | - - uses: actions/checkout@v1 |
17 | | - - id: supported-versions-matrix |
18 | | - uses: WyriHaximus/github-action-composer-php-versions-in-range@v1 |
19 | | - supported-checks-matrix: |
20 | | - name: Supported Checks Matrix |
21 | | - runs-on: ubuntu-latest |
22 | | - needs: |
23 | | - - composer-install |
24 | | - outputs: |
25 | | - check: ${{ steps.supported-checks-matrix.outputs.check }} |
26 | | - steps: |
27 | | - - uses: actions/checkout@v1 |
28 | | - - id: supported-checks-matrix |
29 | | - name: Generate check |
30 | | - run: | |
31 | | - printf "Checks found: %s\r\n" $(make task-list-ci) |
32 | | - printf "::set-output name=check::%s" $(make task-list-ci) |
33 | | - composer-install: |
34 | | - strategy: |
35 | | - fail-fast: false |
36 | | - matrix: |
37 | | - php: ${{ fromJson(needs.supported-versions-matrix.outputs.version) }} |
38 | | - composer: [lowest, current, highest] |
39 | | - needs: |
40 | | - - supported-versions-matrix |
41 | | - runs-on: ubuntu-latest |
42 | | - container: |
43 | | - image: ghcr.io/wyrihaximusnet/php:${{ matrix.php }}-nts-buster-dev-root |
44 | | - steps: |
45 | | - - uses: actions/checkout@v1 |
46 | | - - name: Cache composer packages |
47 | | - uses: actions/cache@v1 |
48 | | - with: |
49 | | - path: ./vendor/ |
50 | | - key: ${{ matrix.composer }}-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} |
51 | | - - name: Install Dependencies |
52 | | - run: composer update --prefer-lowest --no-progress --ansi --no-interaction --prefer-dist -o |
53 | | - if: matrix.composer == 'lowest' |
54 | | - - name: Install Dependencies |
55 | | - run: composer install --ansi --no-progress --no-interaction --prefer-dist -o |
56 | | - if: matrix.composer == 'current' |
57 | | - - name: Install Dependencies |
58 | | - run: composer update --ansi --no-progress --no-interaction --prefer-dist -o |
59 | | - if: matrix.composer == 'highest' |
60 | | - qa: |
61 | | - services: |
62 | | - postgres: |
63 | | - image: postgres:${{ matrix.postgres }} |
64 | | - env: |
65 | | - POSTGRES_PASSWORD: postgres |
66 | | - # Set health checks to wait until postgres has started |
67 | | - options: >- |
68 | | - --health-cmd pg_isready |
69 | | - --health-interval 10s |
70 | | - --health-timeout 5s |
71 | | - --health-retries 5 |
72 | | - name: Run ${{ matrix.check }} on PHP ${{ matrix.php }} with ${{ matrix.composer }} dependency preference against Postgres ${{ matrix.postgres }} |
73 | | - strategy: |
74 | | - fail-fast: false |
75 | | - matrix: |
76 | | - php: ${{ fromJson(needs.supported-versions-matrix.outputs.version) }} |
77 | | - postgres: [12, 13] |
78 | | - composer: [lowest, current, highest] |
79 | | - check: ${{ fromJson(needs.supported-checks-matrix.outputs.check) }} |
80 | | - needs: |
81 | | - - composer-install |
82 | | - - supported-checks-matrix |
83 | | - - supported-versions-matrix |
84 | | - runs-on: ubuntu-latest |
85 | | - container: |
86 | | - image: ghcr.io/wyrihaximusnet/php:${{ matrix.php }}-nts-buster-dev-root |
87 | | - steps: |
88 | | - - uses: actions/checkout@v1 |
89 | | - - name: Cache composer packages |
90 | | - uses: actions/cache@v1 |
91 | | - with: |
92 | | - path: ./vendor/ |
93 | | - key: ${{ matrix.composer }}-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }} |
94 | | - - name: Install Dependencies |
95 | | - run: (test -f vendor && true ) || composer update --prefer-lowest --no-progress --ansi --no-interaction --prefer-dist -o |
96 | | - if: matrix.composer == 'lowest' |
97 | | - - name: Install Dependencies |
98 | | - run: (test -f vendor && true ) || composer install --ansi --no-progress --no-interaction --prefer-dist -o |
99 | | - if: matrix.composer == 'current' |
100 | | - - name: Install Dependencies |
101 | | - run: (test -f vendor && true ) || composer update --ansi --no-progress --no-interaction --prefer-dist -o |
102 | | - if: matrix.composer == 'highest' |
103 | | - - name: Fetch Tags |
104 | | - run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* || true |
105 | | - if: matrix.check == 'backward-compatibility-check' |
106 | | - - run: mv .env.github-actions .env |
107 | | - - run: export $(cat .env | tr -d '\r' | xargs) && make install_db |
108 | | - - run: export $(cat .env | tr -d '\r' | xargs) && make ${{ matrix.check }} |
109 | | - env: |
110 | | - COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} |
111 | | - COVERALLS_RUN_LOCALLY: ${{ secrets.COVERALLS_RUN_LOCALLY }} |
112 | | - check-mark: |
113 | | - name: ✔️ |
114 | | - needs: |
115 | | - - qa |
116 | | - runs-on: ubuntu-latest |
117 | | - steps: |
118 | | - - run: echo "✔️" |
| 15 | + ci: |
| 16 | + name: Continuous Integration |
| 17 | + uses: WyriHaximus/github-workflows/.github/workflows/package.yaml@main |
| 18 | + with: |
| 19 | + services: "{\"postgres\":{\"image\":\"postgres:\$\{\{ matrix.postgres \}\}\",\"env\":{\"POSTGRES_PASSWORD\":\"postgres\"},\"options\":\"--health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5\"}}" |
0 commit comments