diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index b842f2d..b215261 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -13,14 +13,55 @@ permissions: contents: read jobs: + test: + name: "Test" + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v6 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v4 + + - name: Build image for testing + uses: docker/build-push-action@v7 + with: + context: "${{ matrix.context }}" + push: false + tags: "dockette/web:${{ matrix.tag }}" + platforms: linux/amd64 + cache-from: type=gha + cache-to: type=gha,mode=max + load: true + + - name: Test image + run: make _docker-test-${{ matrix.tag }} + + strategy: + matrix: + include: + - { context: debian-php-70, tag: php-70 } + - { context: debian-php-71, tag: php-71 } + - { context: debian-php-72, tag: php-72 } + - { context: debian-php-73, tag: php-73 } + - { context: debian-php-74, tag: php-74 } + - { context: debian-php-80, tag: php-80 } + - { context: debian-php-81, tag: php-81 } + - { context: debian-php-82, tag: php-82 } + - { context: debian-php-83, tag: php-83 } + - { context: debian-php-84, tag: php-84 } + - { context: debian-php-85, tag: php-85 } + build: name: "Build" + needs: test uses: dockette/.github/.github/workflows/docker.yml@master secrets: inherit with: - image: "dockette/web" - tag: "${{ matrix.tag }}" - context: "${{ matrix.context }}" + image: "dockette/web" + tag: "${{ matrix.tag }}" + context: "${{ matrix.context }}" + push: ${{ github.ref == 'refs/heads/master' }} strategy: matrix: include: @@ -35,3 +76,19 @@ jobs: - { context: debian-php-83, tag: php-83 } - { context: debian-php-84, tag: php-84 } - { context: debian-php-85, tag: php-85 } + + docs: + name: "Docs" + needs: build + runs-on: ubuntu-latest + if: ${{ github.ref == 'refs/heads/master' }} + steps: + - name: Checkout + uses: actions/checkout@v6 + + - name: Update Docker Hub description + uses: peter-evans/dockerhub-description@v5 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + repository: dockette/web diff --git a/Makefile b/Makefile index abb40ae..8d066b6 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,7 @@ DOCKER_IMAGE=dockette/web +.PHONY: templates build test run docker-build-all docker-test-all + templates: cp -R .templates/ debian-php-70 cp -R .templates/ debian-php-71 @@ -32,6 +34,13 @@ docker-build-php-83: _docker-build-php-83 docker-build-php-84: _docker-build-php-84 docker-build-php-85: _docker-build-php-85 +build: docker-build-all + +test: docker-test-all + +run: + docker run --rm -it --name dockette-web -p 8000:80 ${DOCKER_IMAGE}:php-85 + docker-build-all: $(MAKE) docker-build-php-70 $(MAKE) docker-build-php-71 @@ -61,7 +70,10 @@ docker-test-all: _docker-test-%: VERSION=$* _docker-test-%: - docker run --rm -d --name dockette-web-${VERSION} -p 8000:80 ${DOCKER_IMAGE}:${VERSION} - sleep 5 + set -e; \ + container="dockette-web-${VERSION}"; \ + docker rm -f "$${container}" >/dev/null 2>&1 || true; \ + trap 'docker rm -f "$${container}" >/dev/null 2>&1 || true' EXIT; \ + docker run --rm -d --name "$${container}" -p 8000:80 ${DOCKER_IMAGE}:${VERSION}; \ + sleep 5; \ curl -f -Li localhost:8000 - docker stop dockette-web-${VERSION} diff --git a/README.md b/README.md index 43d470b..a699848 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,10 @@

- - - + GitHub Actions + Docker Hub pulls + GitHub Sponsors + Support/Discussions

![](https://github.com/dockette/web/blob/master/screenshot.png "It works") @@ -96,4 +97,5 @@ There is also username, for example: ``` ## Maintenance + See [how to contribute](https://github.com/dockette/.github/blob/master/CONTRIBUTING.md) to this package. Consider to [support](https://github.com/sponsors/f3l1x) **f3l1x**. Thank you for using this package.