Skip to content

Commit 79e0a06

Browse files
authored
Create README.md
1 parent 3f95cf6 commit 79e0a06

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

README.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# semaphore-php-example
2+
3+
Simple Laravel web application with Semaphore pipeline example.
4+
5+
## Prerequisites
6+
7+
To setup the project locally, your local environment needs to be se setup. For a full list of requirements,
8+
cheeck out [Laravel Documentation](https://laravel.com/docs/5.7#server-requirements).
9+
We recommend setting up using Vagrant and Homestead, as it is a turn key solution supported on all major operating systems.
10+
A Dockerized setup is also a viable option.
11+
12+
## Project Setup
13+
14+
Once the local environemnt is setup to be able to run Laravel applications, pull in the local repository and run the following
15+
set of commands.
16+
17+
```
18+
git clone git@github.com:savamarkovic/semaphore-php-example.git
19+
cp .env.example .env // and enter your DB details in the newly created .env
20+
composer install
21+
php artisan key:generate
22+
php artisan migrate
23+
24+
```
25+
That will set up the application on your local environemnt.
26+
27+
## Semaphore Pipeline
28+
29+
Once you push your fork of the repository to Github, you can add it to Semaphore as well. Make sure you have connected Semaphore
30+
to your Github account.
31+
```
32+
curl https://storage.googleapis.com/sem-cli-releases/get.sh | bash // install Semaphore CLI to local env
33+
sem connect <semaphore-organization-link> <semaphore-id> // found in Semaphore Dashboard
34+
cd <project directory>
35+
sem init
36+
```
37+
After that, each push to the repository will trigger a pipeline to be ran on Semaphore.
38+
39+
## Example Pipeline
40+
![pipeline](https://i.imgur.com/qmqpWTO.png)
41+
The pipeline is defined inside `.semaphore/semaphore.yml` file.
42+
The example pipeline contains 6 blocks:
43+
- Install Dependencies
44+
- installs and caches all composer and npm dependencies
45+
- Build Assets
46+
- Builds and compiles JS assets by using Laravel Mix defined in package.json
47+
- Run Code Analysis
48+
- Runs PHP Mess Detector which as an example is installed as a composer dependency
49+
- Runs PHP Code Sniffer which as an example is installed as a composer dependency
50+
- Runs PHP Copy Detector which is called via cURL from the .phar package available online
51+
- Run Unit Tests
52+
- Runs PHPUnit Unit Tests
53+
- Run Browser Tests
54+
- Runs browser tests through Laravel Dusk.
55+
- Run Security Tests
56+
- Runs Sensiolabs security checker pulled in via cURL

0 commit comments

Comments
 (0)