Skip to content

Commit

Permalink
Create a workflow to produce code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
duncan3dc committed Aug 25, 2019
1 parent d0b5183 commit 269c378
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
on: push

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1

- name: Create Docker Container
run: |
docker build . -t ci-image --build-arg PHP_VERSION=7.3 --build-arg COVERAGE=xdebug
docker run --interactive --detach \
--volume ${{ github.workspace }}:/app \
--env CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }} \
--name ci ci-image
- name: Install Dependencies
run: docker exec ci composer update --no-interaction --no-ansi --prefer-dist

- name: PHPUnit
run: docker exec ci vendor/bin/phpunit --coverage-clover=coverage.xml

- name: Code Coverage
run: docker exec ci bash -c "bash <(curl -s https://codecov.io/bash)"
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ FROM php:${PHP_VERSION}-cli
RUN apt-get update && apt-get install -y libxml2-dev && docker-php-ext-install soap
RUN docker-php-ext-install sockets

ARG COVERAGE
RUN if [ "$COVERAGE" = "xdebug" ]; then pecl install xdebug && docker-php-ext-enable xdebug; fi

# Install composer to manage PHP dependencies
RUN apt-get update && apt-get install -y git zip
RUN curl https://getcomposer.org/download/1.9.0/composer.phar -o /usr/local/sbin/composer
Expand Down

0 comments on commit 269c378

Please sign in to comment.