Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GitHub actions workflow to run tests #584

Merged
merged 5 commits into from
Nov 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
62 changes: 62 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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.