diff --git a/.github/workflows/fresh-install-test.yml b/.github/workflows/fresh-install-test.yml new file mode 100644 index 00000000..8c8985a5 --- /dev/null +++ b/.github/workflows/fresh-install-test.yml @@ -0,0 +1,53 @@ +name: Laravel Test Fresh Install + +on: workflow_dispatch + +jobs: + laravel-tests-fresh-install: + + runs-on: ubuntu-latest + services: + mysql: + image: mysql:8.0 + env: + MYSQL_DATABASE: testing_db + MYSQL_ROOT_PASSWORD: secret + ports: + - 3306:3306 + options: >- + --health-cmd="mysqladmin ping --silent" + --health-interval=10s + --health-timeout=5s + --health-retries=3 + + steps: + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.1' + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, tidy + coverage: none + + - uses: actions/checkout@v4 + - name: Copy .env + run: php -r "file_exists('.env') || copy('.env.example', '.env');" + + - name: Install Dependencies + run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist + + - name: Generate key + run: php artisan key:generate + + - name: Directory Permissions + run: chmod -R 777 storage bootstrap/cache + + - name: Wait for MySQL + run: sleep 15 + + - name: Execute tests (Unit and Feature tests) via PHPUnit/Pest + env: + DB_CONNECTION: mysql + DB_DATABASE: testing_db + DB_USERNAME: root + DB_PASSWORD: secret + run: php artisan migrate --seed && php artisan test diff --git a/.github/workflows/update-versi-test.yml b/.github/workflows/update-versi-test.yml new file mode 100644 index 00000000..4e94b170 --- /dev/null +++ b/.github/workflows/update-versi-test.yml @@ -0,0 +1,59 @@ +name: Laravel Update Versi Test + +on: workflow_dispatch + +jobs: + laravel-tests-update-versi: + runs-on: ubuntu-latest + services: + mysql: + image: mysql:8.0 + env: + MYSQL_DATABASE: testing_db + MYSQL_ROOT_PASSWORD: secret + ports: + - 3306:3306 + options: >- + --health-cmd="mysqladmin ping --silent" + --health-interval=10s + --health-timeout=5s + --health-retries=3 + + steps: + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.1' + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, tidy + coverage: none + + - uses: actions/checkout@v4 + + - name: Copy .env + run: php -r "file_exists('.env') || copy('.env.example', '.env');" + + - name: Install Dependencies + run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist + + - name: Directory Permissions + run: chmod -R 777 storage bootstrap/cache + + - name: Extract database testing + run: | + tar -xzf database/database_test.sql.tar.gz -C database + + - name: Wait for MySQL + run: sleep 15 + + - name: Import SQL file into MySQL + run: | + mysql -h 127.0.0.1 -P 3306 -u root -psecret testing_db < ./database/database_test.sql + + - name: Execute tests (Unit and Feature tests) via PHPUnit/Pest + env: + DB_CONNECTION: mysql + DB_DATABASE: testing_db + DB_USERNAME: root + DB_PASSWORD: secret + + run: php artisan migrate && php artisan test