|
32 | 32 | steps: |
33 | 33 | - name: Checkout |
34 | 34 | uses: actions/checkout@v4 |
| 35 | + with: |
| 36 | + fetch-depth: 0 |
35 | 37 |
|
36 | 38 | - name: Setup PHP |
37 | 39 | if: env.COVERAGE_LANE != 'true' |
@@ -101,13 +103,22 @@ jobs: |
101 | 103 | run: | |
102 | 104 | n=0 |
103 | 105 | while [ "$n" -lt 60 ]; do |
104 | | - if (echo > /dev/tcp/127.0.0.1/9307) >/dev/null 2>&1; then |
| 106 | + if php -r ' |
| 107 | + try { |
| 108 | + $pdo = new PDO("mysql:host=127.0.0.1;port=9307", "", ""); |
| 109 | + $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
| 110 | + $pdo->query("SHOW TABLES"); |
| 111 | + exit(0); |
| 112 | + } catch (Throwable $exception) { |
| 113 | + exit(1); |
| 114 | + } |
| 115 | + ' >/dev/null 2>&1; then |
105 | 116 | exit 0 |
106 | 117 | fi |
107 | 118 | n=$((n + 1)) |
108 | 119 | sleep 1 |
109 | 120 | done |
110 | | - echo "searchd did not become ready on 127.0.0.1:9307" |
| 121 | + echo "searchd did not become SQL-ready on 127.0.0.1:9307" |
111 | 122 | docker logs searchd || true |
112 | 123 | exit 1 |
113 | 124 |
|
@@ -147,36 +158,25 @@ jobs: |
147 | 158 |
|
148 | 159 | if [ "${{ github.event_name }}" = "pull_request" ]; then |
149 | 160 | BASE_SHA="${{ github.event.pull_request.base.sha }}" |
150 | | - BASE_REF="${{ github.event.pull_request.base.ref }}" |
151 | 161 | BASE_LABEL="PR base (${BASE_SHA})" |
152 | | - git fetch --no-tags --depth=1 origin "${BASE_REF}" || true |
153 | | -
|
154 | | - if ! git cat-file -e "${BASE_SHA}^{commit}" 2>/dev/null; then |
155 | | - if git cat-file -e "origin/${BASE_REF}^{commit}" 2>/dev/null; then |
156 | | - BASE_SHA="origin/${BASE_REF}" |
157 | | - BASE_LABEL="PR base ref (${BASE_SHA})" |
158 | | - else |
159 | | - BASE_SHA="$(git rev-parse HEAD~1)" |
160 | | - BASE_LABEL="fallback (HEAD~1)" |
161 | | - fi |
162 | | - fi |
163 | 162 | else |
164 | 163 | BASE_SHA="${{ github.event.before }}" |
| 164 | + BASE_LABEL="push before (${BASE_SHA})" |
| 165 | + fi |
| 166 | +
|
| 167 | + if [ -z "${BASE_SHA}" ] \ |
| 168 | + || [ "${BASE_SHA}" = "0000000000000000000000000000000000000000" ] \ |
| 169 | + || ! git cat-file -e "${BASE_SHA}^{commit}" 2>/dev/null; then |
165 | 170 | DEFAULT_BRANCH="${{ github.event.repository.default_branch }}" |
166 | | - if [ -z "${BASE_SHA}" ] \ |
167 | | - || [ "${BASE_SHA}" = "0000000000000000000000000000000000000000" ] \ |
168 | | - || ! git cat-file -e "${BASE_SHA}^{commit}" 2>/dev/null; then |
169 | | - git fetch --no-tags --depth=2 origin "${DEFAULT_BRANCH}" || true |
170 | | - if git cat-file -e "origin/${DEFAULT_BRANCH}~1^{commit}" 2>/dev/null; then |
171 | | - BASE_SHA="origin/${DEFAULT_BRANCH}~1" |
172 | | - BASE_LABEL="fallback (${BASE_SHA})" |
173 | | - else |
174 | | - BASE_SHA="$(git rev-parse HEAD~1)" |
175 | | - BASE_LABEL="fallback (HEAD~1)" |
176 | | - fi |
| 171 | + if git show-ref --verify --quiet "refs/remotes/origin/${DEFAULT_BRANCH}"; then |
| 172 | + BASE_SHA="$(git merge-base "origin/${DEFAULT_BRANCH}" HEAD)" |
| 173 | + BASE_LABEL="merge-base (origin/${DEFAULT_BRANCH})" |
| 174 | + elif git cat-file -e "HEAD~1^{commit}" 2>/dev/null; then |
| 175 | + BASE_SHA="$(git rev-parse HEAD~1)" |
| 176 | + BASE_LABEL="fallback (HEAD~1)" |
177 | 177 | else |
178 | | - BASE_LABEL="push before (${BASE_SHA})" |
179 | | - git fetch --no-tags --depth=1 origin "${BASE_SHA}" || true |
| 178 | + BASE_SHA="$(git rev-parse HEAD)" |
| 179 | + BASE_LABEL="fallback (HEAD)" |
180 | 180 | fi |
181 | 181 | fi |
182 | 182 |
|
|
0 commit comments