-
Notifications
You must be signed in to change notification settings - Fork 5
184 lines (150 loc) · 4.79 KB
/
ci.yml
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
name: CI
on:
push:
branches:
- 'master'
pull_request:
branches:
- '*'
jobs:
phpunit:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
php-version: ['7.4', '8.0']
db-type: [sqlite, mysql, pgsql]
env:
MYSQL_URL: mysql://root:root@127.0.0.1/docket
POSTGRES_URL: postgres://postgres:postgres@127.0.0.1/docket
SQLITE_URL: sqlite://./docket.db
steps:
- name: Setup MySQL
if: matrix.db-type == 'mysql'
run: docker run --rm --name=mysqld -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=docket -p 3306:3306 -d mysql:8 --default-authentication-plugin=mysql_native_password --disable-log-bin
- name: Setup PostgreSQL
if: matrix.db-type == 'pgsql'
run: docker run --rm --name=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=docket -p 5432:5432 -d postgres:14
- uses: actions/checkout@v1
with:
fetch-depth: 1
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: curl, mbstring, intl, pdo_${{ matrix.db-type }}
coverage: pcov
- name: composer install
run: |
if ${{ matrix.prefer-lowest == 'prefer-lowest' }}; then
composer update --no-progress --prefer-lowest --prefer-stable
else
composer update --no-progress
fi
cp ./tests/Fixture/google-auth.json ./config/google-auth.json
- name: yarn install & build
run: |
yarn install
yarn build
- name: Run PHPUnit
run: |
if [[ ${{ matrix.db-type }} == 'sqlite' ]]; then export DATABASE_TEST_URL=$SQLITE_URL; fi
if [[ ${{ matrix.db-type }} == 'mysql' ]]; then export DATABASE_TEST_URL=$MYSQL_URL; fi
if [[ ${{ matrix.db-type }} == 'pgsql' ]]; then export DATABASE_TEST_URL=$POSTGRES_URL; fi
if [[ ${{ matrix.php-version }} == '7.4' ]]; then
export CODECOVERAGE=1 && vendor/bin/phpunit --verbose --coverage-clover=coverage.xml
else
vendor/bin/phpunit
fi
- name: Submit code coverage
if: matrix.php-version == '7.4'
uses: codecov/codecov-action@v1
with:
flags: phpunit
jest:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 1
- name: yarn install & build
run: |
yarn install
- name: Run Jest
run:
yarn test
acceptance:
name: Browser Acceptance
runs-on: ubuntu-22.04
env:
DATABASE_TEST_URL: mysql://root:root@127.0.0.1/docket
steps:
- name: Setup MySQL latest
run: docker run --rm --name=mysqld -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=docket -p 3306:3306 -d mysql --default-authentication-plugin=mysql_native_password --disable-log-bin
- uses: actions/checkout@v1
with:
fetch-depth: 1
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
extensions: mbstring, intl, pdo_mysql
coverage: pcov
- name: Install dependencies & build javascript
run: |
composer update --no-progress
yarn install
yarn build
- name: Run PHPUnit
run: |
# Run suites individually so we abort on first failure
# a string of timeouts takes a long time to work through.
vendor/bin/phpunit tests/Acceptance/ProjectsTest.php
vendor/bin/phpunit tests/Acceptance/TasksTest.php
vendor/bin/phpunit tests/Acceptance/TodayTest.php
vendor/bin/phpunit tests/Acceptance/UpcomingTest.php
vendor/bin/phpunit tests/Acceptance/LoginTest.php
flutter-test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 1
- uses: subosito/flutter-action@v2
- name: Run pub get
run: |
cd flutterapp
flutter pub get
- name: Run flutter test
run: |
cd flutterapp
flutter test --coverage
- name: Submit code coverage
uses: codecov/codecov-action@v1
with:
flags: flutter
cs-stan:
name: Coding Standard & Static Analysis
runs-on: ubuntu-22.04
env:
DATABASE_TEST_URL: sqlite://./docket.db
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 1
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
extensions: mbstring, intl
coverage: none
tools: phive
- name: composer install
run: composer update --no-progress
- name: Install PHP tools with phive.
run: phive install --trust-gpg-keys '12CE0F1D262429A5'
- name: Run PHP CodeSniffer
run: vendor/bin/phpcs --ignore=tests/js src/ tests/
- name: Run psalm
if: success() || failure()
run: tools/psalm --output-format=github