Skip to content

Commit

Permalink
Test restructured test action
Browse files Browse the repository at this point in the history
  • Loading branch information
ajparsons committed Sep 4, 2023
1 parent 5decf69 commit 8762ded
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 33 deletions.
33 changes: 33 additions & 0 deletions .github/actions/setup-twfy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: 'Setup TWFY'
version: 1.0.0
description: |
Common actions to be shared between github Actions.
till relies on the services being defined in the original action'
inputs:
php_version:
description: "Path to action being checked."

runs:
using: "composite"
steps:

- uses: niden/actions-memcached@v7

- uses: shivammathur/setup-php@v2
with:
php-version: ${{ inputs.php_version }}
extensions: memcached

- name: Get Composer Cache Directory
id: composer-cache
run: echo "dir=$(php composer.phar config cache-files-dir)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-php-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-php-composer-

- name: Set up database and code
run: |
php composer.phar install --no-interaction
39 changes: 6 additions & 33 deletions .github/workflows/default.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,43 +50,22 @@ jobs:
--health-retries 5
steps:
# - name: Stop any running MySQL
# run: sudo systemctl stop mysql.service
# - uses: chhsiung/github-actions-mysql@0f348ad54f14038adafed5914b5ce775806768ab
# with:
# rootPassword: 'password'
# sqlMode: 'ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'

- uses: niden/actions-memcached@v7

- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php_version }}
extensions: memcached

- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: true

- name: Get Composer Cache Directory
id: composer-cache
run: echo "::set-output name=dir::$(php composer.phar config cache-files-dir)"
- uses: actions/cache@v2
- name: Setup TWFY Project
uses: ./.github/actions/setup-twfy
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-php-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-php-composer-
php_version: ${{ matrix.php_version }}

- name: Verify MariaDB connection
- name: Verify MariaDB connection and setup database
run: |
while ! mysqladmin ping -h"127.0.0.1" --silent; do
sleep 1
done
- name: Set up database and code
run: |
mysql -h 127.0.0.1 -u root -ppassword twfy_test < db/schema.sql
php composer.phar install --no-interaction
- name: Run tests
env:
Expand All @@ -102,10 +81,4 @@ jobs:
if: matrix.php_version == '7.4'
run: |
wget https://scrutinizer-ci.com/ocular.phar
php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml
- name: Documentation
if: matrix.php_version == '7.4' && github.ref_name == 'master' && github.event_name == 'push'
run: |
sudo apt-get update && sudo apt-get install -y graphviz
./build-docs.sh
php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml

0 comments on commit 8762ded

Please sign in to comment.