-
Notifications
You must be signed in to change notification settings - Fork 68
157 lines (135 loc) · 5 KB
/
build.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
name: Build and test
on:
push:
branches-ignore: [gh-pages]
# pull_request:
# branches-ignore: [gh-pages]
jobs:
build:
name: Build (PHP ${{ matrix.php-versions }})
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['8.1']#, '8.2']
steps:
- name: Checkout sources
uses: actions/checkout@v3
# Docs: https://github.com/shivammathur/setup-php
- name: Setup PHP with PCOV
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: php-cs-fixer, phpunit-bridge
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite, mysql
coverage: pcov
#ini-values: post_max_size=256M, max_execution_time=180
- name: Start mysql service
run: sudo systemctl start mysql
- name: Get composer cache directory
id: composer-cache
run: |
dir="$(composer config cache-files-dir)"
echo "dir=$dir" >> $GITHUB_OUTPUT
- name: Cache composer dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Extract English translations
run: php bin/console translation:extract zikula en -vvv
test:
name: Tests (PHP ${{ matrix.php-versions }})
runs-on: ubuntu-latest
needs: build
strategy:
matrix:
php-versions: ['8.1']#, '8.2']
services:
mysql:
image: mysql:latest
env:
MYSQL_ALLOW_EMPTY_PASSWORD: false
MYSQL_ROOT_PASSWORD: 12345678
#MYSQL_DATABASE: zk_test
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Install composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Run linter
run: |
php bin/console lint:container
php bin/console lint:yaml config/
php bin/console lint:yaml src/system/ --parse-tags
php bin/console lint:yaml src/Zikula/ --parse-tags
php bin/console lint:twig --show-deprecations src/system/ src/Zikula/
- name: Cache vulnerability database
uses: actions/cache@v3
id: cache-db
with:
path: ~/.symfony/cache
key: db
- name: Run security checker
uses: symfonycorp/security-checker-action@v5
# - name: Run Migration
# run: |
# composer require --dev symfony/orm-pack
# php bin/console doctrine:schema:update --force || echo "No migrations found or schema update failed"
# php bin/console doctrine:migrations:migrate || echo "No migrations found or migration failed"
# env:
# DATABASE_URL: mysql://root:zikula@127.0.0.1:${{ job.services.mysql.ports['3306'] }}/zk_test
- name: Install PHPUnit
run: ./vendor/bin/simple-phpunit install
- name: Run unit tests
run: ./vendor/bin/simple-phpunit --coverage-text
- name: Test installation
run: ./.github/scripts/testInstall.sh
docs:
name: Documentation
if: github.ref_name == 'main'
runs-on: ubuntu-latest
needs: [build, test]
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Install composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader
- name: Dump vendors into doc
run: ./build.php build:generate_vendor_doc --write-to "docs/General/VendorInformation.md"
# GH action not possible yet
# see https://github.com/CouscousPHP/Couscous/issues/263
# see https://github.com/CouscousPHP/Couscous/issues/265
- name: Build docs
#uses: CouscousPHP/GitHub-Action@v1
run: |
wget https://github.com/CouscousPHP/Couscous/archive/refs/heads/master.zip
unzip master.zip && rm master.zip
cd Couscous-master && composer install && cd ..
Couscous-master/bin/couscous generate
rm -rf Couscous-master/
- name: Deploy docs
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./.couscous/generated
create-artifacts:
name: Package
runs-on: ubuntu-latest
needs: [build, test, docs]
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Build release artifacts
run: ./.github/scripts/buildReleaseArtifacts.sh
# see https://github.com/actions/upload-artifact
- name: Upload release artifacts
uses: actions/upload-artifact@master
with:
name: release-archives
path: './build_work/archive'