Skip to content

Commit

Permalink
check
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexSkrypnyk committed Sep 7, 2024
1 parent 92ac4e5 commit 91be452
Showing 1 changed file with 101 additions and 98 deletions.
199 changes: 101 additions & 98 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -200,94 +200,94 @@ jobs:
include-hidden-files: true
if-no-files-found: error

- name: Validate Composer configuration
run: docker compose exec cli composer validate --strict || [ "${{ vars.VORTEX_CI_COMPOSER_VALIDATE_IGNORE_FAILURE }}" -eq 1 ]

- name: Install development dependencies
run: |
docker compose exec $(env | cut -f1 -d= | sed 's/^/-e /') -T cli bash -c " \
if [ -n \"${GITHUB_TOKEN:-}\" ]; then export COMPOSER_AUTH='{\"github-oauth\": {\"github.com\": \"${GITHUB_TOKEN-}\"}}'; fi && \
COMPOSER_MEMORY_LIMIT=-1 composer --ansi install --prefer-dist"
- name: Lint code with PHPCS
run: docker compose exec -T cli vendor/bin/phpcs || [ "${{ vars.VORTEX_CI_PHPCS_IGNORE_FAILURE }}" -eq 1 ]

- name: Lint code with PHPStan
run: docker compose exec -T cli vendor/bin/phpstan || [ "${{ vars.VORTEX_CI_PHPSTAN_IGNORE_FAILURE }}" -eq 1 ]

- name: Lint code with Rector
run: docker compose exec -T cli vendor/bin/rector --clear-cache --dry-run || [ "${{ vars.VORTEX_CI_RECTOR_IGNORE_FAILURE }}" -eq 1 ]

- name: Lint code with PHPMD
run: docker compose exec -T cli vendor/bin/phpmd . text phpmd.xml || [ "${{ vars.VORTEX_CI_PHPMD_IGNORE_FAILURE }}" -eq 1 ]

- name: Lint code with Twig CS Fixer
run: docker compose exec -T cli vendor/bin/twig-cs-fixer || [ "${{ vars.VORTEX_CI_TWIG_CS_FIXER_IGNORE_FAILURE }}" -eq 1 ]

- name: Lint code with Gherkin Lint
run: docker compose exec -T cli vendor/bin/gherkinlint lint tests/behat/features || [ "${{ vars.VORTEX_CI_GHERKIN_LINT_IGNORE_FAILURE }}" -eq 1 ]

- name: Lint code with NPM linters
run: docker compose exec -T cli bash -c "npm run --prefix \${VORTEX_WEBROOT}/themes/custom/\${DRUPAL_THEME} lint" || [ "${{ vars.VORTEX_CI_NPM_LINT_IGNORE_FAILURE }}" -eq 1 ]

- name: Provision site
run: |
if [ -f .data/db.sql ]; then
docker compose exec cli mkdir -p .data
docker compose cp -L .data/db.sql cli:/app/.data/db.sql
fi
docker compose exec $(env | cut -f1 -d= | sed 's/^/-e /') -T cli ./scripts/vortex/provision.sh
timeout-minutes: 30

- name: Test with PHPUnit
run: |
XDEBUG_ENABLE=true docker compose up -d cli php nginx # Restart stack with XDEBUG enabled for coverage.
docker compose exec -T -e XDEBUG_MODE=coverage cli vendor/bin/phpunit || [ "${{ vars.VORTEX_CI_PHPUNIT_IGNORE_FAILURE }}" -eq 1 ]
docker compose up -d cli php nginx # Restart stack without XDEBUG enabled for coverage.
- name: Test with Behat
run: |
if [ "${{ strategy.job-total }}" -gt 1 ]; then export VORTEX_CI_BEHAT_PROFILE="${VORTEX_CI_BEHAT_PROFILE:-p${{ strategy.job-index }}}"; fi
echo "Running with ${VORTEX_CI_BEHAT_PROFILE:-default} profile"
docker compose exec -T cli php -d memory_limit=-1 vendor/bin/behat --colors --strict --profile="${VORTEX_CI_BEHAT_PROFILE:-default}" || \
docker compose exec -T cli php -d memory_limit=-1 vendor/bin/behat --colors --strict --rerun --profile="${VORTEX_CI_BEHAT_PROFILE:-default}" || \
[ "${{ vars.VORTEX_CI_BEHAT_IGNORE_FAILURE }}" -eq 1 ]
env:
VORTEX_CI_BEHAT_PROFILE: ${{ vars.VORTEX_CI_BEHAT_PROFILE }}
timeout-minutes: 30

