forked from zephir-lang/zephir
-
Notifications
You must be signed in to change notification settings - Fork 1
205 lines (169 loc) · 6.44 KB
/
build-unix.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
name: Unix CI
on:
push:
paths-ignore:
- '**.md'
- '**.txt'
pull_request:
branches:
- master
- development
env:
ZEPHIR_PARSER_VERSION: v1.3.6
jobs:
linux:
# To prevent build a particular commit use
# git commit -m "......... [ci skip]"
if: "!contains(github.event.head_commit.message, '[ci skip]')"
name: "${{ matrix.os }}: PHP v${{ matrix.php }}"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-18.04
# - macos-latest
php:
- '7.4'
- '8.0'
steps:
- name: Setup Prerequisites
run: |
# We don't need this at all, and our
# builds often fails because Microsoft
# servers are unstable or even offline.
sudo rm -f /etc/apt/sources.list.d/dotnetdev.list
sudo rm -f /etc/apt/sources.list.d/azure*.list
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: gmp, pdo_sqlite, psr, zip
tools: phpize, php-config
coverage: xdebug
# variables_order: https://github.com/zephir-lang/zephir/pull/1537
# enable_dl: https://github.com/zephir-lang/zephir/pull/1654
# allow_url_fopen: https://github.com/zephir-lang/zephir/issues/1713
# error_reporting: https://github.com/zendframework/zend-code/issues/160
ini-values: >-
variables_order=EGPCS,
enable_dl=On,
allow_url_fopen=On,
error_reporting=-1,
memory_limit=1G,
date.timezone=UTC,
xdebug.max_nesting_level=256
- name: Checkout Code
uses: actions/checkout@v2
with:
fetch-depth: 5
- name: Common Settings
run: |
# Core dump settings
ulimit -c unlimited -S || true
# Hide "You are in 'detached HEAD' state" message
git config --global advice.detachedHead false
# Will be used before as a cache key
export CPUHASH="$(cat /proc/cpuinfo | grep "model name" | head -n 1 | cut -d':' -f2 | md5sum)"
- name: Setup APT Repositories
if: startsWith(runner.os, 'Linux')
run: |
# We don't need this at all, and our
# builds often fails because Microsoft
# servers are unstable or even offline.
sudo rm -f /etc/apt/sources.list.d/dotnetdev.list
sudo rm -f /etc/apt/sources.list.d/azure*.list
# - name: Install System Dependencies (macOS)
# if: startsWith(runner.os, 'macOS')
# run: brew install re2c
- name: Install System Dependencies (Linux)
if: startsWith(runner.os, 'Linux')
run: |
sudo apt-get update --quiet --yes 1>/dev/null
sudo apt-get install --no-install-recommends -q -y re2c
- name: Get Zephir Parser Cache Key
id: pcache
run: echo ::set-output name=key::$(echo -n ${ZEPHIR_PARSER_VERSION}_${CPUHASH})
- name: Cache Zephir Parser
uses: actions/cache@v1
with:
path: ~/php-zephir-parser
key: ${{ runner.os }}-${{ matrix.php }}-zephir-parser-${{ steps.pcache.outputs.key }}
restore-keys: ${{ runner.os }}-${{ matrix.php }}-zephir-parser-
- name: Install Zephir Parser
run: .ci/install-zephir-parser.sh
- name: Get Composer Cache Directory
id: composer-cache
run: echo ::set-output name=dir::$(composer config cache-files-dir)
- name: Setup Composer Cache
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Setup Composer Token
run: |
# To increase the GitHub rate limit we're use GitHub authentication
if [ ! -z '${{ secrets.COMPOSER_TOKEN }}' ]; then
composer config github-oauth.github.com ${{ secrets.COMPOSER_TOKEN }}
fi
- name: Install Project Dependencies for PHP
run: composer install --prefer-dist --no-interaction --no-ansi --no-progress --no-suggest
- name: Prepare Zephir Executable
run: sudo ln -s "$(pwd)/zephir" /usr/local/bin/zephir
- name: Fast Commands Test
run: |
zephir --help
zephir clean
zephir fullclean
zephir generate
zephir stubs
zephir api
# - name: Compile Test Project (macOS)
# if: startsWith(runner.os, 'macOS')
# run: |
# # These variables are needed to produce non optimized code
# CFLAGS="-O0 -g"
# CXXFLAGS="-O0 -g"
# # Export variables in the subshell to not shadow global variables
# ( export CFLAGS CXXFLAGS; zephir compile ) || false
- name: Compile Stub Project (Linux)
if: startsWith(runner.os, 'Linux')
run: |
# These variables are needed to produce non optimized code as well as for code coverage
LDFLAGS="--coverage"
CFLAGS="-O0 -ggdb -fprofile-arcs -ftest-coverage"
CXXFLAGS="-O0 -ggdb -fprofile-arcs -ftest-coverage"
# Export variables in the subshell to not shadow global variables
( export LDFLAGS CFLAGS CXXFLAGS; zephir fullclean && zephir generate && cd ext/ && ./install ) || false
- name: Setup Problem Matchers for PHPUnit
run: echo ::add-matcher::${{ runner.tool_cache }}/phpunit.json
- name: Unit Testing - Extension
if: always()
run: |
php \
-d extension=ext/modules/stub.so \
vendor/bin/phpunit \
--colors=always \
--bootstrap tests/ext-bootstrap.php \
--testsuite Extension
- name: Unit Testing - Zephir
if: always()
run: vendor/bin/phpunit --colors=always --testsuite Zephir
- name: Black-box Testing
if: always()
run: cd tests/sharness && PHP=$(which php) make
- name: After Failure
if: failure()
run: .ci/after-failure.sh
- name: Upload Code Coverage Report
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
name: codecov-umbrella
flags: unittests
fail_ci_if_error: false
- name: Success Reporting
if: success()
run: git log --format=fuller -5