|
| 1 | +# https://help.github.com/en/categories/automating-your-workflow-with-github-actions |
| 2 | + |
| 3 | +name: "Reflection golden test" |
| 4 | + |
| 5 | +on: |
| 6 | + pull_request: |
| 7 | + paths-ignore: |
| 8 | + - 'compiler/**' |
| 9 | + - 'apigen/**' |
| 10 | + - 'changelog-generator/**' |
| 11 | + - 'issue-bot/**' |
| 12 | + push: |
| 13 | + branches: |
| 14 | + - "1.10.x" |
| 15 | + paths-ignore: |
| 16 | + - 'compiler/**' |
| 17 | + - 'apigen/**' |
| 18 | + - 'changelog-generator/**' |
| 19 | + - 'issue-bot/**' |
| 20 | + |
| 21 | +env: |
| 22 | + COMPOSER_ROOT_VERSION: "1.10.x-dev" |
| 23 | + REFLECTION_GOLDEN_TEST_FILE: "/tmp/reflection-golden.test" |
| 24 | + REFLECTION_GOLDEN_SYMBOLS_FILE: "/tmp/reflection-golden-symbols.txt" |
| 25 | + |
| 26 | +concurrency: |
| 27 | + group: reflection-golden-test-${{ github.head_ref || github.run_id }} # will be canceled on subsequent pushes in pull requests but not branches |
| 28 | + cancel-in-progress: true |
| 29 | + |
| 30 | +jobs: |
| 31 | + dump-php-symbols: |
| 32 | + name: "Dump PHP symbols" |
| 33 | + runs-on: "ubuntu-latest" |
| 34 | + |
| 35 | + steps: |
| 36 | + - name: "Checkout" |
| 37 | + uses: actions/checkout@v3 |
| 38 | + |
| 39 | + - name: "Install PHP" |
| 40 | + uses: "shivammathur/setup-php@v2" |
| 41 | + with: |
| 42 | + coverage: "none" |
| 43 | + php-version: "8.3" |
| 44 | + # Include exotic extensions to discover more symbols |
| 45 | + extensions: ds,mbstring,runkit7,scoutapm,seaslog,simdjson,var_representation,yac |
| 46 | + |
| 47 | + - name: "Install dependencies" |
| 48 | + run: "composer install --no-interaction --no-progress" |
| 49 | + |
| 50 | + - name: "Dump phpSymbols.txt" |
| 51 | + run: "php tests/dump-reflection-test-symbols.php" |
| 52 | + |
| 53 | + - uses: actions/upload-artifact@v3 |
| 54 | + with: |
| 55 | + name: phpSymbols |
| 56 | + path: ${{ env.REFLECTION_GOLDEN_SYMBOLS_FILE }} |
| 57 | + |
| 58 | + reflection-golden-test: |
| 59 | + name: "Reflection golden test" |
| 60 | + needs: dump-php-symbols |
| 61 | + runs-on: "ubuntu-latest" |
| 62 | + timeout-minutes: 60 |
| 63 | + |
| 64 | + strategy: |
| 65 | + fail-fast: false |
| 66 | + matrix: |
| 67 | + php-version: |
| 68 | + - "7.3" |
| 69 | + - "7.4" |
| 70 | + - "8.0" |
| 71 | + - "8.1" |
| 72 | + - "8.2" |
| 73 | + - "8.3" |
| 74 | + |
| 75 | + steps: |
| 76 | + - name: "Download phpSymbols.txt" |
| 77 | + uses: actions/download-artifact@v3 |
| 78 | + with: |
| 79 | + name: phpSymbols |
| 80 | + path: /tmp |
| 81 | + |
| 82 | + - name: "Checkout base commit" |
| 83 | + uses: actions/checkout@v3 |
| 84 | + with: |
| 85 | + ref: ${{ github.event.pull_request.base.sha || github.event.push.before }} |
| 86 | + |
| 87 | + - name: "Install PHP" |
| 88 | + uses: "shivammathur/setup-php@v2" |
| 89 | + with: |
| 90 | + coverage: "none" |
| 91 | + php-version: "${{ matrix.php-version }}" |
| 92 | + tools: pecl |
| 93 | + extensions: ds,mbstring |
| 94 | + ini-file: development |
| 95 | + ini-values: memory_limit=2G |
| 96 | + |
| 97 | + - name: "Install dependencies" |
| 98 | + run: "composer install --no-interaction --no-progress" |
| 99 | + |
| 100 | + - name: "Install PHP for code transform" |
| 101 | + if: matrix.php-version != '8.1' && matrix.php-version != '8.2' && matrix.php-version != '8.3' |
| 102 | + uses: "shivammathur/setup-php@v2" |
| 103 | + with: |
| 104 | + coverage: "none" |
| 105 | + php-version: 8.1 |
| 106 | + extensions: mbstring, intl |
| 107 | + |
| 108 | + - name: "Rector downgrade cache key" |
| 109 | + id: rector-cache-key-base |
| 110 | + if: matrix.php-version != '8.1' && matrix.php-version != '8.2' && matrix.php-version != '8.3' |
| 111 | + run: echo "sha=$(php build/rector-cache-files-hash.php)" >> $GITHUB_OUTPUT |
| 112 | + |
| 113 | + - name: "Rector downgrade cache" |
| 114 | + if: matrix.php-version != '8.1' && matrix.php-version != '8.2' && matrix.php-version != '8.3' |
| 115 | + uses: actions/cache@v3 |
| 116 | + with: |
| 117 | + path: ./tmp/rectorCache.php |
| 118 | + key: "rector-v3-tests-${{ matrix.script }}-${{ matrix.operating-system }}-${{ hashFiles('composer.lock', 'build/rector-downgrade.php') }}-${{ matrix.php-version }}-${{ steps.rector-cache-key-base.outputs.sha }}" |
| 119 | + restore-keys: | |
| 120 | + rector-v3-tests-${{ matrix.script }}-${{ matrix.operating-system }}-${{ hashFiles('composer.lock', 'build/rector-downgrade.php') }}-${{ matrix.php-version }}- |
| 121 | +
|
| 122 | + - name: "Transform source code" |
| 123 | + if: matrix.php-version != '8.1' && matrix.php-version != '8.2' && matrix.php-version != '8.3' |
| 124 | + shell: bash |
| 125 | + run: "build/transform-source ${{ matrix.php-version }}" |
| 126 | + |
| 127 | + - name: "Reinstall matrix PHP version" |
| 128 | + if: matrix.php-version != '8.1' && matrix.php-version != '8.2' && matrix.php-version != '8.3' |
| 129 | + uses: "shivammathur/setup-php@v2" |
| 130 | + with: |
| 131 | + coverage: "none" |
| 132 | + php-version: "${{ matrix.php-version }}" |
| 133 | + tools: pecl |
| 134 | + extensions: ds,mbstring |
| 135 | + ini-file: development |
| 136 | + ini-values: memory_limit=2G |
| 137 | + |
| 138 | + - name: "Dump previous reflection data" |
| 139 | + run: "php tests/generate-reflection-test.php" |
| 140 | + |
| 141 | + - uses: actions/upload-artifact@v3 |
| 142 | + with: |
| 143 | + name: reflection-${{ matrix.php-version }}.test |
| 144 | + path: ${{ env.REFLECTION_GOLDEN_TEST_FILE }} |
| 145 | + |
| 146 | + - name: "Checkout" |
| 147 | + uses: actions/checkout@v3 |
| 148 | + |
| 149 | + - name: "Install dependencies" |
| 150 | + run: "composer install --no-interaction --no-progress" |
| 151 | + |
| 152 | + - name: "Install PHP for code transform" |
| 153 | + if: matrix.php-version != '8.1' && matrix.php-version != '8.2' && matrix.php-version != '8.3' |
| 154 | + uses: "shivammathur/setup-php@v2" |
| 155 | + with: |
| 156 | + coverage: "none" |
| 157 | + php-version: 8.1 |
| 158 | + extensions: mbstring, intl |
| 159 | + |
| 160 | + - name: "Rector downgrade cache key" |
| 161 | + id: rector-cache-key-head |
| 162 | + if: matrix.php-version != '8.1' && matrix.php-version != '8.2' && matrix.php-version != '8.3' |
| 163 | + run: echo "sha=$(php build/rector-cache-files-hash.php)" >> $GITHUB_OUTPUT |
| 164 | + |
| 165 | + - name: "Rector downgrade cache" |
| 166 | + if: matrix.php-version != '8.1' && matrix.php-version != '8.2' && matrix.php-version != '8.3' |
| 167 | + uses: actions/cache@v3 |
| 168 | + with: |
| 169 | + path: ./tmp/rectorCache.php |
| 170 | + key: "rector-v3-tests-${{ matrix.script }}-${{ matrix.operating-system }}-${{ hashFiles('composer.lock', 'build/rector-downgrade.php') }}-${{ matrix.php-version }}-${{ steps.rector-cache-key-head.outputs.sha }}" |
| 171 | + restore-keys: | |
| 172 | + rector-v3-tests-${{ matrix.script }}-${{ matrix.operating-system }}-${{ hashFiles('composer.lock', 'build/rector-downgrade.php') }}-${{ matrix.php-version }}- |
| 173 | +
|
| 174 | + - name: "Transform source code" |
| 175 | + if: matrix.php-version != '8.1' && matrix.php-version != '8.2' && matrix.php-version != '8.3' |
| 176 | + shell: bash |
| 177 | + run: "build/transform-source ${{ matrix.php-version }}" |
| 178 | + |
| 179 | + - name: "Reinstall matrix PHP version" |
| 180 | + if: matrix.php-version != '8.1' && matrix.php-version != '8.2' && matrix.php-version != '8.3' |
| 181 | + uses: "shivammathur/setup-php@v2" |
| 182 | + with: |
| 183 | + coverage: "none" |
| 184 | + php-version: "${{ matrix.php-version }}" |
| 185 | + tools: pecl |
| 186 | + extensions: ds,mbstring |
| 187 | + ini-file: development |
| 188 | + ini-values: memory_limit=2G |
| 189 | + |
| 190 | + - name: "Reflection golden test" |
| 191 | + run: "make tests-golden-reflection" |
0 commit comments