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

switch to GitHub CI #6

Merged
merged 8 commits into from
Nov 21, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions .circleci/config.yml

This file was deleted.

36 changes: 36 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: CI

on: [push, pull_request]

env:
php-options: -C -d opcache.enable=0 -d zend.exception_ignore_args=0

jobs:
tests:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
php: ['8.0', '8.1', '8.2', '8.3']
sapi: ['php', 'php-cgi']

fail-fast: false

name: PHP ${{ matrix.php }}/${{ matrix.sapi }} tests on ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: none
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'
- uses: actions/setup-node@v3
with:
node-version: '20'

- run: composer install --no-progress --prefer-dist
- run: vendor/bin/tester -C test/test.php -p ${{ matrix.sapi }} -s ${{ env.php-options }}
- run: cd .. && transit-php/bin/transit-format
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
.DS_Store
vendor/
.idea/
*.lock
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# transit-php [![CircleCI](https://circleci.com/gh/honzabrecka/transit-php/tree/master.svg?style=svg&circle-token=817187a55f77fb9bd7811bf5daa6e344885523fa)](https://circleci.com/gh/honzabrecka/transit-php/tree/master)
# transit-php

Transit is a data format and a set of libraries for conveying values between applications written in different languages. This library provides support for marshalling Transit data to/from PHP. Unlike the Java and Clojure implementations it relies on the non-streaming JSON parsing mechanism of the host PHP environment.

Expand Down
2 changes: 2 additions & 0 deletions bin/roundtrip.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

error_reporting(E_ERROR | E_PARSE);

require_once __DIR__ . '/../vendor/autoload.php';

use transit\JSONReader;
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
},
"require": {
"php": ">=5.6.0",
"nette/utils": "2.5.*"
"nette/utils": "4.0.*"
},
"require-dev": {
"nette/tester": "2.0.*"
"nette/tester": "2.5.*"
}
}
183 changes: 183 additions & 0 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 0 additions & 24 deletions src/transit/Timestamp.php

This file was deleted.

2 changes: 0 additions & 2 deletions src/transit/Transit.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
use transit\handlers\URIHandler;
use transit\handlers\UUIDHandler;
use transit\handlers\CharHandler;
use transit\handlers\TimestampHandler;
use transit\handlers\ArbitraryPrecisionDecimalHandler;
use transit\handlers\ArbitraryPrecisionIntegerHandler;

Expand Down Expand Up @@ -53,7 +52,6 @@ private function registerDefaultHandlers() {
$this->registerHandler(new SymbolHandler());
$this->registerHandler(new SetHandler());
$this->registerHandler(new ListHandler());
$this->registerHandler(new TimestampHandler());
$this->registerHandler(new DateTimeHandler());
$this->registerHandler(new URIHandler());
$this->registerHandler(new UUIDHandler());
Expand Down
4 changes: 2 additions & 2 deletions src/transit/handlers/DateTimeHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ public function type() {
}

public function representation($obj) {
return $obj->getTimestamp() * 1000;
return $obj->getTimestamp();
}

public function resolve($obj) {
return new \DateTime('@' . $obj/1000);
return new \DateTime('@' . $obj);
}

}
25 changes: 0 additions & 25 deletions src/transit/handlers/TimestampHandler.php

This file was deleted.

8 changes: 6 additions & 2 deletions test/test.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ function r($input) {
return t()->read($input);
}

function roundtrip($input) {
return w(r($input));
}

//-------------------------
// write

Expand Down Expand Up @@ -414,8 +418,8 @@ function r($input) {
//-------------------------
// extensions

Assert::equal('["~m482196050000"]', w([new DateTime('1985-04-12T23:20:50.52Z')]));
Assert::equal((new DateTime('1985-04-12T23:20:50.52Z'))->getTimestamp(), r('["~m482196050000"]')[0]->getTimestamp());
$timestamp = "[\"~#'\",\"~m1776669847291\"]";
Assert::equal($timestamp, roundtrip($timestamp));

Assert::equal('["~bYWJj"]', w([new Bytes('abc')]));
Assert::equal([new Bytes('abc')], r('["~bYWJj"]'));
Expand Down
Loading