- name: Process test logs and artifacts
if: always()
run: |
mkdir -p ".logs"
if docker compose ps --services --filter "status=running" | grep -q cli && docker compose exec cli test -d /app/.logs; then
docker compose cp cli:/app/.logs/. ".logs/"
fi
- name: Upload test artifacts
uses: actions/upload-artifact@v4
with:
name: test-artifacts-${{ matrix.instance }}
path: .logs
include-hidden-files: true
if-no-files-found: error

- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v4
if: ${{ env.CODECOV_TOKEN != '' }}
with:
directory: .logs/coverage
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

- name: Setup tmate session
if: ${{ !cancelled() && github.event.inputs.enable_terminal }}
uses: mxschmitt/action-tmate@v3
timeout-minutes: 5
with:
detached: true
# - name: Validate Composer configuration
# run: docker compose exec cli composer validate --strict || [ "${{ vars.VORTEX_CI_COMPOSER_VALIDATE_IGNORE_FAILURE }}" -eq 1 ]
#
# - name: Install development dependencies
# run: |
# docker compose exec $(env | cut -f1 -d= | sed 's/^/-e /') -T cli bash -c " \
# if [ -n \"${GITHUB_TOKEN:-}\" ]; then export COMPOSER_AUTH='{\"github-oauth\": {\"github.com\": \"${GITHUB_TOKEN-}\"}}'; fi && \
# COMPOSER_MEMORY_LIMIT=-1 composer --ansi install --prefer-dist"
#
# - name: Lint code with PHPCS
# run: docker compose exec -T cli vendor/bin/phpcs || [ "${{ vars.VORTEX_CI_PHPCS_IGNORE_FAILURE }}" -eq 1 ]
#
# - name: Lint code with PHPStan
# run: docker compose exec -T cli vendor/bin/phpstan || [ "${{ vars.VORTEX_CI_PHPSTAN_IGNORE_FAILURE }}" -eq 1 ]
#
# - name: Lint code with Rector
# run: docker compose exec -T cli vendor/bin/rector --clear-cache --dry-run || [ "${{ vars.VORTEX_CI_RECTOR_IGNORE_FAILURE }}" -eq 1 ]
#
# - name: Lint code with PHPMD
# run: docker compose exec -T cli vendor/bin/phpmd . text phpmd.xml || [ "${{ vars.VORTEX_CI_PHPMD_IGNORE_FAILURE }}" -eq 1 ]
#
# - name: Lint code with Twig CS Fixer
# run: docker compose exec -T cli vendor/bin/twig-cs-fixer || [ "${{ vars.VORTEX_CI_TWIG_CS_FIXER_IGNORE_FAILURE }}" -eq 1 ]
#
# - name: Lint code with Gherkin Lint
# run: docker compose exec -T cli vendor/bin/gherkinlint lint tests/behat/features || [ "${{ vars.VORTEX_CI_GHERKIN_LINT_IGNORE_FAILURE }}" -eq 1 ]
#
# - name: Lint code with NPM linters
# run: docker compose exec -T cli bash -c "npm run --prefix \${VORTEX_WEBROOT}/themes/custom/\${DRUPAL_THEME} lint" || [ "${{ vars.VORTEX_CI_NPM_LINT_IGNORE_FAILURE }}" -eq 1 ]
#
# - name: Provision site
# run: |
# if [ -f .data/db.sql ]; then
# docker compose exec cli mkdir -p .data
# docker compose cp -L .data/db.sql cli:/app/.data/db.sql
# fi
# docker compose exec $(env | cut -f1 -d= | sed 's/^/-e /') -T cli ./scripts/vortex/provision.sh
# timeout-minutes: 30
#
# - name: Test with PHPUnit
# run: |
# XDEBUG_ENABLE=true docker compose up -d cli php nginx # Restart stack with XDEBUG enabled for coverage.
# docker compose exec -T -e XDEBUG_MODE=coverage cli vendor/bin/phpunit || [ "${{ vars.VORTEX_CI_PHPUNIT_IGNORE_FAILURE }}" -eq 1 ]
# docker compose up -d cli php nginx # Restart stack without XDEBUG enabled for coverage.
#
# - name: Test with Behat
# run: |
# if [ "${{ strategy.job-total }}" -gt 1 ]; then export VORTEX_CI_BEHAT_PROFILE="${VORTEX_CI_BEHAT_PROFILE:-p${{ strategy.job-index }}}"; fi
# echo "Running with ${VORTEX_CI_BEHAT_PROFILE:-default} profile"
# docker compose exec -T cli php -d memory_limit=-1 vendor/bin/behat --colors --strict --profile="${VORTEX_CI_BEHAT_PROFILE:-default}" || \
# docker compose exec -T cli php -d memory_limit=-1 vendor/bin/behat --colors --strict --rerun --profile="${VORTEX_CI_BEHAT_PROFILE:-default}" || \
# [ "${{ vars.VORTEX_CI_BEHAT_IGNORE_FAILURE }}" -eq 1 ]
# env:
# VORTEX_CI_BEHAT_PROFILE: ${{ vars.VORTEX_CI_BEHAT_PROFILE }}
# timeout-minutes: 30
#
# - name: Process test logs and artifacts
# if: always()
# run: |
# mkdir -p ".logs"
# if docker compose ps --services --filter "status=running" | grep -q cli && docker compose exec cli test -d /app/.logs; then
# docker compose cp cli:/app/.logs/. ".logs/"
# fi
#
# - name: Upload test artifacts
# uses: actions/upload-artifact@v4
# with:
# name: test-artifacts-${{ matrix.instance }}
# path: .logs
# include-hidden-files: true
# if-no-files-found: error
#
# - name: Upload coverage report to Codecov
# uses: codecov/codecov-action@v4
# if: ${{ env.CODECOV_TOKEN != '' }}
# with:
# directory: .logs/coverage
# fail_ci_if_error: true
# token: ${{ secrets.CODECOV_TOKEN }}
# env:
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
#
# - name: Setup tmate session
# if: ${{ !cancelled() && github.event.inputs.enable_terminal }}
# uses: mxschmitt/action-tmate@v3
# timeout-minutes: 5
# with:
# detached: true

deploy:

Expand All @@ -301,15 +301,15 @@ jobs:
TERM: xterm-256color

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# Fetch all history for git repository.
fetch-depth: 0
# Do not persist credentials after checkout
# to allow using the custom credentials to push to a remote repo.
persist-credentials: false
ref: ${{ github.head_ref || github.ref_name }}
# - name: Checkout code
# uses: actions/checkout@v4
# with:
# # Fetch all history for git repository.
# fetch-depth: 0
# # Do not persist credentials after checkout
# # to allow using the custom credentials to push to a remote repo.
# persist-credentials: false
# ref: ${{ github.head_ref || github.ref_name }}

# - name: Setup SSH private key
# uses: shimataro/ssh-key-action@v2
Expand All @@ -323,7 +323,10 @@ jobs:
name: code-artifact
# path: "/tmp/workspace/code"

- run: ls -la
- run: |
pwd
ls -la || true
ls -la vendor || true
# - name: Deploy
# run: |
Expand Down

0 comments on commit 91be452

Please sign in to comment.