|
1 | 1 | name: Build
|
2 | 2 |
|
3 | 3 | on:
|
4 |
| - push: |
5 |
| - branches-ignore: |
6 |
| - - 'dependabot/**' |
7 |
| - pull_request: ~ |
8 |
| - release: |
9 |
| - types: [ created ] |
10 |
| - schedule: |
11 |
| - - cron: "0 1 * * 6" # Run at 1am every Saturday |
12 |
| - workflow_dispatch: ~ |
| 4 | + push: |
| 5 | + branches-ignore: |
| 6 | + - 'dependabot/**' |
| 7 | + pull_request: ~ |
| 8 | + release: |
| 9 | + types: [ created ] |
| 10 | + schedule: |
| 11 | + - cron: "0 1 * * 6" # Run at 1am every Saturday |
| 12 | + workflow_dispatch: ~ |
13 | 13 |
|
14 | 14 | jobs:
|
15 |
| - tests: |
16 |
| - runs-on: ubuntu-22.04 |
17 |
| - |
18 |
| - name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}" |
19 |
| - |
20 |
| - strategy: |
21 |
| - fail-fast: false |
22 |
| - matrix: |
23 |
| - php: [ "8.0" ] |
24 |
| - symfony: [ "^5.4", "^6.0" ] |
25 |
| - sylius: [ "~1.11.0", "~1.12.0" ] |
26 |
| - node: [ "^14.17.x" ] |
27 |
| - mysql: [ "5.7", "8.0" ] |
28 |
| - |
29 |
| - exclude: |
30 |
| - - sylius: ~1.11.0 |
31 |
| - symfony: "^6.0" |
32 |
| - env: |
33 |
| - APP_ENV: test |
34 |
| - DATABASE_URL: "mysql://root:root@127.0.0.1/sylius?serverVersion=${{ matrix.mysql }}" |
35 |
| - |
36 |
| - steps: |
37 |
| - - uses: actions/checkout@v2 |
38 |
| - |
39 |
| - - name: Setup PHP |
40 |
| - uses: shivammathur/setup-php@v2 |
41 |
| - with: |
42 |
| - php-version: "${{ matrix.php }}" |
43 |
| - extensions: intl |
44 |
| - tools: symfony |
45 |
| - coverage: none |
46 |
| - |
47 |
| - - name: Setup Node |
48 |
| - uses: actions/setup-node@v1 |
49 |
| - with: |
50 |
| - node-version: "${{ matrix.node }}" |
51 |
| - |
52 |
| - - name: Shutdown default MySQL |
53 |
| - run: sudo service mysql stop |
54 |
| - |
55 |
| - - name: Setup MySQL |
56 |
| - uses: mirromutth/mysql-action@v1.1 |
57 |
| - with: |
58 |
| - mysql version: "${{ matrix.mysql }}" |
59 |
| - mysql root password: "root" |
60 |
| - |
61 |
| - - name: Configure sysctl limits |
62 |
| - run: | |
63 |
| - sudo swapoff -a |
64 |
| - sudo sysctl -w vm.swappiness=1 |
65 |
| - sudo sysctl -w fs.file-max=262144 |
66 |
| - sudo sysctl -w vm.max_map_count=262144 |
67 |
| -
|
68 |
| - - name: Runs Elasticsearch |
69 |
| - uses: elastic/elastic-github-actions/elasticsearch@master |
70 |
| - with: |
71 |
| - stack-version: 7.16.3 |
72 |
| - |
73 |
| - - name: Output PHP version for Symfony CLI |
74 |
| - run: php -v | head -n 1 | awk '{ print $2 }' > .php-version |
75 |
| - |
76 |
| - - name: Install certificates |
77 |
| - run: symfony server:ca:install |
78 |
| - |
79 |
| - - name: Run Chrome Headless |
80 |
| - run: google-chrome-stable --enable-automation --disable-background-networking --no-default-browser-check --no-first-run --disable-popup-blocking --disable-default-apps --allow-insecure-localhost --disable-translate --disable-extensions --no-sandbox --enable-features=Metal --headless --remote-debugging-port=9222 --window-size=2880,1800 --proxy-server='direct://' --proxy-bypass-list='*' http://127.0.0.1 > /dev/null 2>&1 & |
81 |
| - |
82 |
| - - name: Run webserver |
83 |
| - run: (cd tests/Application && symfony server:start --port=8080 --dir=public --daemon) |
84 |
| - |
85 |
| - - name: Get Composer cache directory |
86 |
| - id: composer-cache |
87 |
| - run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
88 |
| - |
89 |
| - - name: Cache Composer |
90 |
| - uses: actions/cache@v2 |
91 |
| - with: |
92 |
| - path: ${{ steps.composer-cache.outputs.dir }} |
93 |
| - key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json **/composer.lock') }} |
94 |
| - restore-keys: | |
95 |
| - ${{ runner.os }}-php-${{ matrix.php }}-composer- |
96 |
| -
|
97 |
| - - name: Restrict Symfony version |
98 |
| - if: matrix.symfony != '' |
99 |
| - run: | |
100 |
| - composer global config --no-plugins allow-plugins.symfony/flex true |
101 |
| - composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^1.10" |
102 |
| - composer config extra.symfony.require "${{ matrix.symfony }}" |
103 |
| -
|
104 |
| - - name: Restrict Sylius version |
105 |
| - if: matrix.sylius != '' |
106 |
| - run: composer require "sylius/sylius:${{ matrix.sylius }}" --no-update --no-scripts --no-interaction |
107 |
| - |
108 |
| - - name: Install PHP dependencies |
109 |
| - run: composer install --no-interaction --no-scripts |
110 |
| - |
111 |
| - - name: Get Yarn cache directory |
112 |
| - id: yarn-cache |
113 |
| - run: echo "::set-output name=dir::$(yarn cache dir)" |
114 |
| - |
115 |
| - - name: Cache Yarn |
116 |
| - uses: actions/cache@v2 |
117 |
| - with: |
118 |
| - path: ${{ steps.yarn-cache.outputs.dir }} |
119 |
| - key: ${{ runner.os }}-node-${{ matrix.node }}-yarn-${{ hashFiles('**/package.json **/yarn.lock') }} |
120 |
| - restore-keys: | |
121 |
| - ${{ runner.os }}-node-${{ matrix.node }}-yarn- |
122 |
| -
|
123 |
| - - name: Install JS dependencies |
124 |
| - run: (cd tests/Application && yarn install) |
125 |
| - |
126 |
| - - name: Prepare test application database |
127 |
| - run: | |
128 |
| - (cd tests/Application && bin/console doctrine:database:create -vvv) |
129 |
| - (cd tests/Application && bin/console doctrine:schema:create -vvv) |
130 |
| -
|
131 |
| - - name: Prepare test application assets |
132 |
| - run: | |
133 |
| - (cd tests/Application && bin/console assets:install public -vvv) |
134 |
| - (cd tests/Application && yarn encore dev) |
135 |
| -
|
136 |
| - - name: Prepare test application cache |
137 |
| - run: (cd tests/Application && bin/console cache:warmup -vvv) |
138 |
| - |
139 |
| - - name: Load fixtures in test application |
140 |
| - run: (cd tests/Application && bin/console sylius:fixtures:load -n) |
141 |
| - |
142 |
| - - name: Validate composer.json |
143 |
| - run: composer validate --ansi --strict |
144 |
| - |
145 |
| - - name: Validate database schema |
146 |
| - run: (cd tests/Application && bin/console doctrine:schema:validate) |
147 |
| - |
148 |
| - - name: Run PHPSpec |
149 |
| - run: vendor/bin/phpspec run --ansi -f progress --no-interaction |
150 |
| - |
151 |
| - - name: Run Behat |
152 |
| - run: vendor/bin/behat --colors --strict -vvv --no-interaction || vendor/bin/behat --colors --strict -vvv --no-interaction --rerun |
153 |
| - |
154 |
| - - name: Failed build Slack notification |
155 |
| - uses: rtCamp/action-slack-notify@v2 |
156 |
| - if: ${{ failure() && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') }} |
157 |
| - env: |
158 |
| - SLACK_CHANNEL: ${{ secrets.FAILED_BUILD_SLACK_CHANNEL }} |
159 |
| - SLACK_COLOR: ${{ job.status }} |
160 |
| - SLACK_ICON: https://github.com/rtCamp.png?size=48 |
161 |
| - SLACK_MESSAGE: ':x:' |
162 |
| - SLACK_TITLE: Failed build on ${{ github.event.repository.name }} repository |
163 |
| - SLACK_USERNAME: ${{ secrets.FAILED_BUILD_SLACK_USERNAME }} |
164 |
| - SLACK_WEBHOOK: ${{ secrets.FAILED_BUILD_SLACK_WEBHOOK }} |
| 15 | + tests: |
| 16 | + runs-on: ubuntu-22.04 |
| 17 | + |
| 18 | + name: "Sylius ${{ matrix.sylius }}, PHP ${{ matrix.php }}, Symfony ${{ matrix.symfony }}, MySQL ${{ matrix.mysql }}" |
| 19 | + |
| 20 | + strategy: |
| 21 | + fail-fast: false |
| 22 | + matrix: |
| 23 | + php: [ "8.0", "8.1", "8.2", "8.3" ] |
| 24 | + symfony: [ "^5.4", "^6.0" ] |
| 25 | + sylius: [ "~1.12.0", "~1.13.0" ] |
| 26 | + node: [ "^14.17.x" ] |
| 27 | + mysql: [ "5.7", "8.0" ] |
| 28 | + |
| 29 | + env: |
| 30 | + APP_ENV: test |
| 31 | + DATABASE_URL: "mysql://root:root@127.0.0.1/sylius?serverVersion=${{ matrix.mysql }}" |
| 32 | + |
| 33 | + steps: |
| 34 | + - uses: actions/checkout@v3 |
| 35 | + |
| 36 | + - name: Setup PHP |
| 37 | + uses: shivammathur/setup-php@v2 |
| 38 | + with: |
| 39 | + php-version: "${{ matrix.php }}" |
| 40 | + extensions: intl |
| 41 | + tools: symfony |
| 42 | + coverage: none |
| 43 | + |
| 44 | + - name: Setup Node |
| 45 | + uses: actions/setup-node@v4 |
| 46 | + with: |
| 47 | + node-version: "${{ matrix.node }}" |
| 48 | + |
| 49 | + - name: Shutdown default MySQL |
| 50 | + run: sudo service mysql stop |
| 51 | + |
| 52 | + - name: Setup MySQL |
| 53 | + uses: mirromutth/mysql-action@v1.1 |
| 54 | + with: |
| 55 | + mysql version: "${{ matrix.mysql }}" |
| 56 | + mysql root password: "root" |
| 57 | + |
| 58 | + - name: Configure sysctl limits |
| 59 | + run: | |
| 60 | + sudo swapoff -a |
| 61 | + sudo sysctl -w vm.swappiness=1 |
| 62 | + sudo sysctl -w fs.file-max=262144 |
| 63 | + sudo sysctl -w vm.max_map_count=262144 |
| 64 | + |
| 65 | + - name: Runs Elasticsearch |
| 66 | + uses: elastic/elastic-github-actions/elasticsearch@master |
| 67 | + with: |
| 68 | + stack-version: 7.16.3 |
| 69 | + |
| 70 | + - name: Output PHP version for Symfony CLI |
| 71 | + run: php -v | head -n 1 | awk '{ print $2 }' > .php-version |
| 72 | + |
| 73 | + - name: Install certificates |
| 74 | + run: symfony server:ca:install |
| 75 | + |
| 76 | + - name: Run Chrome Headless |
| 77 | + run: google-chrome-stable --enable-automation --disable-background-networking --no-default-browser-check --no-first-run --disable-popup-blocking --disable-default-apps --allow-insecure-localhost --disable-translate --disable-extensions --no-sandbox --enable-features=Metal --headless --remote-debugging-port=9222 --window-size=2880,1800 --proxy-server='direct://' --proxy-bypass-list='*' http://127.0.0.1 > /dev/null 2>&1 & |
| 78 | + |
| 79 | + - name: Run webserver |
| 80 | + run: (cd tests/Application && symfony server:start --port=8080 --dir=public --daemon) |
| 81 | + |
| 82 | + - name: Get Composer cache directory |
| 83 | + id: composer-cache |
| 84 | + run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 85 | + |
| 86 | + - name: Cache Composer |
| 87 | + uses: actions/cache@v2 |
| 88 | + with: |
| 89 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 90 | + key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json **/composer.lock') }} |
| 91 | + restore-keys: | |
| 92 | + ${{ runner.os }}-php-${{ matrix.php }}-composer- |
| 93 | + |
| 94 | + - name: Restrict Symfony version |
| 95 | + if: matrix.symfony != '' |
| 96 | + run: | |
| 97 | + composer global config --no-plugins allow-plugins.symfony/flex true |
| 98 | + composer global require --no-progress --no-scripts --no-plugins "symfony/flex:^1.10" |
| 99 | + composer config extra.symfony.require "${{ matrix.symfony }}" |
| 100 | + |
| 101 | + - name: Restrict Sylius version |
| 102 | + if: matrix.sylius != '' |
| 103 | + run: composer require "sylius/sylius:${{ matrix.sylius }}" --no-update --no-scripts --no-interaction |
| 104 | + |
| 105 | + - name: Install PHP dependencies |
| 106 | + run: composer install --no-interaction --no-scripts |
| 107 | + |
| 108 | + - name: Get Yarn cache directory |
| 109 | + id: yarn-cache |
| 110 | + run: echo "::set-output name=dir::$(yarn cache dir)" |
| 111 | + |
| 112 | + - name: Cache Yarn |
| 113 | + uses: actions/cache@v2 |
| 114 | + with: |
| 115 | + path: ${{ steps.yarn-cache.outputs.dir }} |
| 116 | + key: ${{ runner.os }}-node-${{ matrix.node }}-yarn-${{ hashFiles('**/package.json **/yarn.lock') }} |
| 117 | + restore-keys: | |
| 118 | + ${{ runner.os }}-node-${{ matrix.node }}-yarn- |
| 119 | + |
| 120 | + - name: Install JS dependencies |
| 121 | + run: (cd tests/Application && yarn install) |
| 122 | + |
| 123 | + - name: Prepare test application database |
| 124 | + run: | |
| 125 | + (cd tests/Application && bin/console doctrine:database:create -vvv) |
| 126 | + (cd tests/Application && bin/console doctrine:schema:create -vvv) |
| 127 | + |
| 128 | + - name: Prepare test application assets |
| 129 | + run: | |
| 130 | + (cd tests/Application && bin/console assets:install public -vvv) |
| 131 | + (cd tests/Application && yarn encore dev) |
| 132 | + |
| 133 | + - name: Prepare test application cache |
| 134 | + run: (cd tests/Application && bin/console cache:warmup -vvv) |
| 135 | + |
| 136 | + - name: Load fixtures in test application |
| 137 | + run: (cd tests/Application && bin/console sylius:fixtures:load -n) |
| 138 | + |
| 139 | + - name: Validate composer.json |
| 140 | + run: composer validate --ansi --strict |
| 141 | + |
| 142 | + - name: Validate database schema |
| 143 | + run: (cd tests/Application && bin/console doctrine:schema:validate) |
| 144 | + |
| 145 | + - name: Run PHPSpec |
| 146 | + run: vendor/bin/phpspec run --ansi -f progress --no-interaction |
| 147 | + |
| 148 | + - name: Run Behat |
| 149 | + run: vendor/bin/behat --colors --strict -vvv --no-interaction || vendor/bin/behat --colors --strict -vvv --no-interaction --rerun |
| 150 | + |
| 151 | + - name: Failed build Slack notification |
| 152 | + uses: rtCamp/action-slack-notify@v2 |
| 153 | + if: ${{ failure() && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') }} |
| 154 | + env: |
| 155 | + SLACK_CHANNEL: ${{ secrets.FAILED_BUILD_SLACK_CHANNEL }} |
| 156 | + SLACK_COLOR: ${{ job.status }} |
| 157 | + SLACK_ICON: https://github.com/rtCamp.png?size=48 |
| 158 | + SLACK_MESSAGE: ':x:' |
| 159 | + SLACK_TITLE: Failed build on ${{ github.event.repository.name }} repository |
| 160 | + SLACK_USERNAME: ${{ secrets.FAILED_BUILD_SLACK_USERNAME }} |
| 161 | + SLACK_WEBHOOK: ${{ secrets.FAILED_BUILD_SLACK_WEBHOOK }} |
0 commit comments