Skip to content

Feature/gha

Feature/gha #5

Workflow file for this run

name: Test Scaffold Testing Package
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
extensions: dom, curl, libxml, mbstring, zip, bcmath, intl
coverage: none
- name: Create project structure
run: |
# Create directory and set permissions
sudo mkdir -p /var/www/html
sudo chown -R $USER:$USER /var/www/html
cd /var/www/html
# Copy source files directly
cp -r $GITHUB_WORKSPACE/src .
cp -r $GITHUB_WORKSPACE/tests .
cp $GITHUB_WORKSPACE/phpunit.xml .
cp $GITHUB_WORKSPACE/.github/drupal/composer.json .
# Create symlink for local development
mkdir -p vendor/salsadigitalauorg
ln -sf $GITHUB_WORKSPACE /var/www/html/vendor/salsadigitalauorg/scaffold-testing
# Debug information
echo "Project structure:"
ls -la
echo "Vendor symlink:"
ls -la vendor/salsadigitalauorg/scaffold-testing
- name: Get Composer Cache Directory
id: composer-cache
working-directory: /var/www/html
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('/var/www/html/composer.json') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Install dependencies
working-directory: /var/www/html
env:
COMPOSER_DISABLE_XDEBUG_WARN: 1
COMPOSER_PROCESS_TIMEOUT: 2000
COMPOSER_DISABLE_UNZIP: 1
run: |
composer install --prefer-dist --no-interaction --no-progress
composer dump-autoload -o
- name: Run PHPUnit tests
working-directory: /var/www/html
env:
XDEBUG_MODE: off
run: |
./vendor/bin/phpunit \
-v \
--bootstrap vendor/autoload.php \
-c phpunit.xml \
tests/Unit/