Skip to content

Commit 6faf9ae

Browse files
committed
Run sonar after all test
1 parent b31b9bd commit 6faf9ae

File tree

3 files changed

+57
-56
lines changed

3 files changed

+57
-56
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: PHP release
1+
name: PHPDrafter release
22

33
on:
44
release:

.github/workflows/sonar.yml

Lines changed: 0 additions & 15 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 56 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: PHPDrafter test
1+
name: PHPDrafter tests
22

33
on:
44
push:
@@ -16,58 +16,74 @@ jobs:
1616
matrix:
1717
php-versions: ['7.2', '7.3', '7.4']
1818
steps:
19-
- name: Checkout
20-
uses: actions/checkout@v1
19+
- name: Checkout
20+
uses: actions/checkout@v1
2121

22-
- name: Setup PHP
23-
uses: shivammathur/setup-php@v1
24-
with:
25-
php-version: ${{ matrix.php-versions }}
26-
extensions: curl,json,mbstring,uopz
27-
coverage: pcov
28-
tools: pecl,phpstan,phpunit,cs2pr,phpcs
22+
- name: Setup PHP
23+
uses: shivammathur/setup-php@v1
24+
with:
25+
php-version: ${{ matrix.php-versions }}
26+
extensions: curl,json,mbstring,uopz
27+
coverage: pcov
28+
tools: pecl,phpstan,phpunit,cs2pr,phpcs
2929

30-
- name: Get Composer Cache Directory
31-
id: composer-cache
32-
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
30+
- name: Get Composer Cache Directory
31+
id: composer-cache
32+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
3333

34-
- name: Cache dependencies
35-
uses: actions/cache@v1
36-
with:
37-
path: ${{ steps.composer-cache.outputs.dir }}
38-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
39-
restore-keys: ${{ runner.os }}-composer-
34+
- name: Cache dependencies
35+
uses: actions/cache@v1
36+
with:
37+
path: ${{ steps.composer-cache.outputs.dir }}
38+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
39+
restore-keys: ${{ runner.os }}-composer-
4040

41-
- name: Validate composer.json and composer.lock
42-
run: composer validate
41+
- name: Validate composer.json and composer.lock
42+
run: composer validate
4343

44-
- name: Install dependencies
45-
run: composer install --prefer-dist --no-progress --no-suggest
44+
- name: Install dependencies
45+
run: composer install --prefer-dist --no-progress --no-suggest
4646

47-
- name: Run test suite
48-
run: composer run-script test
47+
- name: Run test suite
48+
run: composer run-script test
4949

50-
- name: Setup Problem Matchers for PHPUnit
51-
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
50+
- name: Setup Problem Matchers for PHPUnit
51+
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
5252

53-
- name: PHPStan
54-
run: phpstan analyse --level=3 --error-format=checkstyle src/ | cs2pr
53+
- name: PHPStan
54+
run: phpstan analyse --level=3 --error-format=checkstyle src/ | cs2pr
5555

56-
- name: PHPCS
57-
run: phpcs --standard=PSR12 --ignore=\*/Tests/\*,\*Minifier.php --exclude=PSR1.Methods.CamelCapsMethodName,Generic.Files.LineLength src/ | cs2pr
56+
- name: PHPCS
57+
run: phpcs --standard=PSR12 --ignore=\*/Tests/\*,\*Minifier.php --exclude=PSR1.Methods.CamelCapsMethodName,Generic.Files.LineLength src/ | cs2pr
5858

59-
- name: Upload coverage result
60-
uses: actions/upload-artifact@v1
61-
with:
62-
name: coverage
63-
path: coverage.xml
59+
- name: Upload coverage result
60+
uses: actions/upload-artifact@v1
61+
with:
62+
name: coverage
63+
path: coverage.xml
6464

6565
analytics:
6666
name: Analytics
6767
needs: test
68+
if: success()
6869
runs-on: ubuntu-latest
6970
steps:
70-
- name: Code coverage Scan
71-
uses: codecov/codecov-action@v1
72-
with:
73-
token: ${{ secrets.CODECOV_TOKEN }}
71+
- name: Checkout
72+
uses: actions/checkout@v1
73+
74+
- name: Download coverage
75+
uses: actions/download-artifact@v1
76+
with:
77+
name: coverage
78+
79+
- name: Code coverage Scan
80+
uses: codecov/codecov-action@v1
81+
with:
82+
token: ${{ secrets.CODECOV_TOKEN }}
83+
84+
- name: SonarCloud Scan
85+
uses: sonarsource/[email protected]
86+
continue-on-error: true
87+
env:
88+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
89+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

0 commit comments

Comments
 (0)