Created
May 27, 2021 01:55
-
-
Save jrmadsen67/358299da838fc5f6debef74588b127b7 to your computer and use it in GitHub Desktop.
GitHub Action workflow file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: matching | |
on: | |
push: | |
paths: | |
- "backend/matching/**" | |
- ".github/workflows/matching.yaml" | |
pull_request: | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: true | |
matrix: | |
os: [ubuntu-latest] | |
php: [8.0] | |
laravel: [8.*] | |
stability: [prefer-lowest, prefer-stable] | |
include: | |
- laravel: 8.* | |
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} | |
services: | |
mysql: | |
image: mysql:5.7 | |
env: | |
MYSQL_ROOT_PASSWORD: password | |
ports: | |
- 3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
env: | |
DB_DATABASE: testing | |
DB_USER: root | |
DB_PASSWORD: password | |
MYSQL_ROOT_PASSWORD: password | |
APP_KEY: base64:gw4gyvmS+qheuNMXE1Nt2Y1/dNWRsaThYjykmjbUqwA= | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Verify MySQL connection from host | |
run: | | |
sudo apt-get install -y mysql-client | |
mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports['3306'] }} -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} -e "CREATE DATABASE ${{ env.DB_DATABASE }};" | |
# - name: Set up MySQL | |
# run: | | |
# /etc/init.d/mysql start | |
# mysql -e --host 127.0.0.1 --port ${{ job.services.mysql.ports['3306'] }} 'CREATE DATABASE ${{ env.DB_DATABASE }};' -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo, sockets | |
coverage: none | |
- name: Setup problem matchers | |
run: | | |
echo "::add-matcher::${{ runner.tool_cache }}/php.json" | |
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" | |
- name: Install dependencies | |
run: |- | |
cd backend/matching | |
composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update | |
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest | |
- name: Execute tests | |
run: |- | |
cd backend/matching | |
vendor/bin/phpunit | |
env: | |
DB_HOST: 127.0.0.1 | |
DB_PORT: ${{ job.services.mysql.ports[3306] }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment