Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
asbiin committed Sep 29, 2023
1 parent 04ba4e5 commit 727c358
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 33 deletions.
62 changes: 38 additions & 24 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ on:
release:
types: [created]

# workflow_run:
# workflows: [Compress images]
# types: [completed]

env:
default-php-version: '8.2'
coverage-with: 'sqlite'
Expand All @@ -29,17 +25,6 @@ jobs:
runs-on: ubuntu-latest
name: Testsuite ${{ matrix.testsuite }} with PHP ${{ matrix.php-version }} + ${{ matrix.connection }}

services:
pgsql:
image: postgres:13.0
env:
POSTGRES_DB: customers
POSTGRES_USER: customers
POSTGRES_PASSWORD: secret
ports:
- 5432:5432
options: --name=postgres --health-cmd="pg_isready" --health-interval=10s --health-timeout=5s --health-retries=3

strategy:
fail-fast: false
matrix:
Expand All @@ -50,14 +35,15 @@ jobs:

steps:
- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, dom, fileinfo, ${{ matrix.connection }}
coverage: none
coverage: pcov
ini-values: pcov.directory=., pcov.exclude="~vendor~"
- name: Check PHP Version
run: php -v
- name: Check Composer Version
Expand Down Expand Up @@ -109,6 +95,13 @@ jobs:
run: |
sudo systemctl start mysql.service
mysql --protocol=tcp -u root -proot -e "CREATE DATABASE IF NOT EXISTS customers CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
- name: Create pgsql database
if: matrix.connection == 'pgsql'
run: |
sudo systemctl start postgresql.service
sudo -u postgres psql --command="CREATE USER customers PASSWORD 'secret'" --command="\du"
sudo -u postgres createdb --owner=customers customers
PGPASSWORD=secret psql --username=customers --host=localhost --list customers
- name: Generate key
run: php artisan key:generate
Expand All @@ -133,9 +126,10 @@ jobs:
- name: Fix results files
run: sed -i -e "s%$GITHUB_WORKSPACE/%%g" **/*.xml
working-directory: results/${{ matrix.connection }}
if: success() || failure()

- name: Store results
if: matrix.php-version == env.default-php-version
if: matrix.php-version == env.default-php-version && (success() || failure())
uses: actions/upload-artifact@v3
with:
name: results
Expand All @@ -145,15 +139,15 @@ jobs:
###########################
# Reporting to sonarcloud
###########################
reporting:
sonarcloud:
needs: tests
runs-on: ubuntu-latest
name: Sonarcloud
if: ${{ ! startsWith(github.ref, 'dependabot/') }}
if: ${{ ! startsWith(github.ref, 'dependabot/') && (success() || failure()) }}

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

Expand All @@ -165,8 +159,7 @@ jobs:

- name: Merge junit files
run: |
yarn global add junit-merge
$(yarn global bin)/junit-merge --recursive --dir results/${{ env.coverage-with }}/junit --out results/results.xml
yarn dlx junit-merge --recursive --dir results/${{ env.coverage-with }}/junit --out results/results.xml
- name: Set version parameter
id: version
Expand All @@ -183,7 +176,7 @@ jobs:
- name: SonarCloud Scan
if: env.SONAR_TOKEN != ''
uses: SonarSource/sonarcloud-github-action@v1.7
uses: SonarSource/sonarcloud-github-action@v2.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
Expand All @@ -192,3 +185,24 @@ jobs:
-Dsonar.projectVersion=${{ steps.version.outputs.value }}
-Dsonar.php.tests.reportPath=./results/results.xml
-Dsonar.php.coverage.reportPaths=${{ steps.coverage.outputs.list }}
###########################
# JUnit Test Report
###########################
reporting:
needs: tests
runs-on: ubuntu-latest
name: Reporting
if: success() || failure()

steps:
- name: Download results
uses: actions/download-artifact@v3
with:
name: results
path: results

- name: Publish Test Report
uses: mikepenz/action-junit-report@v4
with:
report_paths: results/${{ env.coverage-with }}/junit/*.xml
6 changes: 3 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:

steps:
- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down Expand Up @@ -150,7 +150,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down Expand Up @@ -211,7 +211,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Download assets
uses: actions/download-artifact@v3
Expand Down
8 changes: 2 additions & 6 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ on:
pull_request:
types: [opened, synchronize, reopened]

# workflow_run:
# workflows: ['Compress images']
# types: [completed]

env:
php-version: '8.2'

Expand All @@ -21,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup PHP ${{ env.php-version }}
uses: shivammathur/setup-php@v2
Expand Down Expand Up @@ -54,7 +50,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup PHP ${{ env.php-version }}
uses: shivammathur/setup-php@v2
Expand Down

0 comments on commit 727c358

Please sign in to comment.