-
Notifications
You must be signed in to change notification settings - Fork 0
164 lines (138 loc) Β· 4.94 KB
/
code-test.yml
File metadata and controls
164 lines (138 loc) Β· 4.94 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
name: Code Testing
on:
pull_request:
branches: [ develop ]
jobs:
unit-testing:
name: Unit Testing
runs-on: ubuntu-latest
steps:
- name: Checkout ποΈ
uses: actions/checkout@v3
- name: Setup PHP with PECL extension π§
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
extensions: imagick
- name: Install π§
run: |
composer validate
composer install --prefer-dist --no-progress --no-suggest
- name: Unit Test π€
run: composer unit-test
- name: Test Report
uses: dorny/test-reporter@v2
if: ${{ !cancelled() }} # run this step even if previous step failed
with:
name: Unit Tests # Name of the check run which will be created
path: reports/ut-junit.xml # Path to test results
reporter: java-junit # Format of test results
- name: Upload HTML test report
if: always()
uses: actions/upload-artifact@v4
with:
name: ut-test-html
path: reports/ut-results.html
- name: Upload Coverage π
if: always()
uses: actions/upload-artifact@v4
with:
name: ut-coverage
path: reports
integration-testing:
name: Integration Testing
runs-on: ubuntu-latest
steps:
- name: Checkout ποΈ
uses: actions/checkout@v3
- name: Setup PHP with PECL extension π§
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
extensions: imagick
- name: Install π§
run: |
composer validate
composer install --prefer-dist --no-progress --no-suggest
sudo apt install imagemagick
sudo pear channel-update pear.php.net
sudo pear install Mail Mail_Mime pear/Net_SMTP
- name: Set up env file
run: |
echo '# tool hosting information' > .env
echo 'ADMIN_PORT=9090' >> .env
echo 'HTTP_PORT=90' >> .env
echo 'HTTPS_PORT=9443' >> .env
echo 'SERVER_NAME=victor' >> .env
echo '' >> .env
echo '# database information' >> .env
echo 'DB_ROOT=${{ secrets.DB_ROOT }}' >> .env
echo 'DB_PORT=3406' >> .env
echo 'DB_NAME=saperstone-studios' >> .env
echo 'DB_USER=${{ secrets.DB_USER }}' >> .env
echo 'DB_PASS=${{ secrets.DB_PASS }}' >> .env
echo '' >> .env
echo '# email information' >> .env
echo 'EMAIL_CONTACT=msaperst+sstest@gmail.com' >> .env
echo 'EMAIL_ACTIONS=msaperst+sstest@gmail.com' >> .env
echo 'EMAIL_SELECTS=msaperst+sstest@gmail.com' >> .env
echo 'EMAIL_CONTRACTS=msaperst+sstest@gmail.com' >> .env
echo 'EMAIL_HOST=ssl://smtp.gmail.com' >> .env
echo 'EMAIL_PORT=465' >> .env
echo 'EMAIL_USER=${{ secrets.EMAIL_USER }}' >> .env
echo 'EMAIL_PASS=${{ secrets.EMAIL_PASS }}' >> .env
echo 'EMAIL_USER_X=${{ secrets.EMAIL_USER_X }}' >> .env
echo 'EMAIL_PASS_X=${{ secrets.EMAIL_PASS_X }}' >> .env
- name: Set up Gmail Credentials
run: echo '${{ secrets.GMAIL_TEST_CREDENTIALS }}' > credentials.json
- name: Set up Gmail Token
run: echo '${{ secrets.GMAIL_TEST_TOKEN }}' > token.json
- name: Integration Test π€
run: |
sudo mkdir -p /var/www/logs
sudo chmod 777 /var/www
sudo chmod 777 /var/www/logs
composer integration-pre-test
composer integration-test
- name: Test Report
uses: dorny/test-reporter@v2
if: ${{ !cancelled() }} # run this step even if previous step failed
with:
name: Integration Tests # Name of the check run which will be created
path: reports/it-junit.xml # Path to test results
reporter: java-junit # Format of test results
- name: Upload HTML test report
if: always()
uses: actions/upload-artifact@v4
with:
name: it-test-html
path: reports/it-results.html
- name: Upload Coverage π
if: always()
uses: actions/upload-artifact@v4
with:
name: it-coverage
path: reports
sonar:
name: SonarCloud
needs: [ unit-testing, integration-testing ]
runs-on: ubuntu-latest
steps:
- name: Checkout ποΈ
uses: actions/checkout@v3
- name: Get UT Coverage
uses: actions/download-artifact@v4
with:
name: ut-coverage
path: ut
- name: Get IT Coverage
uses: actions/download-artifact@v4
with:
name: it-coverage
path: it/
- name: Combine Reports
run: mkdir reports; mv ut/* reports/; mv it/* reports/
- name: SonarCloud Scan
uses: SonarSource/sonarqube-scan-action@v6
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}