This repository was archived by the owner on Jun 5, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (82 loc) · 2.72 KB
/
main.yml
File metadata and controls
84 lines (82 loc) · 2.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: Pipeline
on: push
jobs:
lint:
name: Lint with PHP_CodeSniffer
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Setup PHP
uses: shivammathur/setup-php@1.6.0
with:
php-version: 7.4
extensions: mbstring
coverage: none
- name: Install dependencies
run: composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader
- name: Lint with PHP_CodeSniffer
run: vendor/bin/phpcs
test:
name: Test with PHPUnit
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Setup PHP
uses: shivammathur/setup-php@1.6.0
with:
php-version: 7.4
extensions: mbstring
coverage: pcov
- name: Install dependencies
run: composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader
- name: Test with PHPUnit
run: |
mkdir -p artifacts/
vendor/bin/phpunit \
--log-junit=artifacts/phpunit-junit.xml \
--coverage-clover=artifacts/phpunit-coverage.xml \
--coverage-text
- name: Upload coverage reports
uses: actions/upload-artifact@v1.0.0
with:
name: coverage-reports
path: artifacts
analyse:
name: Analyse with Sonar Scanner
needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Extract git context
id: git
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
- name: Download coverage reports
uses: actions/download-artifact@v1.0.0
with:
name: coverage-reports
path: artifacts
- name: Setup sonar.properties
run: |
# Setup version
VERSION=$(jq -r .version composer.json)
echo "sonar.projectVersion=${VERSION}" >> sonar-project.properties
# Setup branches
echo "sonar.branch.name=${{ steps.git.outputs.branch }}" >> sonar-project.properties
if [[ "${{ steps.git.outputs.branch }}" = "dev" ]]; then
echo "sonar.branch.target=master" >> sonar-project.properties
PARENT_BRANCH="master"
elif [[ "${{ steps.git.outputs.branch }}" != "master" ]]; then
echo "sonar.branch.target=dev" >> sonar-project.properties
PARENT_BRANCH="dev"
fi
- name: Analyse with Sonar Scanner
uses: mathrix-education/sonar-scanner@master
with:
version: 4.2.0.1873 # required
typescript: false
scan: true
args: -Dsonar.login=${{ secrets.SONAR_TOKEN }}