livehelperchat-push #83
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Tests | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - '*.x' | |
| pull_request: | |
| schedule: | |
| - cron: '0 0 * * *' | |
| repository_dispatch: | |
| types: [livehelperchat-push] | |
| workflow_dispatch: | |
| inputs: | |
| sql_file_path: | |
| description: 'Path to SQL file to import' | |
| required: false | |
| default: 'database/schema.sql' | |
| type: string | |
| permissions: | |
| contents: read | |
| jobs: | |
| tests: | |
| runs-on: ubuntu-latest | |
| services: | |
| mysql: | |
| image: mysql:8.0 | |
| env: | |
| MYSQL_ROOT_PASSWORD: password | |
| MYSQL_DATABASE: testing | |
| ports: | |
| - 3306:3306 | |
| options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| php: [8.4] | |
| name: PHP ${{ matrix.php }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Clone LiveHelperChat repository | |
| run: | | |
| cd public | |
| git clone --depth 1 https://github.com/LiveHelperChat/livehelperchat.git | |
| - name: Create symlinks in public folder | |
| run: | | |
| cd public | |
| ln -s livehelperchat/lhc_web/cache cache | |
| ln -s livehelperchat/lhc_web/design design | |
| ln -s livehelperchat/lhc_web/extension extension | |
| ln -s livehelperchat/lhc_web/ezcomponents ezcomponents | |
| ln -s livehelperchat/lhc_web/lib lib | |
| ln -s livehelperchat/lhc_web/modules modules | |
| ln -s livehelperchat/lhc_web/pos pos | |
| ln -s livehelperchat/lhc_web/settings settings | |
| ln -s livehelperchat/lhc_web/translations translations | |
| ln -s livehelperchat/lhc_web/var var | |
| - name: Copy settings configuration | |
| run: | | |
| cd public/settings | |
| cp settings.ini.default.php settings.ini.php | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, pdo_mysql, mysqli | |
| coverage: none | |
| - name: Install Composer dependencies | |
| run: composer install --prefer-dist --no-interaction --no-progress | |
| - name: Copy environment file | |
| run: cp .env.example .env | |
| - name: Generate app key | |
| run: php artisan key:generate | |
| - name: Configure database connection | |
| run: | | |
| php artisan config:clear | |
| env: | |
| DB_CONNECTION: mysql | |
| DB_HOST: 127.0.0.1 | |
| DB_PORT: 3306 | |
| DB_DATABASE: testing | |
| DB_USERNAME: root | |
| DB_PASSWORD: password | |
| - name: Import SQL database | |
| run: | | |
| mysql -h 127.0.0.1 -u root -ppassword testing < ${{ github.event.inputs.sql_file_path || 'database/schema.sql' }} | |
| - name: Run migrations | |
| run: php artisan migrate --force | |
| env: | |
| LHC_DB_CONNECTION: mysql | |
| LHC_DB_HOST: 127.0.0.1 | |
| LHC_DB_PORT: 3306 | |
| LHC_DB_DATABASE: testing | |
| LHC_DB_USERNAME: root | |
| LHC_DB_PASSWORD: password | |
| DB_CONNECTION: mysql | |
| DB_HOST: 127.0.0.1 | |
| DB_PORT: 3306 | |
| DB_DATABASE: testing | |
| DB_USERNAME: root | |
| DB_PASSWORD: password | |
| - name: Execute tests | |
| run: php artisan test | |
| env: | |
| DB_CONNECTION: mysql | |
| DB_HOST: 127.0.0.1 | |
| DB_PORT: 3306 | |
| DB_DATABASE: testing | |
| DB_USERNAME: root | |
| DB_PASSWORD: password | |
| LHC_DB_CONNECTION: mysql | |
| LHC_DB_HOST: 127.0.0.1 | |
| LHC_DB_PORT: 3306 | |
| LHC_DB_DATABASE: testing | |
| LHC_DB_USERNAME: root | |
| LHC_DB_PASSWORD: password |