Skip to content

Commit

Permalink
Merge pull request #25 from ARCANEDEV/update-github_actions
Browse files Browse the repository at this point in the history
Using GitHub Actions for testing
  • Loading branch information
arcanedev-maroc authored Feb 17, 2020
2 parents 5ba3e80 + 3273179 commit 23ddfbd
Show file tree
Hide file tree
Showing 25 changed files with 451 additions and 333 deletions.
10 changes: 5 additions & 5 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org

root = true

[*]
end_of_line = lf
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@
.gitattributes export-ignore
.gitignore export-ignore
.scrutinizer.yml export-ignore
.travis.yml export-ignore
phpunit.xml.dist export-ignore
CONTRIBUTING.md export-ignore
46 changes: 46 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: run-tests

on: [push]

jobs:
tests:
runs-on: ubuntu-latest

strategy:
fail-fast: true
matrix:
php: [7.2, 7.3, 7.4]
laravel: [6.*]
dependency-version: [prefer-lowest, prefer-stable]

name: PHP ${{ matrix.php }} - ${{ matrix.dependency-version }}

steps:
- name: Checkout code
uses: actions/checkout@v1

- name: Cache dependencies
uses: actions/cache@v1
with:
path: ~/.composer/cache/files
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}

- name: Setup PHP
uses: shivammathur/setup-php@v1
with:
php-version: ${{ matrix.php }}
extensions: curl, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, iconv
coverage: xdebug

- name: Install dependencies
run: composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest

- name: Execute tests
run: |
mkdir -p build/logs
vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover
- name: Scrutinizer CI
run: |
wget https://scrutinizer-ci.com/ocular.phar
php ocular.phar code-coverage:upload --format=php-clover coverage.clover
23 changes: 0 additions & 23 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015-2019 | ARCANEDEV <[email protected]> - LaravelSitemap
Copyright (c) 2015-2020 | ARCANEDEV <[email protected]> - LaravelSitemap

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Laravel Sitemap [![Packagist License][badge_license]](LICENSE.md) [![For Laravel][badge_laravel]][link-github-repo]

[![Travis Status][badge_build]][link-travis]
[![Github Workflow Status][badge_build]][link-github-status]
[![Coverage Status][badge_coverage]][link-scrutinizer]
[![Scrutinizer Code Quality][badge_quality]][link-scrutinizer]
[![SensioLabs Insight][badge_insight]][link-insight]
Expand Down Expand Up @@ -43,7 +43,7 @@ If you discover any security related issues, please email arcanedev.maroc@gmail.

[badge_laravel]: https://img.shields.io/badge/Laravel-5.4%20to%206.x-orange.svg?style=flat-square
[badge_license]: https://img.shields.io/packagist/l/arcanedev/laravel-sitemap.svg?style=flat-square
[badge_build]: https://img.shields.io/travis/ARCANEDEV/LaravelSitemap.svg?style=flat-square
[badge_build]: https://img.shields.io/github/workflow/status/ARCANEDEV/LaravelSitemap/run-tests?style=flat-square
[badge_coverage]: https://img.shields.io/scrutinizer/coverage/g/ARCANEDEV/LaravelSitemap.svg?style=flat-square
[badge_quality]: https://img.shields.io/scrutinizer/g/ARCANEDEV/LaravelSitemap.svg?style=flat-square
[badge_insight]: https://img.shields.io/sensiolabs/i/40aabf97-8e78-4574-9560-a9ad89704937.svg?style=flat-square
Expand All @@ -54,9 +54,9 @@ If you discover any security related issues, please email arcanedev.maroc@gmail.

