Feature Tests #89
Workflow file for this run
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: Feature Tests | |
| on: | |
| push: | |
| branches: [master] | |
| pull_request: | |
| workflow_dispatch: | |
| jobs: | |
| php-setup: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up PHP & Composer | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: 8.3 | |
| extensions: mbstring, pdo, mysql, bcmath, tokenizer | |
| tools: composer | |
| - name: Install Composer dependencies | |
| run: composer install --no-interaction --prefer-dist | |
| - name: Cache Composer dependencies | |
| uses: actions/cache@v3 | |
| with: | |
| path: vendor | |
| key: ${{ runner.os }}-php-${{ hashFiles('composer.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-php- | |
| frontend-setup: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: 20 | |
| - name: Cache node modules | |
| uses: actions/cache@v3 | |
| with: | |
| path: node_modules | |
| key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-node- | |
| - name: Install NPM dependencies | |
| run: npm ci | |
| - name: Build assets | |
| run: npm run build | |
| - name: Cache Vite build | |
| uses: actions/cache@v3 | |
| with: | |
| path: public/build | |
| key: ${{ runner.os }}-vite-${{ hashFiles('package-lock.json', 'vite.config.js') }} | |
| restore-keys: | | |
| ${{ runner.os }}-vite- | |
| test-setup: | |
| runs-on: ubuntu-latest | |
| needs: [php-setup, frontend-setup] | |
| services: | |
| mysql: | |
| image: mysql:8.0 | |
| env: | |
| MYSQL_ROOT_PASSWORD: password | |
| MYSQL_DATABASE: testing | |
| ports: | |
| - 3306:3306 | |
| options: >- | |
| --health-cmd="mysqladmin ping -h 127.0.0.1" | |
| --health-interval=10s | |
| --health-timeout=5s | |
| --health-retries=5 | |
| env: | |
| APP_NAME: "Computer Science Resources" | |
| APP_ENV: testing | |
| APP_KEY: base64:7aYe15aBsSh6a2ScVwj1JfYjQKUmz9Z5X/GSe64joHA= | |
| APP_DEBUG: 'true' | |
| APP_TIMEZONE: UTC | |
| APP_URL: http://localhost | |
| DB_CONNECTION: mysql | |
| DB_HOST: 127.0.0.1 | |
| DB_PORT: 3306 | |
| DB_DATABASE: testing | |
| DB_USERNAME: root | |
| DB_PASSWORD: password | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: 8.3 | |
| extensions: mbstring, pdo, mysql, bcmath, tokenizer | |
| - name: Restore Composer cache | |
| uses: actions/cache@v3 | |
| with: | |
| path: vendor | |
| key: ${{ runner.os }}-php-${{ hashFiles('composer.lock') }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: 20 | |
| - name: Restore node modules cache | |
| uses: actions/cache@v3 | |
| with: | |
| path: node_modules | |
| key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }} | |
| - name: Restore Vite build cache | |
| uses: actions/cache@v3 | |
| with: | |
| path: public/build | |
| key: ${{ runner.os }}-vite-${{ hashFiles('package-lock.json', 'vite.config.js') }} | |
| - name: Wait for MySQL to be ready | |
| run: | | |
| echo "Waiting for MySQL to be ready..." | |
| until mysqladmin ping -h 127.0.0.1 -P 3306 --silent; do | |
| sleep 3 | |
| done | |
| - name: Generate app key | |
| run: php artisan key:generate --ansi | |
| - name: Run database migrations | |
| run: php artisan migrate --force | |
| run-tests: | |
| runs-on: ubuntu-latest | |
| needs: test-setup | |
| env: | |
| APP_NAME: "Computer Science Resources" | |
| APP_ENV: testing | |
| APP_KEY: base64:7aYe15aBsSh6a2ScVwj1JfYjQKUmz9Z5X/GSe64joHA= | |
| APP_DEBUG: 'true' | |
| APP_TIMEZONE: UTC | |
| APP_URL: http://localhost | |
| DB_CONNECTION: mysql | |
| DB_HOST: 127.0.0.1 | |
| DB_PORT: 3306 | |
| DB_DATABASE: testing | |
| DB_USERNAME: root | |
| DB_PASSWORD: password | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: 8.3 | |
| extensions: mbstring, pdo, mysql, bcmath, tokenizer | |
| - name: Restore Composer cache | |
| uses: actions/cache@v3 | |
| with: | |
| path: vendor | |
| key: ${{ runner.os }}-php-${{ hashFiles('composer.lock') }} | |
| - name: Restore Vite build cache | |
| uses: actions/cache@v3 | |
| with: | |
| path: public/build | |
| key: ${{ runner.os }}-vite-${{ hashFiles('package-lock.json', 'vite.config.js') }} | |
| - name: Run Laravel tests | |
| run: php artisan test |