Skip to content

Commit 8fb8c10

Browse files
committed
Adding actions
1 parent 5170fa7 commit 8fb8c10

File tree

2 files changed

+73
-0
lines changed

2 files changed

+73
-0
lines changed

.github/workflows/main.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Build, test and deploy
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v4
13+
14+
- name: Setup PHP
15+
uses: shivammathur/setup-php@v2
16+
with:
17+
php-version: 8.3
18+
19+
- name: Install app
20+
run: composer install
21+
22+
- name: Test PHPUnit
23+
run: ./vendor/bin/phpstan analyse
24+
25+
- name: Test PHPUnit
26+
run: ./vendor/bin/phpunit

docs/lessons/2_ci_cd.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,51 @@ parameters:
4949

5050
5. How to create GitHub actions
5151

52+
```bash
53+
# Create workflow file
54+
55+
touch .github/workflows/main.yml
56+
57+
```
58+
59+
6. Create pipeline for main and develop
60+
61+
```bash
62+
name: Build and Deploy
63+
64+
on:
65+
push:
66+
branches: [ main ]
67+
```
68+
69+
7. Create build job
70+
```bash
71+
jobs:
72+
build:
73+
runs-on: ubuntu-latest
74+
steps:
75+
- name: Checkout
76+
uses: actions/checkout@v4
77+
78+
- name: Setup PHP
79+
uses: shivammathur/setup-php@v2
80+
with:
81+
php-version: 8.3
82+
83+
- name: Install app
84+
run: composer install
85+
86+
- name: Test PHPUnit
87+
run: ./vendor/bin/phpstan analyse
88+
89+
- name: Test PHPUnit
90+
run: ./vendor/bin/phpunit
91+
92+
93+
94+
```
95+
96+
8. Create deploy job
97+
98+
5299
6. CI/CD to VPS

0 commit comments

Comments
 (0)