Skip to content

Commit b102f81

Browse files
committed
chore: replace travis-ci with gh-actions
1 parent ed1468d commit b102f81

File tree

8 files changed

+80
-51
lines changed

8 files changed

+80
-51
lines changed

.gitattributes

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
/.github export-ignore
12
/tests export-ignore
23
/.gitattributes export-ignore
34
/.gitignore export-ignore
4-
/.travis.yml export-ignore
55
/phpunit.xml export-ignore

.github/workflows/tests.yml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: tests
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
test:
9+
10+
runs-on: ubuntu-latest
11+
timeout-minutes: 15
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
php: [7.4, 8.0]
16+
composer-flag: [prefer-lowest, prefer-stable]
17+
18+
name: php v${{ matrix.php }} - ${{ matrix.composer-flag }}
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v2
23+
24+
- name: Setup PHP
25+
uses: shivammathur/setup-php@v2
26+
with:
27+
php-version: ${{ matrix.php }}
28+
extensions: dom, curl, libxml, mbstring, zip, pdo, bcmath, gmp
29+
tools: composer:v2
30+
31+
- name: Install dependencies
32+
run: composer update --${{ matrix.composer-flag }} --no-interaction --no-progress
33+
34+
- name: Execute tests
35+
run: |
36+
mkdir -p build/logs
37+
composer test -- --coverage-clover build/logs/clover.xml
38+
[ -f build/logs/clover.xml ] && ./vendor/bin/php-coveralls -v || echo 'clover.xml not found.'

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
/vendor
2+
/build/
23
composer.lock
4+
/.phpunit.result.cache

.travis.yml

-20
This file was deleted.

LICENSE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2020 Jens Segers
3+
Copyright (c) 2021 Jens Segers
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

