Skip to content

Commit

Permalink
Merge branch 'dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
WengerK authored Jul 12, 2023
2 parents a90396a + a35cbac commit cf5e3da
Show file tree
Hide file tree
Showing 12 changed files with 91 additions and 79 deletions.
2 changes: 1 addition & 1 deletion .coveralls.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
service_name: travis-ci
service_name: github-actions

# for php-coveralls
coverage_clover: build/logs/clover.xml
40 changes: 19 additions & 21 deletions .github/workflows/code-styles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v1
uses: shivammathur/setup-php@v2
with:
php-version: '7.3'
php-version: '8.0'
extensions: mbstring, intl, gd, xml, dom, json, fileinfo, curl, zip, iconv
tools: php-cs-fixer, cs2pr
- uses: actions/checkout@master
- uses: actions/checkout@v2
- run: composer install --prefer-dist
- run: ./vendor/bin/php-cs-fixer fix --dry-run --format=checkstyle | cs2pr

Expand All @@ -21,11 +21,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v1
uses: shivammathur/setup-php@v2
with:
php-version: '7.3'
php-version: '8.1'
extensions: mbstring, intl, gd, xml, dom, json, fileinfo, curl, zip, iconv
- uses: actions/checkout@master
- uses: actions/checkout@v2
- run: composer install --prefer-dist
- run: ./vendor/bin/phpmd ./ text ./phpmd.xml --suffixes php,inc,test --exclude vendor,bin,tests

Expand All @@ -34,11 +34,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v1
uses: shivammathur/setup-php@v2
with:
php-version: '7.3'
php-version: '8.1'
extensions: mbstring, intl, gd, xml, dom, json, fileinfo, curl, zip, iconv
- uses: actions/checkout@master
- uses: actions/checkout@v2
- run: composer install --prefer-dist
- run: ./vendor/bin/phpcpd ./ --suffix .php --suffix .inc --suffix .test --exclude vendor --exclude bin --exclude tests

Expand All @@ -47,12 +47,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v1
uses: shivammathur/setup-php@v2
with:
php-version: '7.3'
php-version: '8.1'
extensions: mbstring, intl, gd, xml, dom, json, fileinfo, curl, zip, iconv
tools: phpstan, cs2pr
- uses: actions/checkout@master
- uses: actions/checkout@v2
- run: composer install --prefer-dist
- run: ./vendor/bin/phpstan analyse ./src ./tests --error-format=checkstyle | cs2pr

Expand All @@ -61,11 +61,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v1
uses: shivammathur/setup-php@v2
with:
php-version: '7.3'
php-version: '8.1'
extensions: mbstring, intl, gd, xml, dom, json, fileinfo, curl, zip, iconv
- uses: actions/checkout@master
- uses: actions/checkout@v2
- run: composer install --prefer-dist
- run: ./vendor/bin/psalm --output-format=github

Expand All @@ -74,11 +74,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v1
uses: shivammathur/setup-php@v2
with:
php-version: '7.3'
extensions: mbstring, intl, gd, xml, dom, json, fileinfo, curl, zip, iconv
tools: php-cs-fixer, cs2pr
- uses: actions/checkout@master
tools: composer:v2
- uses: actions/checkout@v2
- run: composer install --prefer-dist
- run: ./vendor/bin/security-checker security:check ./composer.lock
- uses: symfonycorp/security-checker-action@v3
31 changes: 31 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Tests
on:
push:
schedule:
- cron: "0 0 * * THU"

jobs:
tests:
runs-on: ubuntu-latest

strategy:
matrix:
php-versions: ['7.4', '8.0', '8.1']
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: composer:v2
- uses: actions/checkout@v2
- uses: php-actions/composer@v6
with:
php_version: ${{ matrix.php-versions }}
version: 2
- run: XDEBUG_MODE=coverage ./vendor/bin/phpunit
- name: Upload coverage results to Coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
composer global require php-coveralls/php-coveralls
php-coveralls --coverage_clover=build/logs/clover.xml -v
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.env
/vendor
composer.lock
.phpunit.result.cache

# Ignore file generated by MacOS
Expand Down
20 changes: 0 additions & 20 deletions .travis.yml

This file was deleted.

39 changes: 29 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,32 @@
CHANGELOG
---------
# Changelog
All notable changes to this project will be documented in this file.

## 0.0.2-alpha (2022-11-02)
- fixed deprecations for development
- fixed deprecations for PHP 8.1
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 0.0.1-alpha (2020-06-12)
- allow conversion of GPS (WGS84) coordinates from/to CH1903/LV03 (MN03)
- allow conversion of GPS (WGS84) coordinates from/to CH1995/LV95 (MN95)
## [Unreleased]
### Fixed
- fixed deprecations for development
- fixed deprecations for PHP 8.1

## 0.0.0 (2020-06-12)
- under heavy development
### Changed
- update changelog following 'keep a changelog' format
- run code-styles Github Actions on PHP 8.1
- update symfony checker to use new symfonycorp/security-checker-action
- use assertion with Delta on PHPUnit float values

### Added
- add run of tests on Github Actions
- add coverage to coveralls

### Removed
- remove Travis integration for tests
- remove StyleCI integration

## [0.0.1-alpha] - 2020-06-12
### Added
- allow conversion of GPS (WGS84) coordinates from/to CH1903/LV03 (MN03)
- allow conversion of GPS (WGS84) coordinates from/to CH1995/LV95 (MN95)

