Skip to content

Commit

Permalink
Merge pull request #12 from renakdup/add-github-actions
Browse files Browse the repository at this point in the history
Add GitHub actions checks of "Local Environment Deployment"
  • Loading branch information
renakdup authored May 21, 2023
2 parents a7afa7e + 48f20f2 commit 1348df7
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 3 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Local Environment Deployment
on:
push:
branches: [ "main", "add-github-actions" ]
pull_request:
types: [synchronize, opened, reopened]

jobs:
check-local-environment-deployment:
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
steps:
- uses: actions/checkout@v3

- name: Install OS dependencies
run: |
sudo apt install -y make curl
- uses: KengoTODA/actions-setup-docker-compose@v1
with:
version: '2.18.1' # the full version of `docker-compose` command

- name: Check docker-composer
run: |
docker-compose --version
- name: Following instructions - "Prepare .env file"
run: |
cp .env.dist .env
- name: Following instructions - "Docker compose up"
run: |
make d.up
- name: Show docker containers
run: |
docker ps
- name: Site response is "200 OK"
run: |
status_code=$(curl -s -o /dev/null -w "%{http_code}" http://127.0.0.1/)
echo "HTTP Status Code: $status_code"
if [[ $status_code -eq 200 ]]; then
echo "Status is 200!"
else
echo "Status is not 200!"
exit 1
fi
- name: Site response is "404 Not Found"
run: |
status_code=$(curl -s -o /dev/null -w "%{http_code}" http://127.0.0.1/?status=404)
echo "HTTP Status Code: $status_code"
if [[ $status_code -eq 404 ]]; then
echo "Status is 404!"
else
echo "Status is not 404!"
exit 1
fi
# TODO: fix GH error
# [RuntimeException]
# /app/vendor does not exist and could not be created.
#
# - name: Following instructions - "Composer install"
# run: |
# make composer.install

# TODO: fix GH error
# Error: '/app/public/' is not writable by current user.
# - name: Following instructions - "WordPress download"
# run: |
# make wp.core.download
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
# Docker Environment Boilerplate for WordPress
# WordPress Docker Environment Boilerplate

![Local Environment Deployment](https://github.com/renakdup/wp-docker-env-boilerplate/workflows/Check%20Local%20Environment%20Deployment/badge.svg)

---

You can use this boilerplate for developing WordPress themes and plugins on your local machine by using Docker in one click.


### Docker configuration:
- Nginx 1.20
- PHP 7.4
- Composer > 2.1
- Composer > 2.1
- MySQL 5.6
- PhpMyAdmin 5
- Node 16.14.2
Expand All @@ -28,7 +35,7 @@ cp .env.dist .env
# run docker project
make d.up

# install wordpress dependencies
# install dependencies
make composer.install

# download wordpress
Expand Down
6 changes: 6 additions & 0 deletions public/index.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<?php

if ((int) $_GET['status'] === 404) {
http_response_code(404);
echo "404 Not Found";
exit;
}

echo "Hello World!";

0 comments on commit 1348df7

Please sign in to comment.