|
| 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 |
0 commit comments