Skip to content

add event handler configuration (#20) #102

add event handler configuration (#20)

add event handler configuration (#20) #102

Workflow file for this run

on:
push:
paths-ignore:
- "**/*.md"
concurrency:
group: ${{ github.sha }}
cancel-in-progress: true
jobs:
build-caddy-image:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/develop' # Running this job only for develop branch
steps:
- name: Cancel Previous Run preventing duplicate pipelines
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout code
uses: actions/checkout@v3 # Checking out the repo
- name: Check for changes
uses: dorny/paths-filter@v2
id: changes
with:
filters: |
php:
- 'docker/caddy/**'
- name: Build and Publish head caddy image
# run only if some file in 'src' folder was changed
if: steps.changes.outputs.php == 'true'
uses: VaultVulp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }} # Provide GITHUB_TOKEN to login into the GitHub Packages
image-name: caddy # Provide Docker image name
dockerfile: ./docker/caddy/Dockerfile
build-context: ./docker/caddy/
image-tag: head # Provide Docker image tag
pull-image: true # Raise the flag to try to pull image
build-composer-image:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/develop' # Running this job only for develop branch
steps:
- name: Cancel Previous Run preventing duplicate pipelines
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout code
uses: actions/checkout@v3 # Checking out the repo
- name: Check for changes
uses: dorny/paths-filter@v2
id: changes
with:
filters: |
php:
- 'docker/composer/**'
- name: Build and Publish head composer image
# run only if some file in 'src' folder was changed
if: steps.changes.outputs.php == 'true'
uses: VaultVulp/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }} # Provide GITHUB_TOKEN to login into the GitHub Packages
image-name: composer # Provide Docker image name
dockerfile: ./docker/composer/Dockerfile
build-context: ./docker/composer/
image-tag: head # Provide Docker image tag
pull-image: true # Raise the flag to try to pull image
phpunit:
runs-on: ubuntu-22.04
needs:
- build-caddy-image
- build-composer-image
if: ${{ github.event_name == 'push' && (needs.build-composer-image.result == 'success' || needs.build-composer-image.result == 'skipped') && !cancelled() }}
steps:
- name: Cancel Previous Run preventing duplicate pipelines
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout code
uses: actions/checkout@v3 # Checking out the repo
- name: Login to github registry
uses: docker/login-action@v1
with:
registry: docker.pkg.github.com
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: PHPUnit
run: |
docker network create -d bridge caddy-network
docker run --entrypoint caddy --name caddy -d --network="caddy-network" --hostname=caddy -v "$(pwd)/docker/caddy/autosave.json:/config/caddy/autosave.json" -v "$(pwd)/docker/caddy/files:/var/files" -p 80:80 -p 2019:2019 docker.pkg.github.com/mattvb91/caddy-php/caddy:head run --resume
docker run -v $(pwd):/app docker.pkg.github.com/mattvb91/${{ env.REPO_NAME }}/composer:head composer install
docker run -v $(pwd):/app docker.pkg.github.com/mattvb91/${{ env.REPO_NAME }}/composer:head composer phpstan
docker run -v $(pwd):/app docker.pkg.github.com/mattvb91/${{ env.REPO_NAME }}/composer:head composer codesniffer
docker run -v $(pwd):/app docker.pkg.github.com/mattvb91/${{ env.REPO_NAME }}/composer:head composer rector
docker run -v $(pwd):/app docker.pkg.github.com/mattvb91/${{ env.REPO_NAME }}/composer:head composer phpmnd
docker run --network="caddy-network" -e XDEBUG_MODE=coverage -v $(pwd):/app docker.pkg.github.com/mattvb91/${{ env.REPO_NAME }}/composer:head composer phpunit
env:
REPO_NAME: ${{ github.event.repository.name }}
- uses: codecov/[email protected]
with:
fail_ci_if_error: false
directory: ./src
files: ./coverage.xml
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: "output logs if fail"
if: failure()
run: docker logs caddy