+24-22
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,36 @@
1-
Optimus id transformation
2-
=========================
3-
4-
[![Latest Stable Version](http://img.shields.io/github/release/jenssegers/optimus.svg)](https://packagist.org/packages/jenssegers/optimus) [![Build Status](http://img.shields.io/travis/jenssegers/optimus.svg)](https://travis-ci.org/jenssegers/optimus) [![Coverage Status](http://img.shields.io/coveralls/jenssegers/optimus.svg)](https://coveralls.io/r/jenssegers/optimus?branch=master)
1+
# Optimus id transformation
52

3+
[![Packagist](https://badgen.net/packagist/v/jenssegers/optimus)](https://packagist.org/packages/jenssegers/optimus)
4+
[![Downloads](https://badgen.net/packagist/dt/jenssegers/optimus)](https://packagist.org/packages/jenssegers/optimus/stats)
5+
[![Build](https://github.com/jenssegers/optimus/workflows/tests/badge.svg)](https://github.com/jenssegers/optimus/actions)
6+
[![Coverage](http://img.shields.io/coveralls/jenssegers/optimus.svg)](https://coveralls.io/r/jenssegers/optimus?branch=master)
67

78
With this library, you can transform your internal id's to obfuscated integers based on Knuth's integer hash. It is similar to Hashids, but will generate integers instead of random strings. It is also super fast.
89

910
<p align="center">
1011
<img src="https://jenssegers.com/static/media/optimus.png">
1112
</p>
1213

13-
Installation
14-
------------
14+
## Installation
1515

1616
Install using composer:
1717

18-
```
18+
```bash
1919
composer require jenssegers/optimus
2020
```
2121

22-
If you will be running your code on a 32 bit system or will be working with large prime numbers it is suggested that you install the [GMP extension](http://php.net/manual/en/book.gmp.php). For debian/ubuntu you can install the extension with one of these commands:
22+
If you will be running your code on a 32 bit system or will be working with large prime numbers it is suggested that you install the [GMP extension](http://php.net/manual/en/book.gmp.php).
23+
For debian/ubuntu you can install the extension with one of these commands:
2324

24-
```
25+
```bash
2526
apt-get install php7.0-gmp
2627
apt-get install php7.1-gmp
2728
apt-get install php7.2-gmp
29+
apt-get install php7.3-gmp
30+
apt-get install php7.4-gmp
2831
```
2932

30-
Usage
31-
-----
33+
## Usage
3234

3335
To get started you will need 3 things;
3436

@@ -38,7 +40,7 @@ To get started you will need 3 things;
3840

3941
Luckily for you, I have included a console command that can do all of this for you. To get started, just run the following command:
4042

41-
```
43+
```bash
4244
> php vendor/bin/optimus spark
4345

4446
Prime: 2123809381
@@ -48,7 +50,7 @@ Random: 146808189
4850

4951
If you prefer to choose your own prime number (from [this list](http://primes.utm.edu/lists/small/millions/) for example), you can pass it to the command to calculate the remaining numbers:
5052

51-
```
53+
```bash
5254
> php vendor/bin/optimus spark 1580030173
5355

5456
Prime: 1580030173
@@ -135,16 +137,16 @@ More information: https://laravel.com/docs/5.3/container#resolving
135137

136138
**Third-party integrations**
137139

138-
An integration with Laravel is provided by the [propaganistas/laravel-fakeid](https://packagist.org/packages/propaganistas/laravel-fakeid) package.
139-
140-
Laravel Optimus with multiple connections provided by the [cybercog/laravel-optimus](https://github.com/cybercog/laravel-optimus) package.
141-
142-
An integration with Silex 2 is provided by the [jaam/silex-optimus-provider](https://packagist.org/packages/jaam/silex-optimus-provider) package.
143-
144-
An integration with Laravel is provided by the [elfsundae/laravel-hashid](https://github.com/ElfSundae/laravel-hashid) package.
145-
146-
A PSR-15 middleware provided by the [icanhazstring/optimus-middleware](https://github.com/icanhazstring/optimus-middleware) package.
140+
* An integration with Laravel is provided by the [propaganistas/laravel-fakeid](https://packagist.org/packages/propaganistas/laravel-fakeid) package.
141+
* Laravel Optimus with multiple connections provided by the [cybercog/laravel-optimus](https://github.com/cybercog/laravel-optimus) package.
142+
* An integration with Silex 2 is provided by the [jaam/silex-optimus-provider](https://packagist.org/packages/jaam/silex-optimus-provider) package.
143+
* An integration with Laravel is provided by the [elfsundae/laravel-hashid](https://github.com/ElfSundae/laravel-hashid) package.
144+
* A PSR-15 middleware provided by the [icanhazstring/optimus-middleware](https://github.com/icanhazstring/optimus-middleware) package.
147145

148146
## Security contact information
149147

150148
To report a security vulnerability, follow [these steps](https://tidelift.com/security).
149+
150+
## License
151+
152+
The [MIT](https://opensource.org/licenses/MIT) License.

composer.json

+8-1
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,12 @@
3232
"suggest": {
3333
"ext-gmp": "Required for 32bit systems"
3434
},
35-
"bin": ["bin/optimus"]
35+
"bin": ["bin/optimus"],
36+
"config": {
37+
"sort-packages": true,
38+
"preferred-install": "dist"
39+
},
40+
"scripts": {
41+
"test": "vendor/bin/phpunit --testdox --color=always"
42+
}
3643
}

tests/EnergonTest.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ public function testGeneratesRandomSet(int $bitLength)
3333
$set = Energon::generate(null, $bitLength);
3434

3535
$this->assertCount(3, $set);
36-
$this->assertInternalType('integer', $set[0], 'Unexpected type for prime number.');
37-
$this->assertInternalType('integer', $set[1], 'Unexpected type for inverse number.');
38-
$this->assertInternalType('integer', $set[2], 'Unexpected type for Xor.');
36+
$this->assertIsInt($set[0], 'Unexpected type for prime number.');
37+
$this->assertIsInt($set[1], 'Unexpected type for inverse number.');
38+
$this->assertIsInt($set[2], 'Unexpected type for Xor.');
3939
$this->assertSame(
4040
'1',
4141
(new BigInteger($set[0]))
@@ -70,9 +70,9 @@ public function testGeneratesAskedSet(int $bitLength, int $prime, int $expectedI
7070
$set = Energon::generate($prime, $bitLength);
7171

7272
$this->assertCount(3, $set);
73-
$this->assertInternalType('integer', $set[0], 'Unexpected type for prime number.');
74-
$this->assertInternalType('integer', $set[1], 'Unexpected type for inverse number.');
75-
$this->assertInternalType('integer', $set[2], 'Unexpected type for Xor.');
73+
$this->assertIsInt($set[0], 'Unexpected type for prime number.');
74+
$this->assertIsInt($set[1], 'Unexpected type for inverse number.');
75+
$this->assertIsInt($set[2], 'Unexpected type for Xor.');
7676
$this->assertEquals($prime, $set[0], 'Unexpected prime number.');
7777
$this->assertEquals($expectedInverse, $set[1], 'Unexpected inverse number.');
7878
}

0 commit comments

Comments
 (0)