Skip to content

Add button to process incoming message (in inbox) #840

Add button to process incoming message (in inbox)

Add button to process incoming message (in inbox) #840

Workflow file for this run

# GitHub Action for CodeIgniter
name: Testing Kalkun
on:
push:
branches:
- master
- devel
- 'release-**'
- 'feature-**'
pull_request:
branches: [ master, devel ]
jobs:
required_php_versions:
name: Get PHP versions to test
runs-on: ubuntu-latest
outputs:
php_versions: ${{ steps.php_ver_step.outputs.PHP_VERSIONS }}
php_versions_matrix: ${{ steps.php_ver_step.outputs.PHP_VERSIONS_matrix }}
steps:
- name: Install required packages
run: |
if ! command -v jq; then sudo apt-get update && sudo apt-get install -y jq; fi
- name: Build PHP_VERSIONS array & PHP_VERSIONS_matrix
id: php_ver_step
run: |
set -x
# Set array that will store the PHP versions for which we create a package.
PHP_VERSIONS=()
# Get all released php versions above 5.6 (in the format X.Y)
for upstream_ver in $(curl https://www.php.net/releases/?json | jq -r '.[].version' | cut -f -2 -d .); do
major=$(cut -f 1 -d . <<< "$upstream_ver")
for minor in {0..20}; do
if dpkg --compare-versions ${major}.$minor le $upstream_ver && dpkg --compare-versions ${major}.$minor ge 5.6; then
PHP_VERSIONS+=("${major}.$minor")
fi
done
done
PHP_VERSIONS_matrix=$(sed 's/\ /", "/g' <<< [\"${PHP_VERSIONS[*]}\"])
echo "PHP_VERSIONS=${PHP_VERSIONS[*]}" >> "$GITHUB_OUTPUT"
echo "PHP_VERSIONS_matrix=$PHP_VERSIONS_matrix" >> "$GITHUB_OUTPUT"
echo "PHP_VERSIONS=${PHP_VERSIONS[*]}"
echo "PHP_VERSIONS_matrix=$PHP_VERSIONS_matrix"
test:
continue-on-error: false
needs: [ required_php_versions ]
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest]
#php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
php-versions: ${{fromJson(needs.required_php_versions.outputs.php_versions_matrix)}}
runs-on: ${{ matrix.operating-system }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, intl, curl, dom
coverage: xdebug #optional
- name: Setup MySQL
uses: mirromutth/[email protected]
with:
character set server: 'utf8' # Optional, default value is 'utf8mb4'. The '--character-set-server' option for mysqld
collation server: 'utf8_general_ci' # Optional, default value is 'utf8mb4_general_ci'. The '--collation-server' option for mysqld
mysql version: '5.7' # Optional, default value is "latest". The version of the MySQL
mysql database: 'kalkun' # Optional, default value is "test". The specified database which will be create
mysql root password: password # Required if "mysql user" is empty, default is empty. The root superuser password
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
# Use composer.json for key, if composer.lock is not committed.
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: |
composer update
composer install --no-progress --prefer-dist --optimize-autoloader
- name: Verify mysql connection
run: |
while ! mysqladmin ping -h"127.0.0.1" -P"3306" --silent; do
sleep 1
done
- name: Download Gammu DB Schema
uses: wei/wget@v1
with:
args: -O gammu.sql https://raw.githubusercontent.com/gammu/gammu/master/docs/sql/mysql.sql
- name: Import Gammu DB Schema
run: mysql -h"127.0.0.1" -P"3306" -uroot -ppassword kalkun < gammu.sql
- name: Install/Update ci-phpunit-test
run: |
php vendor/kenjis/ci-phpunit-test/install.php --from-composer
# Workaround a bug in phpunit < 7 where the absence of application/tests/_ci_phpunit_test/ makes it fail
# with strpos(): Empty needle in vendor/phpunit/php-file-iterator/src/Iterator.php
if ! vendor/bin/phpunit --atleast-version 7; then
mkdir -vp application/tests/_ci_phpunit_test
# Below the alternative is to remove the culprit line from phpunit.xml
#sed -i -e "/<exclude>.\/_ci_phpunit_test\/<\/exclude>/ d" application/tests/phpunit.xml
fi
# Uncomment the monkey patcher function. This will search the line matching "Enabling Monkey Patching"
# then search the next "/*", delete that line, search the next "*/" and delete the line, write, and quit.
ed -s application/tests/Bootstrap.php <<EOF
/Enabling Monkey Patching/
/^\/\*$/
n
d
/^\*\/$/
n
d
w
q
EOF
rm application/tests/controllers/Welcome_test.php
# exlude the full application/view dir from coverage, otherwise coverage would fail.
# See: https://github.com/kenjis/ci-phpunit-test/issues/412
sed -i -e 's|<directory suffix=".php">../views/errors</directory>|<directory suffix=".php">../views</directory>|' application/tests/phpunit.xml
# the void return type of setUp() methods in phpunit (required since phpunit8) isn't supported
# with phpunit <= 6. For these, we remove the ": void" part of the tests
if [ $(composer show phpunit/phpunit | grep "^versions : " | rev | cut -d " " -f 1 | rev | cut -d . -f 1) -le 6 ]; then
sed -i "/public function setUp()/ s/ : void$//" application/tests/controllers/Install_test.php
fi
- name: Test with phpunit
run: vendor/bin/phpunit --coverage-text -c application/tests
check-code:
strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: ['7.2']
runs-on: ${{ matrix.operating-system }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, intl, curl, dom
coverage: xdebug #optional
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
# Use composer.json for key, if composer.lock is not committed.
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: |
composer update --working-dir=utils
composer install --working-dir=utils --no-progress --prefer-dist --optimize-autoloader
sudo apt-get update
# html-beautify from the debian package doesn't work for some reason
# sudo apt-get install -y node-js-beautify
# Install npm and install js-beautify from there
sudo apt-get install -y npm
sudo npm update --verbose -g npm
sudo npm install --verbose -g js-beautify
- id: check_strict_comparison
name: Check that strict comparison operators are used everywhere
run: |
#git checkout utils/composer.lock
git status
utils/fix_code_style.sh strict
- id: check_style
name: Check that code follows Guidelines
if: always()
run: |
#git checkout utils/composer.lock
git status
utils/fix_code_style.sh git-diff
- name: Archive artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: Code style issues to fix
path: 'code_style_check*'
if-no-files-found: ignore
check-translation:
strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: ['7.2']
runs-on: ${{ matrix.operating-system }}
continue-on-error: true
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, intl, curl, dom
coverage: xdebug #optional
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
# Use composer.json for key, if composer.lock is not committed.
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: |
composer update --working-dir=utils
composer install --working-dir=utils --no-progress --prefer-dist --optimize-autoloader
- id: translation
name: Check translations
run: |
mkfifo pipe
tee translation_check_output.txt < pipe &
./utils/check_translation.php all > pipe
- name: Archive artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: Translation check output
path: 'translation_check_output.*'
if-no-files-found: ignore