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

build: test against PHP 8.4 #351

Open
wants to merge 17 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: "composer"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
6 changes: 3 additions & 3 deletions .github/workflows/coding-standard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
fail-fast: false
matrix:
operating-system: [ubuntu-latest, windows-latest]
php-versions: ["8.0", "8.1", "8.2", "8.3"]
php-versions: ["8.0", "8.1", "8.2", "8.3", "8.4"]

steps:
- name: Set git to use LF
Expand All @@ -21,7 +21,7 @@ jobs:
git config --global core.eol lf

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install PHP
uses: shivammathur/setup-php@v2
Expand All @@ -35,7 +35,7 @@ jobs:
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache Composer dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

steps:
- name: "Prune stale issues and pull requests"
uses: "actions/stale@v3.0.14"
uses: "actions/stale@v9.0.0"
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
days-before-close: "${{ env.DAYS_BEFORE_CLOSE }}"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
fail-fast: false
matrix:
operating-system: [ubuntu-latest, windows-latest]
php-versions: ["8.0", "8.1", "8.2", "8.3"]
php-versions: ["8.0", "8.1", "8.2", "8.3", "8.4"]

steps:
- name: Set git to use LF
Expand All @@ -21,7 +21,7 @@ jobs:
git config --global core.eol lf

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install PHP
uses: shivammathur/setup-php@v2
Expand All @@ -35,7 +35,7 @@ jobs:
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache Composer dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
fail-fast: false
matrix:
operating-system: [ubuntu-latest, windows-latest]
php-versions: ["8.0", "8.1", "8.2", "8.3"]
php-versions: ["8.0", "8.1", "8.2", "8.3", "8.4"]

steps:
- name: Set git to use LF
Expand All @@ -21,7 +21,7 @@ jobs:
git config --global core.eol lf

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install PHP
uses: shivammathur/setup-php@v2
Expand All @@ -35,7 +35,7 @@ jobs:
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache Composer dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.idea/
.php-cs-fixer.cache
.php_cs.cache
.phpactor.json
.phpunit.result.cache
bin/_*
composer.lock
Expand Down
121 changes: 121 additions & 0 deletions cliff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# git-cliff ~ configuration file
# https://git-cliff.org/docs/configuration
#
# Lines starting with "#" are comments.
# Configuration options are organized into tables and keys.
# See documentation for more information on available options.

[remote.github]
owner = "azuyalabs"
repo = "yasumi"

[changelog]

# changelog header
header = """
# Changelog\n
All notable changes to this project will be documented in this file.

This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) and
[Conventional Commits](https://conventionalcommits.org) for commit conventions.

Changes related to the logic of the holidays or their providers are listed first,
followed by any architectural or technical changes.\n
"""

# template for the changelog body
# https://keats.github.io/tera/docs/#introduction
body = """
{% if version -%}
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
{% else -%}
## [Unreleased]
{% endif -%}

{% for group, commits in commits | group_by(attribute="group") %}
### {{ group | striptags | trim | upper_first }}
{% for commit in commits %}
- {% if commit.scope %}({{ commit.scope | upper_first }}) {% endif%}{{ commit.message | split(pat="\n") | first | split(pat=": ") | last | trim | upper_first }}\
{% endfor %}
{% endfor %}

{%- if github -%}
{% if github.contributors | filter(attribute="is_first_time", value=true) | length != 0 %}
## New Contributors ❤️
{% endif %}\
{% for contributor in github.contributors | filter(attribute="is_first_time", value=true) | sort(attribute="username") %}
* @{{ contributor.username }} made their first contribution
{%- endfor -%}
{%- endif %}\n\n
"""

# template for the changelog footer
footer = """
{% for release in releases -%}
{% if release.version -%}
{% if release.previous.version -%}
[{{ release.version | trim_start_matches(pat="v") }}]: \
https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}\
/compare/{{ release.previous.version }}..{{ release.version }}
{% endif -%}
{% else -%}
[unreleased]: https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}\
/compare/{{ release.previous.version }}..HEAD
{% endif -%}
{% endfor %}
"""

# remove the leading and trailing whitespace from the templates
trim = true

[git]

# parse the commits based on https://www.conventionalcommits.org
conventional_commits = true

# filter out the commits that are not conventional
filter_unconventional = true

# process each line of a commit as an individual commit
split_commits = false

# preprocessors for manipulating the commit messages before parsing/grouping them
commit_preprocessors = [
{ pattern = "\\(#([0-9]+)\\)", replace = "([#${1}](https://github.com/azuyalabs/yasumi/issues/${1}))"}
]

# regex for parsing and grouping commits
commit_parsers = [
{ message = "^feat", group = "<!-- 0 -->Features" },
{ message = "^fix", group = "<!-- 1 -->Fixes" },
{ message = "^refactor", group = "<!-- 2 -->Refactor" },
{ message = "^perf", group = "<!-- 3 -->Performance" },
{ message = "^doc", group = "<!-- 4 -->Documentation" },
{ message = "^style", group = "<!-- 5 -->Code Style" },
{ message = "^test", group = "<!-- 6 -->Testing" },
{ message = "^chore|^ci|^build", group = "<!-- 7 -->Other" },

# skip merge commits
{ message = "^[Mm]erge", skip = true },
]

