|
1 | | -# https://help.github.com/en/categories/automating-your-workflow-with-github-actions |
| 1 | +name: CI |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | push: |
5 | | - branches: [ '**' ] |
6 | 5 | pull_request: |
7 | | - branches: [ '**' ] |
8 | | - |
9 | | -name: "CI" |
| 6 | + workflow_dispatch: |
10 | 7 |
|
11 | 8 | jobs: |
12 | | - tests: |
13 | | - name: "Tests" |
14 | | - |
15 | | - runs-on: "ubuntu-latest" |
16 | | - |
17 | | - env: |
18 | | - php_extensions: ctype, dom, fileinfo, hash, intl, mbstring, session, simplexml, tokenizer, xml, pdo, mysqli, gd, zip |
19 | | - |
20 | | - services: |
21 | | - mysql: |
22 | | - image: "mysql:5.7" |
23 | | - env: |
24 | | - MYSQL_ALLOW_EMPTY_PASSWORD: true |
25 | | - MYSQL_ROOT_PASSWORD: |
26 | | - MYSQL_DATABASE: test_db |
27 | | - ports: |
28 | | - - 3306/tcp |
29 | | - options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 |
30 | | - |
31 | | - strategy: |
32 | | - fail-fast: false |
33 | | - matrix: |
34 | | - php-version: |
35 | | - - "7.4" |
36 | | - - "8.0" |
37 | | - - "8.1" |
38 | | - |
39 | | - steps: |
40 | | - - name: "Checkout" |
41 | | - uses: "actions/checkout@v2" |
42 | | - |
43 | | - - name: "Install PHP with extensions" |
44 | | - uses: "shivammathur/setup-php@v2" |
45 | | - with: |
46 | | - php-version: "${{ matrix.php-version }}" |
47 | | - extensions: "${{ env.php_extensions }}" |
48 | | - coverage: "xdebug" |
49 | | - |
50 | | - - name: "Start mysql service" |
51 | | - run: "sudo /etc/init.d/mysql start" |
52 | | - |
53 | | - - name: "Cache dependencies installed with composer" |
54 | | - uses: "actions/cache@v1" |
55 | | - with: |
56 | | - path: "~/.composer/cache" |
57 | | - key: "php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.json') }}" |
58 | | - restore-keys: "php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-" |
59 | | - |
60 | | - - name: "Install dependencies with composer" |
61 | | - run: "composer install --no-ansi --no-interaction --no-progress" |
62 | | - |
63 | | - - name: "Run tests with phpunit/phpunit" |
64 | | - env: |
65 | | - SS_DATABASE_PORT: ${{ job.services.mysql.ports['3306'] }} |
66 | | - run: "vendor/bin/phpunit --coverage-clover=coverage.xml" |
67 | | - |
68 | | - - name: "Upload coverage results to CodeCov" |
69 | | - uses: codecov/codecov-action@v1 |
70 | | - with: |
71 | | - files: ./coverage.xml # optional |
72 | | - flags: unittests # optional |
73 | | - |
74 | | - - name: "Run tests with squizlabs/php_codesniffer" |
75 | | - run: "vendor/bin/phpcs -s --report=summary --standard=phpcs.xml.dist --extensions=php,inc --ignore=autoload.php --ignore=vendor/ src/ tests/" |
| 9 | + ci: |
| 10 | + name: CI |
| 11 | + uses: silverstripe/gha-ci/.github/workflows/ci.yml@v1 |
| 12 | + with: |
| 13 | + phpcoverage: true |
0 commit comments