ci: do not run tests for tags #16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: ci | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- '**' | |
tags: | |
- '**' | |
jobs: | |
tests: | |
runs-on: ubuntu-22.04 | |
if: github.event_name == 'push' && contains(github.ref, 'refs/heads/') | |
strategy: | |
matrix: | |
php_version: ['8.1', '8.2'] | |
prefer_lowest: ['yes', ''] | |
container: dannecron/php-for-dev:${{ matrix.php_version }} | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Init composer.lock | |
run: | | |
composer update --no-install $(if [[ "${{ matrix.prefer_lowest }}" == 'yes' ]]; then echo '--prefer-lowest'; fi) | |
- name: Install dependencies | |
run: composer install | |
- name: Run tests | |
run: composer run pest-coverage | |
lint: | |
runs-on: ubuntu-22.04 | |
if: github.event_name == 'push' && contains(github.ref, 'refs/heads/') | |
strategy: | |
matrix: | |
php_version: ['80100', '80200'] | |
container: dannecron/php-for-dev:8.2 | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Init composer.lock and install dependencies | |
run: composer update | |
- name: Run phpcs | |
run: vendor/bin/phpcs --standard=phpcs.xml --report=full --config-set php_version ${{ matrix.php_version }} ./src ./tests | |
analyze: | |
runs-on: ubuntu-22.04 | |
if: github.event_name == 'push' && contains(github.ref, 'refs/heads/') | |
container: dannecron/php-for-dev:8.2 | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Init composer.lock and install dependencies | |
run: composer update | |
- name: Run phpstan | |
run: vendor/bin/phpstan analyse src tests | |
build-main: | |
runs-on: ubuntu-22.04 | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
needs: | |
- tests | |
- lint | |
- analyze | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Build docker image | |
run: | | |
DOCKER_BUILDKIT=1 docker build \ | |
--build-arg BUILDKIT_INLINE_CACHE=1 \ | |
--build-arg PHP_VERSION=${{ vars.DOCKER_RUNTIME_PHP_VERSION }} \ | |
--build-arg COMPOSER_VERSION=${{ vars.DOCKER_RUNTIME_COMPOSER_VERSION }} \ | |
--target=runtime \ | |
--tag=dannecron/coverage-merger:latest \ | |
--file=./.github/Dockerfile . | |
- name: Login to docker hub | |
uses: actions-hub/docker/login@master | |
env: | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Push docker image to docker-hub | |
uses: actions-hub/docker@master | |
with: | |
args: push dannecron/coverage-merger:latest | |
build-tag: | |
runs-on: ubuntu-22.04 | |
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Build docker image | |
run: | | |
DOCKER_BUILDKIT=1 docker build \ | |
--build-arg BUILDKIT_INLINE_CACHE=1 \ | |
--build-arg PHP_VERSION=${{ vars.DOCKER_RUNTIME_PHP_VERSION }} \ | |
--build-arg COMPOSER_VERSION=${{ vars.DOCKER_RUNTIME_COMPOSER_VERSION }} \ | |
--target=runtime | |
--tag=dannecron/coverage-merger:latest \ | |
--file=./.github/Dockerfile . | |
- name: Login to docker hub | |
uses: actions-hub/docker/login@master | |
env: | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Push docker image to docker-hub | |
uses: actions-hub/docker@master | |
with: | |
args: push dannecron/coverage-merger:${{ github.ref_name }} |