Skip to content

Updated workflow

Updated workflow #7

Workflow file for this run

name: on-push-to-main
on:
push:
branches: [ "main" ]
jobs:
lucy-ci:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
# --------------------------------------------------------------------
# PREPARE ENVIRONMENT
# --------------------------------------------------------------------
- name: "[ Prepare Environment ]"
run: echo "OK"
- name: Get date environment variable
run: echo "DATE=$(date)" >> $GITHUB_ENV
- name: store branch number
run: |
PREFIX="COMMIT_PREFIX="
PREFIX+=${{ github.head_ref }}
echo $PREFIX | grep -o -e "COMMIT_PREFIX=PHISH-[0-9]*" >> $GITHUB_ENV || echo $PREFIX | grep -o -e "COMMIT_PREFIX=AW-[0-9]*" >> $GITHUB_ENV || echo $PREFIX >> $GITHUB_ENV
- name: " -- apt-get update"
run: sudo apt-get update
- name: " -- Install PHP"
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
- name: " -- Install WhoIs"
run: sudo apt-get install whois
# --------------------------------------------------------------------
# Install COMPOSER
# --------------------------------------------------------------------
- name: "[ Prepare Composer ]"
run: echo "OK"
- name: "Install Composer"
run: |
EXPECTED_SIGNATURE="$(curl -s https://composer.github.io/installer.sig)"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_SIGNATURE="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]; then
>&2 echo 'ERROR: Invalid installer signature';
rm composer-setup.php
exit 1
fi
php composer-setup.php --quiet
rm composer-setup.php
mv composer.phar /usr/local/bin/composer
composer --version
# cache vendor for later use
- name: " -- Cache Composer packages"
id: composer-cache
uses: actions/cache@v3
with:
path: ./vendor
key: ${{ runner.os }}-composer-vendors-${{ hashFiles('**/composer.json') }}
restore-keys: |
${{ runner.os }}-composer-vendors-
- name: " -- Install composer dependencies"
run: COMPOSER_PROCESS_TIMEOUT=3000 composer install
- name: " -- Regenarate class mapping"
run: COMPOSER_PROCESS_TIMEOUT=3000 composer dump-autoload --optimize --classmap-authoritative
# --------------------------------------------------------------------
# PHPLINT VALIDATION
# --------------------------------------------------------------------
- name: "[ STEP 1 ] - PHPLint Validation"
run: echo "OK"
- name: " -- Cache PHPLint"
id: php-linter
uses: actions/cache@v3
with:
path: ./tmp/.phplint.result.cache
key: ${{ runner.os }}-phplint-${{ env.DATE }}
restore-keys: |
${{ runner.os }}-phplint-
- name: " -- Run PHPLint"
run: COMPOSER_PROCESS_TIMEOUT=3000 composer php-lint
# --------------------------------------------------------------------
# PHP CS FIXER
# --------------------------------------------------------------------
- name: "[ STEP 2 ] - PHP CS Fixer"
run: echo "OK"
- name: " -- Cache PHP CS Fixer"
id: php-cs-linter
uses: actions/cache@v3
with:
path: ./tmp/.php-cs-fixer.cache
key: ${{ runner.os }}-phpcslint-${{ env.DATE }}
restore-keys: |
${{ runner.os }}-phpcslint-
- name: " -- Fix PHP CS Fixer (in fix mode)"
run: COMPOSER_PROCESS_TIMEOUT=3000 composer php-cs-fix
# # --------------------------------------------------------------------
# # STATIC CODE ANALYSIS
# # --------------------------------------------------------------------
# - name: "[ STEP 3 ] - Static Code Analysis"
# run: echo "OK"
#
# - name: " -- Cache PHP STAN"
# id: php-stan
# uses: actions/cache@v3
# with:
# path: ./protected/runtime/phpstan
# key: ${{ runner.os }}-phpstan-${{ env.DATE }}
# restore-keys: |
# ${{ runner.os }}-phpstan-
#
# - name: " -- Run STAN"
# run: COMPOSER_PROCESS_TIMEOUT=3000 php composer.phar php-stan
#
# - name: " -- Cache PHP PSALM"
# id: php-psalm
# uses: actions/cache@v3
# with:
# path: ./protected/runtime/phppsalm
# key: ${{ runner.os }}-phppsalm-${{ env.DATE }}
# restore-keys: |
# ${{ runner.os }}-phppsalm-
#
# - name: " -- Run PSALM"
# run: COMPOSER_PROCESS_TIMEOUT=3000 php composer.phar php-psalm
#
#
# --------------------------------------------------------------------
# BACKEND UNIT TESTS
# --------------------------------------------------------------------
- name: "[ STEP 4 ] - Backend Unit Tests"
run: echo "OK"
#
- name: " -- Run Unit Tests"
run: IS_GIT_ACTIONS=1 COMPOSER_PROCESS_TIMEOUT=3000 composer tests
- name: " -- Git status"
run: git status
# # --------------------------------------------------------------------
# # COMMIT CHANGES
# # --------------------------------------------------------------------
#
# # - name: update .build file
# # run: |
# # echo "branch name - " $GITHUB_HEAD_REF " | " $(date) > .build
#
# - name: "[ STEP 8 ] - Commit / Push Changes"
# run: echo "OK"
#
# - name: " -- Auto commit action"
# uses: stefanzweifel/[email protected]
# with:
# commit_message: ${{ env.COMMIT_PREFIX }} Linter fixes (aimlphp-bot)
# commit_user_name: aimlphp-bot
# commit_user_email: [email protected]
# commit_author: aimlphp-bot <[email protected]>
# skip_checkout: true
# skip_fetch: true
#