|
| 1 | +# GitHub Action for PHP with extensions |
| 2 | +name: macOS |
| 3 | + |
| 4 | +on: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - master |
| 8 | + pull_request: |
| 9 | + branches: |
| 10 | + - master |
| 11 | + |
| 12 | +jobs: |
| 13 | + windows: |
| 14 | + name: macOS (PHP ${{ matrix.php-versions }} CI) |
| 15 | + runs-on: macos-latest |
| 16 | + strategy: |
| 17 | + fail-fast: false |
| 18 | + matrix: |
| 19 | + operating-system: [macos-latest] |
| 20 | + php-versions: ['7.3'] |
| 21 | + |
| 22 | + steps: |
| 23 | + - name: Checkout |
| 24 | + uses: actions/checkout@v2 |
| 25 | + - name: Setup PHP, with composer and extensions |
| 26 | + uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php |
| 27 | + with: |
| 28 | + php-version: ${{ matrix.php-versions }} |
| 29 | + extensions: mbstring, fileinfo, mysqli, pdo_mysql, pgsql, pdo_pgsql, sqlite3, pdo_sqlite, xdebug |
| 30 | + coverage: xdebug |
| 31 | + - name: Brew Install MySQL |
| 32 | + run: | |
| 33 | + |
| 34 | + - name: Brew Start MySQL |
| 35 | + run: | |
| 36 | + brew services start [email protected] |
| 37 | + brew link [email protected] --force |
| 38 | + mysqld --initialize-insecure |
| 39 | + mysql.server start |
| 40 | + - name: Setup MySQL Database |
| 41 | + run: | |
| 42 | + mysql -u root -e "CREATE DATABASE IF NOT EXISTS ez_test;" |
| 43 | + mysql -u root -e "CREATE USER ez_test@localhost IDENTIFIED BY 'ezTest'; GRANT ALL ON ez_test.* TO ez_test@localhost; FLUSH PRIVILEGES;" |
| 44 | + - name: Brew Start PostgreSql |
| 45 | + run: | |
| 46 | + sudo mkdir /var/pgsql_socket/ |
| 47 | + sudo ln -s /private/tmp/.s.PGSQL.5432 /var/pgsql_socket/ |
| 48 | + pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start |
| 49 | + brew services restart postgresql |
| 50 | + - name: Setup PostgreSql Database |
| 51 | + run: | |
| 52 | + createuser -s postgres |
| 53 | + psql -U postgres --command="CREATE USER ez_test PASSWORD 'ezTest'" --command="\du" |
| 54 | + createdb --owner=ez_test ez_test |
| 55 | + - name: Install dependencies |
| 56 | + run: | |
| 57 | + composer self-update |
| 58 | + composer update |
| 59 | + - name: Test with phpunit |
| 60 | + run: ./vendor/bin/phpunit --coverage-clover=coverage.xml |
| 61 | + - name: Submit code coverage |
| 62 | + uses: codecov/codecov-action@v1 |
| 63 | + with: |
| 64 | + file: ./coverage.xml # optional |
0 commit comments