build(deps-dev): bump phpstan/phpstan from 1.10.15 to 1.10.28 #245
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
############################################################################### | |
# Sobre o GitHub Actions # | |
# https://docs.github.com/en/actions/learn-github-actions # | |
# https://www.youtube.com/watch?v=TLB5MY9BBa4 # | |
############################################################################### | |
# | |
# Testes unitários, funcionais e cobertura de código. | |
# PestPhp: https://pestphp.com/docs/installation | |
# | |
# A taxa de cobertura é gerada e enviada para o serviço de análise de código | |
# 'Code Climate' apenas quando executado no ubuntu-latest e no php version 8.1 | |
# | |
# - Sobre: https://codeclimate.com/ | |
# - Como fazer o upload: https://docs.codeclimate.com/docs/github-actions-test-coverage | |
name: Testes unitários e funcionais | |
on: ["workflow_dispatch", "push", "pull_request"] | |
concurrency: | |
group: testes-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: true | |
matrix: | |
os: [ubuntu-latest] | |
php: [8.1] | |
stability: [prefer-stable] | |
node: [18] | |
name: PHP${{ matrix.php }} - STB${{ matrix.stability }} - OS${{ matrix.os }} - NODE${{ matrix.node }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup MySql | |
run: | | |
sudo /etc/init.d/mysql start | |
mysql -e 'CREATE DATABASE site;' -uroot -proot | |
mysql -e 'SHOW DATABASES;' -uroot -proot | |
mysql -V | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.composer/cache/files | |
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }} | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node }} | |
- name: Setup PHP with coverage | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: bcmath, ctype, curl, dom, fileinfo, filter, json, libxml, mbstring, openssl, pcre, pdo, pdo_mysql, phar, tokenizer, xml, xmlreader, xmlwriter | |
tools: composer:v2 | |
coverage: xdebug | |
- name: Setup problem matchers | |
run: | | |
echo "::add-matcher::${{ runner.tool_cache }}/php.json" | |
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" | |
# Gera o arquivo .env baseado no .env.example | |
- name: Copy .env | |
run: php -r "file_exists('.env') || copy('.env.example', '.env');" | |
- name: Install composer dependencies | |
run: composer update --${{ matrix.stability }} --prefer-stable --no-interaction --no-progress | |
# Gera a chave da aplicação | |
- name: Generate key | |
run: php artisan key:generate | |
# Concede full control na pasta de cache da aplicação | |
- name: Directory Permissions | |
run: chmod -R 777 storage bootstrap/cache public | |
- name: Install npm dependencies and public assets | |
run: | | |
npm install | |
npm run build | |
- name: Execute tests with coverage | |
run: ./vendor/bin/pest -d memory_limit=2048M --coverage --colors=always --stop-on-failure | |
- name: Dump GitHub context | |
env: | |
GITHUB_CONTEXT: ${{ toJson(github.actor) }} | |
run: echo "$GITHUB_CONTEXT" | |
- name: Upload coverage to Code Climate | |
if: ${{ github.actor != 'dependabot[bot]' }} | |
uses: paambaati/codeclimate-action@v4.0.0 | |
env: | |
CC_TEST_REPORTER_ID: ${{ secrets.ARQJUD_CC_TEST_REPORTER_ID }} | |
with: | |
debug: true |