[Unreleased]: https://github.com/antistatique/swisstopo/compare/0.0.1-alpha...HEAD
[0.0.1-alpha]: https://github.com/antistatique/swisstopo/releases/tag/0.0.1-alpha
9 changes: 0 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,6 @@ It can modernize your code (like converting the pow function to the ** operator
./vendor/bin/phpstan analyse ./ --error-format=checkstyle
```

<!-- ### Asserts Security Vulnerabilities
The [SensioLabs Security Checker](https://github.com/sensiolabs/security-checker) is a command line tool that checks
if the application uses dependencies with known security vulnerabilitie.
```bash
./vendor/bin/security-checker security:check ./composer.lock
``` -->

### Improve global code quality using PHPCPD (Code duplication) & PHPMD (PHP Mess Detector)

Detect overcomplicated expressions & Unused parameters, methods, properties
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
Convert World Coordinates to Swiss Coordinates - and vice versa
=============

[![Build Status](https://travis-ci.com/antistatique/swisstopo.svg?branch=dev)](https://travis-ci.com/antistatique/swisstopo)
[![StyleCI](https://github.styleci.io/repos/207270598/shield?branch=master)](https://github.styleci.io/repos/207270598)
[![Coverage Status](https://coveralls.io/repos/github/antistatique/swisstopo/badge.svg?branch=dev)](https://coveralls.io/github/antistatique/swisstopo?branch=dev)
[![Build](https://github.com/antistatique/swisstopo/actions/workflows/tests.yml/badge.svg)](https://github.com/antistatique/swisstopo/actions/workflows/tests.yml)
[![Packagist](https://img.shields.io/packagist/dt/antistatique/swisstopo.svg?maxAge=2592000)](https://packagist.org/packages/antistatique/swisstopo)
[![License](https://poser.pugx.org/antistatique/swisstopo/license)](https://packagist.org/packages/antistatique/swisstopo)
[![PHP Versions Supported](https://img.shields.io/badge/php-%3E%3D%207.1-8892BF.svg)](https://packagist.org/packages/antistatique/swisstopo)
Expand Down
3 changes: 0 additions & 3 deletions bin/post-commit
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,3 @@ echo "\n🙏 \033[0;32mRunning Psalm ...\033[0m"

echo "\n👻 \033[0;32mRunning PHPStan ...\033[0m"
./vendor/bin/phpstan analyse ./src ./tests --error-format=checkstyle

echo "\n⛔ \033[0;32mRunning SensioLabs Security Checker ...\033[0m"
./vendor/bin/security-checker security:check ./composer.lock
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Convert GPS (WGS84) to Swiss (LV03 and LV95) coordinates (and vice versa)",
"license": "MIT",
"require": {
"php": ">=8.1"
"php": ">=7.4 || >=8.1"
},
"require-dev": {
"phpunit/phpunit": "^9.0.0",
Expand Down
10 changes: 4 additions & 6 deletions tests/SwisstopoConverterWGSToMN03Tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ public function testFromMN03ToWGS(): void
{
$swiss_converter = new SwisstopoConverter();
$coordinates = $swiss_converter->fromMN03ToWGS(554680, 145807);
$this->assertSame([
'lat' => 46.462057617639346,
'long' => 6.848673659076181,
], $coordinates);
$this->assertEqualsWithDelta(46.462057617639, $coordinates['lat'], 0.0001);
$this->assertEqualsWithDelta(6.8486736590762, $coordinates['long'], 0.0001);
}

/**
Expand All @@ -48,7 +46,7 @@ public function testFromMN03ToWGSLatitude(): void
{
$swiss_converter = new SwisstopoConverter();
$latitude = $this->invokeMethod($swiss_converter, 'fromMN03ToWGSLatitude', [554680, 145807]);
$this->assertEquals(46.462057617639, $latitude);
$this->assertEqualsWithDelta(46.462057617639, $latitude, 0.0001);
}

/**
Expand All @@ -60,7 +58,7 @@ public function testFromMN03ToWGSLongitude(): void
{
$swiss_converter = new SwisstopoConverter();
$longitude = $this->invokeMethod($swiss_converter, 'fromMN03ToWGSLongitude', [554680, 145807]);
$this->assertEquals(6.8486736590762, $longitude);
$this->assertEqualsWithDelta(6.8486736590762, $longitude, 0.0001);
}

/**
Expand Down
10 changes: 4 additions & 6 deletions tests/SwisstopoConverterWGSToMN95Tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ public function testFromMN95ToWGS(): void
{
$swiss_converter = new SwisstopoConverter();
$coordinates = $swiss_converter->fromMN95ToWGS(2555047, 1145923);
$this->assertSame([
'lat' => 46.46312579498212,
'long' => 6.8534397262208095,
], $coordinates);
$this->assertEqualsWithDelta(46.463125794982, $coordinates['lat'], 0.0001);
$this->assertEqualsWithDelta(6.8534397262208, $coordinates['long'], 0.0001);
}

/**
Expand Down Expand Up @@ -74,7 +72,7 @@ public function testFromMN95ToWGSLatitude(): void
{
$swiss_converter = new SwisstopoConverter();
$latitude = $this->invokeMethod($swiss_converter, 'fromMN95ToWGSLatitude', [2555047, 1145923]);
$this->assertEquals(46.463125794982, $latitude);
$this->assertEqualsWithDelta(46.463125794982, $latitude, 0.0001);
}

/**
Expand All @@ -86,6 +84,6 @@ public function testFromMN95ToWGSLongitude(): void
{
$swiss_converter = new SwisstopoConverter();
$longitude = $this->invokeMethod($swiss_converter, 'fromMN95ToWGSLongitude', [2555047, 1145923]);
$this->assertEquals(6.8534397262208, $longitude);
$this->assertEqualsWithDelta(6.8534397262208, $longitude, 0.0001);
}
}

0 comments on commit cf5e3da

Please sign in to comment.