Skip to content

Commit 1348df7

Browse files
authored
Merge pull request #12 from renakdup/add-github-actions
Add GitHub actions checks of "Local Environment Deployment"
2 parents a7afa7e + 48f20f2 commit 1348df7

File tree

3 files changed

+90
-3
lines changed

3 files changed

+90
-3
lines changed

.github/workflows/CI.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Local Environment Deployment
2+
on:
3+
push:
4+
branches: [ "main", "add-github-actions" ]
5+
pull_request:
6+
types: [synchronize, opened, reopened]
7+
8+
jobs:
9+
check-local-environment-deployment:
10+
runs-on: ubuntu-latest
11+
environment: ${{ inputs.environment }}
12+
steps:
13+
- uses: actions/checkout@v3
14+
15+
- name: Install OS dependencies
16+
run: |
17+
sudo apt install -y make curl
18+
19+
- uses: KengoTODA/actions-setup-docker-compose@v1
20+
with:
21+
version: '2.18.1' # the full version of `docker-compose` command
22+
23+
- name: Check docker-composer
24+
run: |
25+
docker-compose --version
26+
27+
- name: Following instructions - "Prepare .env file"
28+
run: |
29+
cp .env.dist .env
30+
31+
- name: Following instructions - "Docker compose up"
32+
run: |
33+
make d.up
34+
35+
- name: Show docker containers
36+
run: |
37+
docker ps
38+
39+
- name: Site response is "200 OK"
40+
run: |
41+
status_code=$(curl -s -o /dev/null -w "%{http_code}" http://127.0.0.1/)
42+
echo "HTTP Status Code: $status_code"
43+
if [[ $status_code -eq 200 ]]; then
44+
echo "Status is 200!"
45+
else
46+
echo "Status is not 200!"
47+
exit 1
48+
fi
49+
50+
- name: Site response is "404 Not Found"
51+
run: |
52+
status_code=$(curl -s -o /dev/null -w "%{http_code}" http://127.0.0.1/?status=404)
53+
echo "HTTP Status Code: $status_code"
54+
if [[ $status_code -eq 404 ]]; then
55+
echo "Status is 404!"
56+
else
57+
echo "Status is not 404!"
58+
exit 1
59+
fi
60+
61+
62+
# TODO: fix GH error
63+
# [RuntimeException]
64+
# /app/vendor does not exist and could not be created.
65+
#
66+
# - name: Following instructions - "Composer install"
67+
# run: |
68+
# make composer.install
69+
70+
# TODO: fix GH error
71+
# Error: '/app/public/' is not writable by current user.
72+
# - name: Following instructions - "WordPress download"
73+
# run: |
74+
# make wp.core.download

README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
1-
# Docker Environment Boilerplate for WordPress
1+
# WordPress Docker Environment Boilerplate
2+
3+
![Local Environment Deployment](https://github.com/renakdup/wp-docker-env-boilerplate/workflows/Check%20Local%20Environment%20Deployment/badge.svg)
4+
5+
---
6+
7+
You can use this boilerplate for developing WordPress themes and plugins on your local machine by using Docker in one click.
8+
29

310
### Docker configuration:
411
- Nginx 1.20
512
- PHP 7.4
6-
- Composer > 2.1
13+
- Composer > 2.1
714
- MySQL 5.6
815
- PhpMyAdmin 5
916
- Node 16.14.2
@@ -28,7 +35,7 @@ cp .env.dist .env
2835
# run docker project
2936
make d.up
3037

31-
# install wordpress dependencies
38+
# install dependencies
3239
make composer.install
3340

3441
# download wordpress

public/index.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
<?php
22

3+
if ((int) $_GET['status'] === 404) {
4+
http_response_code(404);
5+
echo "404 Not Found";
6+
exit;
7+
}
8+
39
echo "Hello World!";

0 commit comments

Comments
 (0)