Skip to content

Commit

Permalink
Add GitHub actions workflow to run tests (#584)
Browse files Browse the repository at this point in the history
* Add GitHub actions workflow to run tests
  • Loading branch information
Mairu committed Nov 19, 2022
1 parent f9e2866 commit 400c49e
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 45 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/ci.yaml
@@ -0,0 +1,62 @@
name: CI

on:
push:
branches:
- master
pull_request:
branches:
- '**'

jobs:
run-ci:
runs-on: ubuntu-20.04

strategy:
matrix:
php-versions: ['7.4', '8.0']
mysql-versions: ['5.7']

services:
mysql:
image: mysql:${{ matrix.mysql-versions }}
env:
MYSQL_RANDOM_ROOT_PASSWORD: yes
MYSQL_DATABASE: ilch2_test
MYSQL_USER: ilch2_test_user
MYSQL_PASSWORD: ilch2_test_password
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=10s --health-retries=10
ports:
- 3306:3306

steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
coverage: xdebug
tools: composer
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-php${{ matrix.php-versions }}
- name: Install dependencies
run: composer install --prefer-dist
- name: Verify MySQL connection
env:
HOST: 127.0.0.1
PORT: ${{ job.services.mysql.ports[3306] }}
run: |
while ! mysqladmin ping -h"$HOST" -P"$PORT" --silent; do
sleep 1
done
envsubst '$HOST,$PORT' < development/ci/config.php > tests/config.php
- name: Execute tests
run: cd tests && ../vendor/bin/phpunit
33 changes: 0 additions & 33 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
@@ -1,4 +1,4 @@
### Ilch 2 [![Build Status](https://app.travis-ci.com/IlchCMS/Ilch-2.0.svg?branch=master&status=passed)](https://app.travis-ci.com/github/IlchCMS/Ilch-2.0)
### Ilch 2 [![CI](https://github.com/IlchCMS/Ilch-2.0/actions/workflows/ci.yaml/badge.svg)](https://github.com/IlchCMS/Ilch-2.0/actions/workflows/ci.yaml)
Ilch 2 ist der direkte Nachfolger der Ilch Versionen 1.1.

### Neueste Version (für Anwender)
Expand Down
11 changes: 11 additions & 0 deletions development/ci/config.php
@@ -0,0 +1,11 @@
<?php
//Config for Tests
$config = [
"dbEngine" => "Mysql",
"dbHost" => "$HOST:$PORT",
"dbUser" => "ilch2_test_user",
"dbPassword" => "ilch2_test_password",
"dbName" => "ilch2_test",
"dbPrefix" => "",
];

11 changes: 0 additions & 11 deletions development/travis/config.php

This file was deleted.

0 comments on commit 400c49e

Please sign in to comment.