diff --git a/.github/dependabot.yml b/.github/dependabot.yml index da3442a..f0ec7ab 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,19 +1,19 @@ # To get started with Dependabot version updates, you'll need to specify which # package ecosystems to update and where the package manifests are located. # Please see the documentation for all configuration options: -# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates +# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file version: 2 updates: - # Enable version updates for npm + - package-ecosystem: "composer" + directory: "/" # Location of package manifests + schedule: + interval: "weekly" - package-ecosystem: "npm" - # Look for `package.json` and `lock` files in the `root` directory directory: "/" schedule: - interval: "daily" - - # Enable version updates for Composer - - package-ecosystem: "composer" - directory: "/" + interval: "weekly" + - package-ecosystem: "github-actions" + directory: ".github/workflows" schedule: interval: "daily" diff --git a/.github/workflows/laravel.yml b/.github/workflows/laravel.yml index 036835b..a20f534 100644 --- a/.github/workflows/laravel.yml +++ b/.github/workflows/laravel.yml @@ -2,62 +2,152 @@ name: Hypixel Signatures on: push: - branches: [ master ] + branches: [ master, main ] pull_request: - branches: [ master ] + branches: [ master, main ] jobs: - laravel-tests: + node: + name: Node + runs-on: ubuntu-latest + + steps: + - name: Checkout the project + uses: actions/checkout@v4 + + - uses: pnpm/action-setup@v4 + name: Setup pnpm + with: + run_install: false + + - name: Install Node.js + uses: actions/setup-node@v4 + with: + cache: 'pnpm' + + - name: Install dependencies + run: pnpm install + + - name: Build and compile assets + run: | + pnpm run production + + - name: Upload built assets + uses: actions/upload-artifact@v4 + with: + name: built-assets + path: public + php: + name: PHP ${{ matrix.php }} runs-on: ubuntu-latest + strategy: + matrix: + php: [ '8.2', '8.3' ] + + steps: + - name: Checkout the project + uses: actions/checkout@v4 + + - name: Setup the PHP ${{ matrix.php }} environment on ${{ runner.os }} + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + coverage: xdebug + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Copy .env + run: php -r "file_exists('.env') || copy('.env.example', '.env');" + + - name: Restore the Composer cache directory + id: composercache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - uses: actions/cache@v4 + with: + path: ${{ steps.composercache.outputs.dir }} + key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }} + + - name: Install Composer dependencies + run: composer install --no-progress --prefer-dist --optimize-autoloader + + phpunit: + name: PHPUnit + runs-on: ubuntu-latest + needs: [ php, node ] + strategy: + matrix: + php: [ '8.2', '8.3' ] env: CACHE_DRIVER: redis QUEUE_CONNECTION: redis SESSION_DRIVER: redis + DB_USERNAME: root + DB_DATABASE: hypixel_signatures + DB_HOST: 127.0.0.1 + DB_PASSWORD: password + REDIS_HOST: 127.0.0.1 services: + mysql: + image: mysql + env: + MYSQL_ALLOW_EMPTY_PASSWORD: yes + MYSQL_ROOT_PASSWORD: password + MYSQL_DATABASE: hypixel_signatures + ports: + - 3306 + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 redis: image: redis ports: - - 6379/tcp + - 6379:6379 options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3 steps: - - uses: shivammathur/setup-php@v2 + - name: Checkout the project + uses: actions/checkout@v4 + + - name: Setup the PHP ${{ matrix.php }} environment on ${{ runner.os }} + uses: shivammathur/setup-php@v2 with: - php-version: '8.3' - - uses: actions/checkout@v2 + php-version: ${{ matrix.php }} + coverage: xdebug + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Restore the Composer cache directory + id: composercache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - uses: actions/cache@v4 + with: + path: ${{ steps.composercache.outputs.dir }} + key: ${{ runner.os }}-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }} + + - name: Install Composer dependencies + run: composer install --no-progress --prefer-dist --optimize-autoloader + - name: Copy .env run: php -r "file_exists('.env') || copy('.env.example', '.env');" - - name: Get Composer Cache Directory - id: composer-cache - run: | - echo "::set-output name=dir::$(composer config cache-files-dir)" - - uses: actions/cache@v2 - with: - path: | - ${{ steps.composer-cache.outputs.dir }} - **/node_modules - key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}- - - name: Install Dependencies - run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist -o - - name: Generate key + + - name: Generate application key run: php artisan key:generate - - name: Directory Permissions - run: chmod -R 777 storage bootstrap/cache - - name: Create Database - run: | - mkdir -p database - touch database/database.sqlite - - name: Install NPM Dependencies - run: npm install --force - - name: Build Assets - run: npm run production - - name: Execute tests (Unit and Feature tests) via PHPUnit + + - name: Optimize + run: php artisan optimize env: - DB_CONNECTION: sqlite - DB_DATABASE: database/database.sqlite - REDIS_PORT: ${{ job.services.redis.ports['6379'] }} + DB_PORT: ${{ job.services.mysql.ports[3306] }} + + - name: Download built assets + uses: actions/download-artifact@v4 + with: + name: built-assets + path: public + + - name: Run migrations + run: php artisan migrate --force + + - name: Execute tests (Unit and Feature tests) via PHPUnit run: vendor/bin/phpunit diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml index abb4975..8753ceb 100644 --- a/.idea/codeStyles/Project.xml +++ b/.idea/codeStyles/Project.xml @@ -7,7 +7,7 @@