Skip to content

Commit 1490cd2

Browse files
author
Nathan Esayeas
authored
Build demo app via Github Actions (#371)
1 parent d727bd1 commit 1490cd2

File tree

1 file changed

+116
-0
lines changed

1 file changed

+116
-0
lines changed

.github/workflows/demo.yml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: Demo
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
ref:
7+
description: "The branch, tag or SHA to checkout."
8+
required: false
9+
default: ""
10+
11+
jobs:
12+
build:
13+
name: PHP ${{ matrix.php-version }} - L${{ matrix.laravel-version }} - ${{ matrix.os }}
14+
15+
services:
16+
mysql:
17+
image: mysql:5.7
18+
env:
19+
MYSQL_ALLOW_EMPTY_PASSWORD: yes
20+
MYSQL_DATABASE: laravel
21+
ports:
22+
- 3306:3306
23+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
24+
25+
strategy:
26+
fail-fast: false
27+
matrix:
28+
php-version: [7.3, 7.4]
29+
laravel-version: [6, 7, 8]
30+
os: [ubuntu-latest]
31+
32+
runs-on: ${{ matrix.os }}
33+
34+
continue-on-error: true
35+
steps:
36+
- name: Checkout code
37+
uses: actions/checkout@v2
38+
with:
39+
ref: ${{ github.event.inputs.ref }}
40+
41+
- name: Determine composer cache directory
42+
id: determine-composer-cache-directory
43+
run: 'echo "::set-output name=directory::$(composer config cache-dir)"'
44+
45+
- name: Cache dependencies
46+
uses: actions/cache@v2
47+
with:
48+
path: ${{ steps.determine-composer-cache-directory.outputs.directory }}
49+
key: dependencies-os-${{ matrix.os }}-php-${{ matrix.php-version }}-laravel-${{ matrix.laravel-version }}-composer-${{ hashFiles('**/composer.lock') }}
50+
restore-keys: dependencies-os-${{ matrix.os }}-php-${{ matrix.php-version }}-laravel-${{ matrix.laravel-version }}-composer-
51+
52+
- name: Setup PHP
53+
uses: shivammathur/setup-php@v2
54+
with:
55+
php-version: ${{ matrix.php-version }}
56+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, gd
57+
coverage: none
58+
tools: composer:v2
59+
ini-values: "memory_limit=-1"
60+
61+
- name: Setup problem matchers for PHP
62+
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
63+
64+
- name: Setup problem matchers for PHPUnit
65+
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
66+
67+
- name: Create a Laravel app
68+
uses: nick-invision/retry@v1
69+
with:
70+
timeout_minutes: 5
71+
max_attempts: 5
72+
command: composer create-project --prefer-dist laravel/laravel:${{ matrix.laravel-version }}.* /home/runner/work/blueprint/laravel${{ matrix.laravel-version }}-example
73+
74+
- name: Link local repository
75+
uses: nick-invision/retry@v1
76+
with:
77+
timeout_minutes: 5
78+
max_attempts: 5
79+
command: 'composer config repositories.local "{\"type\": \"path\", \"url\": \"/home/runner/work/blueprint/blueprint\"}" --file /home/runner/work/blueprint/laravel${{ matrix.laravel-version }}-example/composer.json'
80+
81+
- name: Install Blueprint & laravel-test-assertions
82+
uses: nick-invision/retry@v1
83+
with:
84+
timeout_minutes: 5
85+
max_attempts: 5
86+
command: cd /home/runner/work/blueprint/laravel${{ matrix.laravel-version }}-example; composer require --dev laravel-shift/blueprint @dev; composer require jasonmccreary/laravel-test-assertions;
87+
88+
- name: Run migrate:refresh
89+
uses: nick-invision/retry@v1
90+
with:
91+
timeout_minutes: 5
92+
max_attempts: 5
93+
command: cd /home/runner/work/blueprint/laravel${{ matrix.laravel-version }}-example; php artisan migrate:refresh --force
94+
95+
- name: Run blueprint:build
96+
uses: nick-invision/retry@v1
97+
with:
98+
timeout_minutes: 5
99+
max_attempts: 5
100+
command: cd /home/runner/work/blueprint/laravel${{ matrix.laravel-version }}-example; php artisan blueprint:build /home/runner/work/blueprint/blueprint/tests/fixtures/drafts/readme-example.yaml
101+
102+
- name: Run PHPUnit
103+
uses: nick-invision/retry@v1
104+
if: ${{ matrix.laravel-version == 6 }}
105+
with:
106+
timeout_minutes: 5
107+
max_attempts: 5
108+
command: cd /home/runner/work/blueprint/laravel${{ matrix.laravel-version }}-example; pwd; vendor/bin/phpunit --verbose
109+
110+
- name: Run artisan test
111+
uses: nick-invision/retry@v1
112+
if: ${{ matrix.laravel-version != 6 }}
113+
with:
114+
timeout_minutes: 5
115+
max_attempts: 5
116+
command: cd /home/runner/work/blueprint/laravel${{ matrix.laravel-version }}-example; php artisan test

0 commit comments

Comments
 (0)