From 8cf11c0905d1000b4498d2969b604561757fc69e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konrad=20G=C5=82owacki?= Date: Fri, 12 Aug 2022 13:43:07 +0200 Subject: [PATCH 1/7] =?UTF-8?q?ci:=20=F0=9F=8E=A1=20Update=20github=20acti?= =?UTF-8?q?on=20build=20process=20with=20test=20coverage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 38 +++++++++++++++++++++++++++++++++++++ .github/workflows/main.yml | 27 -------------------------- 2 files changed, 38 insertions(+), 27 deletions(-) create mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..1b171b1 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,38 @@ +name: build + +on: + push: + branches: + - main + pull_request: + types: [opened, synchronize, reopened] + +jobs: + sonarqube: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Setup PHP with Xdebug + uses: shivammathur/setup-php@v2 + with: + php-version: '9.1' + coverage: xdebug + - name: Install dependencies with composer + run: composer update --no-ansi --no-interaction --no-progress + - name: Run tests with phpunit/phpunit + run: vendor/bin/phpunit --coverage-clover=coverage.xml + - name: Fix code coverage paths + run: sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' coverage.xml + - name: SonarQube Scan + uses: sonarsource/sonarqube-scan-action@master + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} + - name: SonarQube Quality Gate check + uses: sonarsource/sonarqube-quality-gate-action@master + timeout-minutes: 5 + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 4d40162..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,27 +0,0 @@ -on: - push: - branches: - - main - pull_request: - types: [opened, synchronize, reopened] - -name: Main Workflow -jobs: - sonarqube: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - # Disabling shallow clone is recommended for improving relevancy of reporting - fetch-depth: 0 - - name: SonarQube Scan - uses: sonarsource/sonarqube-scan-action@master - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} - - name: SonarQube Quality Gate check - uses: sonarsource/sonarqube-quality-gate-action@master - # Force to fail step after specific time - timeout-minutes: 5 - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} \ No newline at end of file From 01ecb060f0b51afbf04273c08b2464c986fc60a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konrad=20G=C5=82owacki?= Date: Fri, 12 Aug 2022 13:45:24 +0200 Subject: [PATCH 2/7] Fix yaml error --- .github/workflows/build.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1b171b1..2b1fa3d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,12 +1,10 @@ name: build - on: push: branches: - main pull_request: types: [opened, synchronize, reopened] - jobs: sonarqube: runs-on: ubuntu-latest From 1acde507aad7f85e21a13df3fd0697ee75bb61e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konrad=20G=C5=82owacki?= Date: Fri, 12 Aug 2022 13:49:20 +0200 Subject: [PATCH 3/7] Fix github yaml file --- .github/workflows/build.yml | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2b1fa3d..ecb88eb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,7 +6,8 @@ on: pull_request: types: [opened, synchronize, reopened] jobs: - sonarqube: + tests: + name: Tests runs-on: ubuntu-latest steps: - name: Checkout @@ -24,13 +25,13 @@ jobs: run: vendor/bin/phpunit --coverage-clover=coverage.xml - name: Fix code coverage paths run: sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' coverage.xml - - name: SonarQube Scan - uses: sonarsource/sonarqube-scan-action@master - env: + - name: SonarQube Scan + uses: sonarsource/sonarqube-scan-action@master + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} + - name: SonarQube Quality Gate check + uses: sonarsource/sonarqube-quality-gate-action@master + timeout-minutes: 5 + env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} - - name: SonarQube Quality Gate check - uses: sonarsource/sonarqube-quality-gate-action@master - timeout-minutes: 5 - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} From 62bd76c714f1aed09b96159848743ea3fcd24069 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konrad=20G=C5=82owacki?= Date: Fri, 12 Aug 2022 13:50:21 +0200 Subject: [PATCH 4/7] Another fix --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ecb88eb..e365c2e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,4 +34,4 @@ jobs: uses: sonarsource/sonarqube-quality-gate-action@master timeout-minutes: 5 env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} From 674229f7ff3bf3466798e21c0703dcb780ad040f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konrad=20G=C5=82owacki?= Date: Fri, 12 Aug 2022 13:52:47 +0200 Subject: [PATCH 5/7] Change php version --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e365c2e..5aac2d6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,7 +7,7 @@ on: types: [opened, synchronize, reopened] jobs: tests: - name: Tests + name: tests & sonarqube runs-on: ubuntu-latest steps: - name: Checkout @@ -17,7 +17,7 @@ jobs: - name: Setup PHP with Xdebug uses: shivammathur/setup-php@v2 with: - php-version: '9.1' + php-version: '8.1' coverage: xdebug - name: Install dependencies with composer run: composer update --no-ansi --no-interaction --no-progress From 2f529ff50da29c3b812a93d70fba73b08e66584e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konrad=20G=C5=82owacki?= Date: Fri, 12 Aug 2022 13:59:37 +0200 Subject: [PATCH 6/7] Add tools --- .github/workflows/build.yml | 1 + sonar-project.properties | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5aac2d6..37e420f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,6 +19,7 @@ jobs: with: php-version: '8.1' coverage: xdebug + tools: phpunit - name: Install dependencies with composer run: composer update --no-ansi --no-interaction --no-progress - name: Run tests with phpunit/phpunit diff --git a/sonar-project.properties b/sonar-project.properties index e7d0fd0..05ce5f5 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,2 +1,2 @@ sonar.projectKey=wp-graphql-filter-query -sonar.sources=. \ No newline at end of file +sonar.php.coverage.reportPaths=coverage.xml From a84827f886a43d15950fc14db8ecf67b67787675 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konrad=20G=C5=82owacki?= Date: Fri, 12 Aug 2022 14:00:43 +0200 Subject: [PATCH 7/7] Change php version --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 37e420f..d48386a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,7 +17,7 @@ jobs: - name: Setup PHP with Xdebug uses: shivammathur/setup-php@v2 with: - php-version: '8.1' + php-version: '7.4' coverage: xdebug tools: phpunit - name: Install dependencies with composer