Skip to content

Commit

Permalink
Add a test phase for the image
Browse files Browse the repository at this point in the history
  • Loading branch information
williamdes committed May 4, 2021
1 parent fa9d92a commit a791532
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
name: test build container
name: Build and test container
on: [push]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build action image
- name: Build image
run: make docker-build
- name: Test image
run: make docker-test
6 changes: 5 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@ jobs:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build action image

- name: Build image
run: IMAGE_TAG="ghcr.io/sudo-bot/gh-deployer-container/phpmyadmin" make docker-build

- name: Test image
run: IMAGE_TAG="ghcr.io/sudo-bot/gh-deployer-container/phpmyadmin" make docker-test

- name: Push to GitHub Packages
run: docker push ghcr.io/sudo-bot/gh-deployer-container/phpmyadmin:latest
16 changes: 16 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
IMAGE_TAG ?= gh-deploy-container
TEST_PORT ?= 9099

.PHONY: docker-build

Expand All @@ -7,3 +8,18 @@ docker-build:
--build-arg VCS_REF=`git rev-parse HEAD` \
--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
--tag $(IMAGE_TAG)

docker-test:
docker run --rm --name test-bench \
-d \
--user "0:$(id -g)" \
-p $(TEST_PORT):80 \
-v $(PWD):/home/www/phpMyAdmin \
-e SKIP_DEPLOY=yes \
-e MEMORY_LIMIT=254M \
$(IMAGE_TAG)
sleep 2
curl -I http://127.0.0.1:$(TEST_PORT)/
curl -I http://127.0.0.1:$(TEST_PORT)/.nginx/status
curl -I http://127.0.0.1:$(TEST_PORT)/.phpfpm/status
docker stop test-bench

0 comments on commit a791532

Please sign in to comment.