-
Notifications
You must be signed in to change notification settings - Fork 1
133 lines (107 loc) · 4.13 KB
/
blank.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
name: Satellite CI
env:
DOCKER_BUILDKIT: 1
on:
push:
branches: [master]
pull_request:
branches: [master]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
tests:
name: Tests
runs-on: ${{ matrix.os }}
env:
PHP_EXTENSIONS: dom, json, libxml, mbstring, pdo_sqlite, soap, xml, xmlwriter, :apcu, :imagick
PHP_INI_VALUES: memory_limit=-1, assert.exception=1, zend.assertions=1, error_reporting=-1, log_errors_max_len=0, display_errors=On
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
# todo: test windows when php-actions/composer issue is solved https://github.com/php-actions/composer/issues/43
#- windows-latest
php-version:
- "8.1"
compiler:
- default
dependencies:
- lowest
- highest
include:
- os: ubuntu-latest
php-version: "8.1"
compiler: jit
dependencies: highest
steps:
- name: Configure git to avoid issues with line endings
if: matrix.os == 'windows-latest'
run: git config --global core.autocrlf false
- name: Checkout
uses: actions/checkout@v2
- name: Override PHP ini values for JIT compiler
if: matrix.compiler == 'jit'
run: echo "PHP_INI_VALUES::assert.exception=1, memory_limit=-1, zend.assertions=1, opcache.enable=1, opcache.enable_cli=1, opcache.optimization_level=-1, opcache.jit=1255, opcache.jit_buffer_size=32M" >> $GITHUB_ENV
- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: ${{ env.PHP_EXTENSIONS }}
ini-values: ${{ env.PHP_INI_VALUES }}
tools: none
- name: Install lowest dependencies with composer
if: matrix.dependencies == 'lowest'
uses: php-actions/composer@v6
with:
command: update
args: --no-ansi --no-interaction --no-progress --prefer-lowest
- name: Install highest dependencies with composer
if: matrix.dependencies == 'highest'
uses: php-actions/composer@v6
with:
command: update
args: --no-ansi --no-interaction --no-progress
- name: Run tests with phpunit
uses: php-actions/phpunit@v3
with:
configuration: phpunit-ci.xml
bootstrap: vendor/autoload.php
#args: --bootstrap=vendor/autoload.php
build_app:
name: Build and publish app docker images
runs-on: ubuntu-latest
needs:
- tests
steps:
- uses: actions/checkout@v2
- name: Set Branch or Tag
id: vars
run: echo ::set-output name=short_ref::${GITHUB_REF##*/}
- name: Getting PHP App together
run: |
touch .env
echo "SOME_ENV=yes" >> .env
- name: Docker Registry login
run: docker login -u ${{ secrets.DOCKER_REG_USER }} -p ${{ secrets.DOCKER_REG_PASS }}
- name: Docker pull
run: docker-compose -f docker-compose--prod.yml pull
env:
APP_BUILD_VERSION: ${{ steps.vars.outputs.short_ref }}
- name: Docker build
run: docker-compose -f docker-compose--prod.yml build --build-arg BUILDKIT_INLINE_CACHE=1
env:
APP_BUILD_VERSION: ${{ steps.vars.outputs.short_ref }}
- name: Run tests in the just build app image
run: docker run -i --rm bemiteu/satellite-app:${APP_BUILD_VERSION} sh -c "cd /var/www && wget -O phpunit https://phar.phpunit.de/phpunit-9.phar && chmod +x phpunit && cd html && /var/www/phpunit --testdox tests"
env:
APP_BUILD_VERSION: ${{ steps.vars.outputs.short_ref }}
- name: Publish App image `master` with tag `latest`
if: github.ref == 'refs/heads/master'
run: |
docker tag bemiteu/satellite-app:master bemiteu/satellite-app:latest
docker push bemiteu/satellite-app:latest
- name: Docker Registry publish
run: docker-compose -f docker-compose--prod.yml push
env:
APP_BUILD_VERSION: ${{ steps.vars.outputs.short_ref }}