This repository was archived by the owner on May 5, 2025. It is now read-only.
Merge pull request #22 from Shoutzor/snyk-fix-1c1341b534e01f49ba3d733… #159
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: Test | |
on: | |
push: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
- | |
name: Copy default env file | |
run: cp .env.default .env | |
- | |
name: Set Required environment variables | |
run: | | |
echo "APP_KEY=base64:3ckQfDEp2D/Gdu8CCBv1s/VjJHZs90lZV/+oyh4xWfA=" >> $GITHUB_ENV | |
echo "DB_HOST=127.0.0.1" >> $GITHUB_ENV | |
echo "REDIS_HOST=127.0.0.1" >> $GITHUB_ENV | |
- | |
name: Start required containers for testing | |
run: docker compose -f docker-compose.yml -f docker-compose.dev.yml up --detach mysql redis | |
- | |
name: Wait for MySQL to start completely | |
run: sleep 30 | |
- | |
name: Install composer packages | |
run: composer install --prefer-dist --optimize-autoloader | |
- | |
name: Install shoutzor | |
run: composer install-shoutzor-dev | |
- | |
name: Stop the mysql and redis containers | |
run: docker compose stop mysql redis | |
- | |
name: Set Post-Install environment variables | |
run: | | |
echo "DB_HOST=mysql" >> $GITHUB_ENV | |
echo "REDIS_HOST=redis" >> $GITHUB_ENV | |
- | |
name: Run PHPUnit | |
run: docker compose -f docker-compose.yml -f docker-compose.dev.yml run api php artisan test | |
sonarcloud: | |
name: SonarCloud | |
runs-on: ubuntu-latest | |
steps: | |
- | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- | |
name: SonarCloud Scan | |
uses: SonarSource/sonarcloud-github-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |