Skip to content

Commit

Permalink
CI/CD was moved from Travis to GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
VitalyArt committed Dec 5, 2022
1 parent c7f7844 commit 35dddb0
Show file tree
Hide file tree
Showing 10 changed files with 80 additions and 28 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: CI
on: [push]

jobs:
test-php73:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: php-actions/composer@v6
- name: PHPUnit Tests
uses: php-actions/phpunit@master
with:
configuration: test/phpunit/phpunit.xml
args: --coverage-text
version: 9
php_version: "7.3"

test-php74:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: php-actions/composer@v6
- name: PHPUnit Tests
uses: php-actions/phpunit@master
with:
configuration: test/phpunit/phpunit.xml
args: --coverage-text
version: 9
php_version: "7.4"

test-php80:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: php-actions/composer@v6
- name: PHPUnit Tests
uses: php-actions/phpunit@master
with:
configuration: test/phpunit/phpunit.xml
args: --coverage-text
version: 9
php_version: "8.0"

test-php81:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: php-actions/composer@v6
- name: PHPUnit Tests
uses: php-actions/phpunit@master
with:
configuration: test/phpunit/phpunit.xml
args: --coverage-text
version: 9
php_version: "8.1"
9 changes: 0 additions & 9 deletions .travis.yml

This file was deleted.

8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ run-all-tests:
make run-php81-tests

run-php73-tests:
docker run --rm -v `pwd`/:/app php:7.3 /app/vendor/phpunit/phpunit/phpunit --testdox --bootstrap /app/vendor/autoload.php /app/tests
docker run --rm -v `pwd`/:/app php:7.3 /app/vendor/phpunit/phpunit/phpunit --testdox --bootstrap /app/vendor/autoload.php /app/test/phpunit

run-php74-tests:
docker run --rm -v `pwd`/:/app php:7.4 /app/vendor/phpunit/phpunit/phpunit --testdox --bootstrap /app/vendor/autoload.php /app/tests
docker run --rm -v `pwd`/:/app php:7.4 /app/vendor/phpunit/phpunit/phpunit --testdox --bootstrap /app/vendor/autoload.php /app/test/phpunit

run-php80-tests:
docker run --rm -v `pwd`/:/app php:8.0 /app/vendor/phpunit/phpunit/phpunit --testdox --bootstrap /app/vendor/autoload.php /app/tests
docker run --rm -v `pwd`/:/app php:8.0 /app/vendor/phpunit/phpunit/phpunit --testdox --bootstrap /app/vendor/autoload.php /app/test/phpunit

run-php81-tests:
docker run --rm -v `pwd`/:/app php:8.1 /app/vendor/phpunit/phpunit/phpunit --testdox --bootstrap /app/vendor/autoload.php /app/tests
docker run --rm -v `pwd`/:/app php:8.1 /app/vendor/phpunit/phpunit/phpunit --testdox --bootstrap /app/vendor/autoload.php /app/test/phpunit
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
[![Build Status](https://travis-ci.org/VitalyArt/hltv-demo-parser.svg?branch=master)](https://travis-ci.org/VitalyArt/hltv-demo-parser)

### HLTV Demo Parser

This package is designed to obtain information from the demo of the servers or games on the Half-Life 1 engine.
Expand Down
8 changes: 8 additions & 0 deletions test/phpunit/phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit colors="true" bootstrap="../../vendor/autoload.php" verbose="true">
<testsuites>
<testsuite name="unit">
<file>unit/HltvDemoParserTest.php</file>
</testsuite>
</testsuites>
</phpunit>
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
<?php

namespace phpunit\unit;

use DateTime;
use PHPUnit\Framework\TestCase;
use VitalyArt\DemoParser\Demo;
use VitalyArt\DemoParser\Entry;
use VitalyArt\DemoParser\exceptions\FileNotExistsException;
use VitalyArt\DemoParser\exceptions\FileNotSpecifiedException;
use VitalyArt\DemoParser\exceptions\IsNotADemoException;
use VitalyArt\DemoParser\exceptions\WrongExtensionException;
use VitalyArt\DemoParser\Parser;

class HltvDemoParserTest extends PHPUnit\Framework\TestCase
class HltvDemoParserTest extends TestCase
{
/** @var Parser */
private $parser;
Expand All @@ -16,30 +24,30 @@ public function setUp(): void

public function testNoDemoFileSpecified(): void
{
$this->expectException(VitalyArt\DemoParser\exceptions\FileNotSpecifiedException::class);
$this->expectException(FileNotSpecifiedException::class);

$this->parser->getDemo();
}

public function testDemoFileNotExists(): void
{
$this->expectException(VitalyArt\DemoParser\exceptions\FileNotExistsException::class);
$this->expectException(FileNotExistsException::class);

$this->parser->setDemoFile('/invalid/path');
$this->parser->getDemo();
}

public function testDemoFileIsNotDemo(): void
{
$this->expectException(VitalyArt\DemoParser\exceptions\IsNotADemoException::class);
$this->expectException(IsNotADemoException::class);

$this->parser->setDemoFile(__DIR__ . '/demos/no-demo-file.dem');
$this->parser->getDemo();
}

public function testDemoFileWrongExtension(): void
{
$this->expectException(VitalyArt\DemoParser\exceptions\WrongExtensionException::class);
$this->expectException(WrongExtensionException::class);
$this->parser->setDemoFile(__DIR__ . '/demos/demo-file-with-wrong-extension.txt');
$this->parser->getDemo();
}
Expand Down
File renamed without changes.
8 changes: 0 additions & 8 deletions tests/phpunit.xml

This file was deleted.

0 comments on commit 35dddb0

Please sign in to comment.