Skip to content

Update github actions #132

Update github actions

Update github actions #132

Workflow file for this run

name: Tests
on: [push]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
php: ["7.4", "8.0", "8.1", "8.2"]
stability: [--prefer-lowest, --prefer-stable]
env:
PHP_VERSION: ${{ matrix.php }}
DEPS_STRATEGY: ${{ matrix.stability }}
name: PHP${{ matrix.php }} ${{ matrix.stability }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: masesgroup/retrieve-changed-files@v3
id: files
continue-on-error: true
- name: Setup spellcheker dependencies
run: make pull
- name: Define folders which changes within requires docker build step
run: echo "FILES_REQUIRING_DOCKER_BUILD=php/Dockerfile" >> $GITHUB_ENV
- name: Build docker images
run: make build
if: contains(steps.files.outputs.all, env.FILES_REQUIRING_DOCKER_BUILD)
- name: Login to Docker Hub
uses: docker/login-action@v3
if: contains(steps.files.outputs.all, env.FILES_REQUIRING_DOCKER_BUILD)
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Push docker image
run: make push
if: contains(steps.files.outputs.all, env.FILES_REQUIRING_DOCKER_BUILD)
- name: Run tests
run: |
export WITH_COVERAGE=$(if [[ ("${{ matrix.php }}" = "8.2") && ("${{ matrix.stability }}" = "--prefer-stable") ]]; then echo "true"; else echo "false"; fi)
echo "WITH_COVERAGE=${WITH_COVERAGE}" >> $GITHUB_ENV
make vendor
make tests
- name: Run examples
run: make examples-test
- uses: codecov/codecov-action@v4
if: env.WITH_COVERAGE == 'true'
with:
fail_ci_if_error: true
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}