Skip to content

feat(#1247880): configure attributes analyzer #724

feat(#1247880): configure attributes analyzer

feat(#1247880): configure attributes analyzer #724

Workflow file for this run

name: CI
on:
push:
branches:
- master
- '[1-9].[0-9]+.x'
- 'feature-[a-z]+'
pull_request_target:
branches:
- master
- '[1-9].[0-9]+.x'
- 'feature-[a-z]+'
types: [review_requested, ready_for_review, synchronize]
workflow_dispatch: ~
jobs:
tests:
# Protect public workflows. To be removed when switching from pull_request_target to pull_request.
if: (github.event.pull_request.draft == false && (github.event_name != 'pull_request') || contains(github.event.pull_request.labels.*.name, 'safe to test'))
name: Tests
runs-on: ubuntu-latest
env:
ref: "2.0.x" # ${{ github.base_ref }} cannot work on pushes.
gally-directory: ${{ github.workspace }}/gally
package-name: ${{ github.event.repository.name }} # PHP package name is equal to the repository name.
steps:
- name: Get event
run: echo "event name is:" ${{ github.event_name }}
- name: Checkout PHP package (The branch to merge)
uses: actions/checkout@v3
with:
path: actions
- name: Init env
uses: ./actions/.github/actions/init-env
with:
ref: ${{ env.ref }}
version: ${{ env.ref == 'master' && 'dev-master' || format('{0}-dev', env.ref) }}
front-version: ${{ env.ref == 'master' && 'main' || env.ref }}
gally-directory: ${{ env.gally-directory }}
package-name: ${{ env.package-name }}
- name: Make .env
working-directory: ${{ env.gally-directory }}
run: |
make .env
cat .env
- name: Pull images
working-directory: ${{ env.gally-directory }}
run: docker compose -f compose.yml -f compose.ci.yml pull --ignore-pull-failures || true
- name: Start services
working-directory: ${{ env.gally-directory }}
run: docker compose -f compose.yml -f compose.ci.yml up --build -d --wait
- name: Check container status
working-directory: ${{ env.gally-directory }}
run: docker ps --format "table {{.Image}}\t{{.Status}}"
- name: Check HTTPS reachability
id: https_reachability
run: curl -vk -o /dev/null https://localhost
- name: HTTPS Failure
if: ${{ failure() && steps.tests.https_reachability == 'failure' }}
run: docker compose -f compose.yml -f compose.ci.yml logs
- name: Create test database
working-directory: ${{ env.gally-directory }}
run: |
docker compose -f compose.yml -f compose.ci.yml exec -T php bin/console -e test doctrine:database:create
docker compose -f compose.yml -f compose.ci.yml exec -T php bin/console -e test doctrine:migrations:migrate --no-interaction
- name: Doctrine Schema Validator
working-directory: ${{ env.gally-directory }}
run: docker compose -f compose.yml -f compose.ci.yml exec -T php bin/console doctrine:schema:validate --skip-sync
- name: Fixtures load
working-directory: ${{ env.gally-directory }}
run: |
docker compose -f compose.yml -f compose.ci.yml exec -T php bin/console gally:index:clear --no-interaction
docker compose -f compose.yml -f compose.ci.yml exec -T php bin/console hautelook:fixtures:load --no-interaction -vv
- name: Coverage
working-directory: ${{ env.gally-directory }}
run: docker compose -f compose.yml -f compose.ci.yml exec -e XDEBUG_MODE=coverage -T php bin/phpunit --coverage-clover=coverage/coverage.xml vendor/gally/${{ env.package-name }}
- name: Cleanup coverage file
working-directory: ${{ env.gally-directory }}
run: docker compose -f compose.yml -f compose.ci.yml exec -T php sed -i 's:<file name="/srv/:<file name="/:' coverage/coverage.xml
- if: ${{ github.event_name == 'pull_request' }}
name: Download artifact
uses: dawidd6/[email protected]
continue-on-error: true
id: base_coverage_report
with:
workflow: .github/workflows/ci.yml
branch: ${{ github.base_ref }}
name: coverage-report
path: coverage/base # Retrieve previous coverage file at the root directory, not inside api/coverage
- name: Backend Coverage Report as Comment (Compared to a base)
if: ${{ github.event_name == 'pull_request' && steps.base_coverage_report.outcome == 'success' }}
uses: lucassabreu/comment-coverage-clover@main
continue-on-error: true
with:
with-chart: false
file: api/coverage/coverage.xml
base-file: coverage/base/coverage.xml
max-line-coverage-decrease: 10.0
max-method-coverage-decrease: 10.0
min-line-coverage: 75
min-method-coverage: 75
signature: "Backend Coverage compared to target branch"
- name: Backend Coverage Report as Comment (Clean)
uses: lucassabreu/[email protected]
if: ${{ (github.event_name == 'pull_request' && steps.base_coverage_report.outcome != 'success') || github.event_name == 'push'}}
with:
with-chart: false
file: api/coverage/coverage.xml
signature: "Backend Coverage of this branch"
- uses: actions/upload-artifact@v4
with:
name: coverage-report
path: api/coverage/coverage.xml
- name: "[End] Job failed, gathering logs"
working-directory: ${{ env.gally-directory }}
if: ${{ failure() }}
run: docker compose -f compose.yml -f compose.ci.yml logs