[link-author]: https://github.com/arcanedev-maroc
[link-github-repo]: https://github.com/ARCANEDEV/LaravelSitemap
[link-github-status]: https://github.com/ARCANEDEV/LaravelSitemap/actions
[link-github-issues]: https://github.com/ARCANEDEV/LaravelSitemap/issues
[link-contributors]: https://github.com/ARCANEDEV/LaravelSitemap/graphs/contributors
[link-packagist]: https://packagist.org/packages/arcanedev/laravel-sitemap
[link-travis]: https://travis-ci.org/ARCANEDEV/LaravelSitemap
[link-scrutinizer]: https://scrutinizer-ci.com/g/ARCANEDEV/LaravelSitemap/?branch=master
[link-insight]: https://insight.sensiolabs.com/projects/40aabf97-8e78-4574-9560-a9ad89704937
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"php": ">=7.2.0",
"ext-dom": "*",
"ext-json": "*",
"arcanedev/support": "^5.0"
"arcanedev/support": "^5.1.1"
},
"require-dev": {
"orchestra/testbench": "^4.0",
Expand Down
4 changes: 2 additions & 2 deletions helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
/**
* Get the Sitemap Manager instance.
*
* @return SitemapManager
* @return \Arcanedev\LaravelSitemap\Contracts\SitemapManager
*/
function sitemap() {
function sitemap(): SitemapManager {
return app(SitemapManager::class);
}
}
20 changes: 13 additions & 7 deletions src/Contracts/Entities/ChangeFrequency.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
<?php namespace Arcanedev\LaravelSitemap\Contracts\Entities;
<?php

declare(strict_types=1);

namespace Arcanedev\LaravelSitemap\Contracts\Entities;

use Illuminate\Support\Collection;

/**
* Interface ChangeFrequency
Expand Down Expand Up @@ -31,7 +37,7 @@ interface ChangeFrequency
*
* @return \Illuminate\Support\Collection
*/
public static function keys();
public static function keys(): Collection;

/**
* Get all the valid frequency values.
Expand All @@ -40,18 +46,18 @@ public static function keys();
*
* @return \Illuminate\Support\Collection
*/
public static function all($locale = null);
public static function all(string $locale = null): Collection;

/**
* Get the translated frequency name.
*
* @param string $key
* @param string|null $default
* @param mixed|null $default
* @param string|null $locale
*
* @return string|null
* @return string|mixed|null
*/
public static function get($key, $default = null, $locale = null);
public static function get(string $key, $default = null, string $locale = null);

/**
* Check if the given frequency exists.
Expand All @@ -60,5 +66,5 @@ public static function get($key, $default = null, $locale = null);
*
* @return bool
*/
public static function has($key);
public static function has(string $key): bool ;
}
39 changes: 21 additions & 18 deletions src/Contracts/Entities/Sitemap.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
<?php namespace Arcanedev\LaravelSitemap\Contracts\Entities;
<?php

declare(strict_types=1);

namespace Arcanedev\LaravelSitemap\Contracts\Entities;

use Countable;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Contracts\Support\Jsonable;
use Illuminate\Contracts\Support\{Arrayable, Jsonable};
use Illuminate\Support\Collection;
use JsonSerializable;

Expand All @@ -24,30 +27,30 @@ interface Sitemap extends Arrayable, Countable, Jsonable, JsonSerializable
*
* @param string $path
*
* @return self
* @return $this
*/
public function setPath($path);
public function setPath(string $path);

/**
* Get the sitemap path.
*
* @return string|null
*/
public function getPath();
public function getPath(): ?string;

/**
* Get the sitemap's URLs.
*
* @return \Illuminate\Support\Collection
*/
public function getUrls();
public function getUrls(): Collection;

/**
* Set the URLs Collection.
*
* @param \Illuminate\Support\Collection $urls
*
* @return self
* @return $this
*/
public function setUrls(Collection $urls);

Expand All @@ -59,7 +62,7 @@ public function setUrls(Collection $urls);
/**
* Make a sitemap instance.
*
* @return self
* @return $this
*/
public static function make();

Expand All @@ -71,7 +74,7 @@ public static function make();
*
* @return \Arcanedev\LaravelSitemap\Entities\Url|null
*/
public function getUrl($loc, $default = null);
public function getUrl(string $loc, $default = null);

/**
* Add a sitemap URL to the collection.
Expand All @@ -85,21 +88,21 @@ public function add(Url $url);
/**
* Add many urls to the collection.
*
* @param array $urls
* @param iterable|mixed $urls
*
* @return self
* @return $this
*/
public function addMany($urls);
public function addMany(iterable $urls);

/**
* Create and Add a sitemap URL to the collection.
*
* @param string $loc
* @param callable $callback
*
* @return self
* @return $this
*/
public function create($loc, callable $callback);
public function create(string $loc, callable $callback);

/**
* Check if the url exists in the sitemap items.
Expand All @@ -108,19 +111,19 @@ public function create($loc, callable $callback);
*
* @return bool
*/
public function has($url);
public function has(string $url): bool;

/**
* Check if the number of URLs is exceeded.
*
* @return bool
*/
public function isExceeded();
public function isExceeded(): bool;

/**
* Chunk the sitemap to multiple chunks if the size is exceeded.
*
* @return \Illuminate\Support\Collection
*/
public function chunk();
public function chunk(): Collection;
}
Loading

0 comments on commit 23ddfbd

Please sign in to comment.