# protect breaking changes from being skipped due to matching a skipping commit_parser
protect_breaking_commits = false

# filter out the commits that are not matched by commit parsers
filter_commits = true

# regex for matching git tags
tag_pattern = "[0-9].*"

# regex for skipping tags
skip_tags = "beta|alpha"

# regex for ignoring tags
ignore_tags = ""

# sort the tags topologically
topo_order = true

# sort the commits inside sections by oldest/newest order
sort_commits = "newest"
4 changes: 4 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
verbose="true"
>

<php>
<ini name="memory_limit" value="512M" />
</php>

<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./src/Yasumi</directory>
Expand Down
2 changes: 1 addition & 1 deletion src/Yasumi/Filters/BetweenFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function __construct(
\Iterator $iterator,
\DateTimeInterface $startDate,
\DateTimeInterface $endDate,
private bool $equal = true
private bool $equal = true,
) {
parent::__construct($iterator);
$this->startDate = $startDate->format(self::DATE_FORMAT);
Expand Down
2 changes: 1 addition & 1 deletion src/Yasumi/Filters/OnFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class OnFilter extends AbstractFilter
*/
public function __construct(
\Iterator $iterator,
\DateTimeInterface $date
\DateTimeInterface $date,
) {
parent::__construct($iterator);
$this->date = $date->format(self::DATE_FORMAT);
Expand Down
2 changes: 1 addition & 1 deletion src/Yasumi/Holiday.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function __construct(
public array $translations,
\DateTimeInterface $date,
string $displayLocale = self::DEFAULT_LOCALE,
protected string $type = self::TYPE_OFFICIAL
protected string $type = self::TYPE_OFFICIAL,
) {
// Validate if key is not empty
if ('' === $key) {
Expand Down
4 changes: 2 additions & 2 deletions src/Yasumi/Provider/AbstractProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ abstract class AbstractProvider implements \Countable, ProviderInterface, \Itera
public function __construct(
int $year,
?string $locale = null,
private ?TranslationsInterface $globalTranslations = null
private ?TranslationsInterface $globalTranslations = null,
) {
$this->clearHolidays();

Expand Down Expand Up @@ -217,7 +217,7 @@ public function previous(string $key): ?Holiday
public function between(
\DateTimeInterface $startDate,
\DateTimeInterface $endDate,
?bool $equals = null
?bool $equals = null,
): BetweenFilter {
if ($startDate > $endDate) {
throw new \InvalidArgumentException('Start date must be a date before the end date.');
Expand Down
4 changes: 2 additions & 2 deletions src/Yasumi/Provider/Australia/AustralianCapitalTerritory.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ protected function easterSunday(
int $year,
string $timezone,
string $locale,
?string $type = null
?string $type = null,
): Holiday {
return new Holiday(
'easter',
Expand Down Expand Up @@ -107,7 +107,7 @@ protected function easterSaturday(
int $year,
string $timezone,
string $locale,
?string $type = null
?string $type = null,
): Holiday {
$date = $this->calculateEaster($year, $timezone)->sub(new \DateInterval('P1D'));

Expand Down
2 changes: 1 addition & 1 deletion src/Yasumi/Provider/Australia/NewSouthWales.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ protected function easterSaturday(
int $year,
string $timezone,
string $locale,
?string $type = null
?string $type = null,
): Holiday {
$date = $this->calculateEaster($year, $timezone)->sub(new \DateInterval('P1D'));

Expand Down
2 changes: 1 addition & 1 deletion src/Yasumi/Provider/Australia/NorthernTerritory.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ protected function easterSaturday(
int $year,
string $timezone,
string $locale,
?string $type = null
?string $type = null,
): Holiday {
$date = $this->calculateEaster($year, $timezone)->sub(new \DateInterval('P1D'));

Expand Down
2 changes: 1 addition & 1 deletion src/Yasumi/Provider/Australia/SouthAustralia.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ protected function easterSaturday(
int $year,
string $timezone,
string $locale,
?string $type = null
?string $type = null,
): Holiday {
$date = $this->calculateEaster($year, $timezone)->sub(new \DateInterval('P1D'));

Expand Down
4 changes: 2 additions & 2 deletions src/Yasumi/Provider/Australia/Victoria.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ protected function easterSunday(
int $year,
string $timezone,
string $locale,
?string $type = null
?string $type = null,
): Holiday {
return new Holiday(
'easter',
Expand Down Expand Up @@ -107,7 +107,7 @@ protected function easterSaturday(
int $year,
string $timezone,
string $locale,
?string $type = null
?string $type = null,
): Holiday {
$date = $this->calculateEaster($year, $timezone)->sub(new \DateInterval('P1D'));

Expand Down
2 changes: 1 addition & 1 deletion src/Yasumi/Provider/Canada/Quebec.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ protected function saintJeanBaptisteDay(
int $year,
string $timezone,
string $locale,
string $type = Holiday::TYPE_OFFICIAL
string $type = Holiday::TYPE_OFFICIAL,
): Holiday {
return new Holiday(
'saintJeanBaptisteDay',
Expand Down
Loading
Loading