feat: add Build Workflow #21
Workflow file for this run
This file contains 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: Test Laravel Github action | |
on: | |
pull_request: | |
branches: | |
- main | |
- develop | |
env: | |
DB_CONNECTION: mysql | |
DB_HOST: 127.0.0.1 | |
# See https://github.com/cc-fiae-2024/cc-fiae-2024/settings/secrets/actions | |
DB_USER: ${{ secrets.DB_USER }} | |
DB_PASSWORD: ${{ secrets.DB_PASSWORD }} | |
DB_DATABASE: testing | |
jobs: | |
build: | |
uses: './.github/workflows/build.yaml' | |
tests: | |
needs: [build] | |
# See https://docs.github.com/en/actions/writing-workflows/choosing-where-your-workflow-runs/choosing-the-runner-for-a-job#standard-github-hosted-runners-for-public-repositories | |
runs-on: ubuntu-24.04 | |
environment: testing | |
strategy: | |
matrix: | |
operating-system: [ubuntu-24.04] | |
# Limited by https://github.com/shivammathur/setup-php#github-hosted-runners | |
php-version: [ '8.3' ] | |
dependency-stability: [ prefer-stable ] | |
name: P${{ matrix.php-version }} - ${{ matrix.dependency-stability }} - ${{ matrix.operating-system }} | |
steps: | |
- name: Download build artifact | |
uses: actions/download-artifact@v4.1.8 | |
with: | |
# Pick up the folder from build.yaml Upload (name must match) | |
path: eventguru-build-${{ github.run_id }} | |
# See https://github.com/actions/download-artifact#download-artifacts-from-other-workflow-runs-or-repositories | |
# run-id: ${{ github.event.workflow_run.id }} | |
# github-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: List artifact directories | |
run: ls -la . ${{ github.workspace }} | |
- name: Start MySQL service | |
run: sudo systemctl start mysql.service | |
- name: Prepare Laravel Application | |
run: | | |
php -r "file_exists('.env') || copy('.env.example', '.env');" | |
php artisan key:generate | |
- name: Run Migrations | |
run: php artisan migrate | |
- name: Execute tests (Unit and Feature tests) via PestPHP | |
run: php artisan test |