Skip to content

Commit 44871dd

Browse files
committed
Add unix flow
1 parent 2fde5fa commit 44871dd

File tree

1 file changed

+133
-2
lines changed

1 file changed

+133
-2
lines changed

.github/workflows/ci.yml

Lines changed: 133 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: CI
22

33
on:
4+
schedule:
5+
- cron: '0 2 * * *' # Daily at 02:00 runs only on default branch
46
push:
57
branches-ignore:
68
- 'wip-*'
@@ -10,10 +12,9 @@ on:
1012
branches:
1113
- master
1214
- development
13-
schedule:
14-
- cron: '0 11 * * *'
1515

1616
env:
17+
RE2C_VERSION: 2.2
1718
PHP_SDK_VERSION: 2.2.0
1819
PHP_DEVPACK: C:\tools\php-devpack
1920
PHP_SDK_PATH: C:\tools\php-sdk
@@ -214,3 +215,133 @@ jobs:
214215
${{ github.workspace }}\parser
215216
${{ github.workspace }}\Release*
216217
${{ github.workspace }}\**\Release*
218+
219+
unix:
220+
# To prevent build a particular commit use
221+
# git commit -m "......... [unix skip] - skip Linux & macOS builds only"
222+
# git commit -m "......... [ci skip] - skip all builds"
223+
if: "!contains(github.event.head_commit.message, '[unix skip]') || !contains(github.event.head_commit.message, '[ci skip]') "
224+
225+
strategy:
226+
fail-fast: false
227+
228+
matrix:
229+
php: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
230+
name:
231+
- Ubuntu
232+
- macOS
233+
234+
include:
235+
- name: Ubuntu
236+
os: ubuntu-18.04
237+
ccov: ON
238+
239+
- name: macOS
240+
os: macos-latest
241+
ccov: OFF
242+
243+
name: "${{ matrix.name }}: PHP ${{ matrix.php }}"
244+
runs-on: ${{ matrix.os }}
245+
246+
env:
247+
HOMEBREW_NO_INSTALL_CLEANUP: 1
248+
ZEND_DONT_UNLOAD_MODULES: 1
249+
USE_ZEND_ALLOC: 0
250+
251+
steps:
252+
- uses: actions/checkout@v2
253+
with:
254+
fetch-depth: 5
255+
256+
- name: Install PHP ${{ matrix.php }}
257+
uses: shivammathur/setup-php@v2
258+
with:
259+
php-version: '${{ matrix.php }}'
260+
coverage: none
261+
262+
- name: Cache RE2C Downloads
263+
uses: actions/cache@v2
264+
with:
265+
path: ~/.cache/re2c
266+
key: ${{ runner.os }}-php-${{ matrix.php }}-re2c-${{env.RE2C_VERSION}}
267+
268+
- name: Setup Prerequisites (Linux)
269+
if: runner.os == 'Linux'
270+
run: |
271+
sudo apt-get update --quiet --yes 1>/dev/null
272+
sudo apt-get install --no-install-recommends --quiet --yes lcov gdb
273+
274+
- name: Setup Prerequisites (macOS)
275+
if: runner.os == 'macOS' && matrix.ccov == 'ON'
276+
run: |
277+
brew install lcov
278+
sudo xcode-select -switch /Applications/Xcode.app
279+
280+
- name: Setup Build System (Generic)
281+
run: |
282+
ulimit -c unlimited -S || true
283+
284+
mkdir -p $HOME/.cache/re2c
285+
mkdir -p $HOME/.local/opt/re2c
286+
287+
echo "PATH=$PATH:$HOME/bin:$(brew --prefix lcov)/bin" >> $GITHUB_ENV
288+
echo "MAKEFLAGS=-j$(getconf _NPROCESSORS_ONLN)" >> $GITHUB_ENV
289+
echo "CI=true" >> $GITHUB_ENV
290+
echo "ZEPHIR_PARSER_VERSION=$(head -1 VERSION)" >> $GITHUB_ENV
291+
292+
- name: Setup Core Dump (Linux)
293+
if: runner.os == 'Linux'
294+
run: echo '/tmp/core.%e.%p.%t' | sudo tee /proc/sys/kernel/core_pattern
295+
296+
- name: Install re2c
297+
run: .ci/install-re2c.sh
298+
299+
- name: Build extensions
300+
run: |
301+
phpize
302+
303+
if [ "${{ matrix.ccov }}" = "ON" ]; then
304+
./configure \
305+
--enable-zephir-parser \
306+
--enable-zephir-parser-debug \
307+
--enable-coverage
308+
else
309+
./configure \
310+
--enable-zephir-parser \
311+
--enable-zephir-parser-debug
312+
fi
313+
314+
make -j$(getconf _NPROCESSORS_ONLN)
315+
316+
- name: Preparing to collect coverage data
317+
if: matrix.ccov == 'ON'
318+
run: make coverage-initial
319+
320+
- name: Run Tests
321+
run: |
322+
php -d extension=./modules/zephir_parser.so --ri 'Zephir Parser'
323+
make test NO_INTERACTION=1 REPORT_EXIT_STATUS=1
324+
325+
- name: Print failures
326+
if: failure() && runner.os == 'Linux'
327+
run: .ci/after-failure.sh
328+
329+
- name: Capture coverage data
330+
if: success() && matrix.ccov == 'ON'
331+
run: make coverage-capture
332+
333+
- name: Upload code coverage report
334+
if: matrix.ccov == 'ON'
335+
uses: codecov/codecov-action@v1
336+
with:
337+
token: ${{secrets.CODECOV_TOKEN}}
338+
file: ./lcov.info
339+
flags: unittests
340+
fail_ci_if_error: false
341+
342+
- name: Upload Zephir Parser
343+
uses: actions/upload-artifact@v2
344+
with:
345+
name: zephir-parser-v${{env.ZEPHIR_PARSER_VERSION}}-php-${{ matrix.php }}-${{ runner.os }}
346+
path: |
347+
${{ github.workspace }}/modules/*.so

0 commit comments

Comments
 (0)