Skip to content

chore: add docs build workflow #21

chore: add docs build workflow

chore: add docs build workflow #21

Workflow file for this run

name: Docs Build Workflow
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build_docs:
runs-on: ubuntu-20.04
strategy:
matrix:
php-versions: ['5.6']
composer-options: ['--ignore-platform-reqs']
name: Build Docs Test for PHP ${{ matrix.php-versions }} ${{ matrix.composer-options }}
steps:
- name: Setup PHP with Xdebug
uses: shivammathur/setup-php@v2
with:
coverage: xdebug
php-version: ${{ matrix.php-versions }}
ini-values: xdebug.overload_var_dump=0, memory_limit=4G, phar.readonly=false
- name: Checkout CodeBase
uses: actions/checkout@v4
- name: Validate composer.json and composer.lock
run: composer validate
- name: Install dependencies
run: composer update ${{ matrix.composer-options }} --no-interaction --prefer-source
- name: Prepare OS Environment
run: |
sudo sed -i s/deb.debian.org/archive.debian.org/g /etc/apt/sources.list
sudo sed -i 's|security.debian.org|archive.debian.org/|g' /etc/apt/sources.list
sudo sed -i '/stretch-updates/d' /etc/apt/sources.list
sudo apt-get -y update && \
sudo apt-get -y install git wget zip unzip libzip-dev libssl-dev libtidy-dev python3 cmake python3-distutils-extra python3-apt
curl -O https://bootstrap.pypa.io/pip/3.5/get-pip.py && \
python3 get-pip.py && \
rm get-pip.py && \
pip install awscli
# Git Secrets Install
cd /usr/local/bin && \
curl -sO https://raw.githubusercontent.com/awslabs/git-secrets/master/git-secrets && \
chmod -R +x ./git-secrets
curl -s https://raw.githubusercontent.com/mtdowling/chag/master/install.sh | sudo bash
PHP_CONF_DIR=$(php -i | grep "Scan this dir for additional .ini files" | awk '{print $9}')
sudo touch "$PHP_CONF_DIR"/memory.ini \
&& sudo chmod 666 "$PHP_CONF_DIR"/memory.ini \
&& sudo echo "memory_limit = 5048M;" >> "$PHP_CONF_DIR"/memory.ini
sudo touch "$PHP_CONF_DIR"/phar.ini \
&& sudo chmod 666 "$PHP_CONF_DIR"/phar.ini \
&& sudo echo "phar.readonly = Off;" >> "$PHP_CONF_DIR"/phar.ini
sudo touch "$PHP_CONF_DIR"/timezone.ini \
&& sudo chmod 666 "$PHP_CONF_DIR"/timezone.ini \
&& sudo echo "date.timezone ='America/New_York'" >> "$PHP_CONF_DIR"/timezone.ini
- name: Remove Function's Return Hints
run: |
cat << EOF > removal-worker.py
import os
import re
import sys
class FnReturnHints:
def walkThrough(self, path):
for root, dirs, files in os.walk(path):
for file in files:
if file[-4:] == '.php':
file_path = os.path.join(root, file)
self.onPhpFileFn(file_path)
for dir in dirs:
dir_path = os.path.join(root, dir)
self.walkThrough(dir_path)
def onPhpFileFn(self, file_path):
try:
codeContent = ''
encodings = ['utf-8', 'latin-1', 'cp1252']
for encoding in encodings:
try:
with open(file_path, 'r', encoding=encoding) as f:
code = f.read()
break
except UnicodeDecodeError:
continue
fnBlocks = re.findall(r'(function\s+[a-zA-Z_0-9]+[(][a-z0-9_$\s]*[)]\s*[:]\s*[a-zA-Z\\0-9?]*)', code)
for fnBlock in fnBlocks:
desiredBlock = re.findall(r'(function\s+[a-zA-Z_0-9]+[(][a-z0-9_$\s]*[)]|$)', fnBlock)[0]
code = code.replace(fnBlock, desiredBlock)
with open(file_path, 'w') as f:
f.write(code)
except FileNotFoundError:
print('php file not found : ', file_path)
path = sys.argv[1]
worker = FnReturnHints()
worker.walkThrough(path)
EOF
python removal-worker.py ./src \
&& python removal-worker.py ./vendor/
&& rm -f removal-worker.py
- name: Run Docs Build
run: |
make api