Commit graph

52 commits

Author SHA1 Message Date
Alexandre Gomes Gaigalas
8eaedcfba0 Update composer lifecycle
- Commit composer.lock.
 - The lock is not ignored anymore.
 - Changed to ramsey/composer-install action for cache.
2026-02-06 19:20:10 +00:00
Alexandre Gomes Gaigalas
7876576f08 Change CI Perf to run on schedule, no runs on PRs
See #1635

The goal is to collect data for a while. Until we have enough
benchmarks, the PR check is not very useful, so it was disabled.

We added `--tolerate-failure` to all runs, so this check will
never fail because of a missed performance assertion, but it will
report it and archive it.
2026-01-30 11:45:06 +00:00
Alexandre Gomes Gaigalas
bee97ae6e1 Fixes git workspace after checking out benchmarks
With the introduction of composite actions in the GitHub workflows,
the ci-perf.yml workflow broke.

This happens because the setup-action configures a Post Run (a hook
to be executed after the workflow).

Since the benchmarks checkout a different orphan branch, when that
Post Run executes, it cannot find the action anymore.

To fix it, I introduce a new step that restores the git workspace,
making it available for that hook.
2026-01-29 11:06:19 +00:00
Alexandre Gomes Gaigalas
b69beb1db7 Refactor CI Workflows
- Added a composite action for common setup tasks.
 - Shorter names that fit better GitHub runner displays.
 - Changed ci-perf to only run if src or tests change.
 - Removed redundant step names when they're obvious.
2026-01-28 17:31:37 +00:00
Henrique Moody
819d734a00
Check for mismatches in the mixin classes
When we change the contract of a validator, or create a new one, we need to
ensure that the mixin for the validator is present and matches the validator's
constructor.

This commit changes the current class that generates those mixin classes,
converting it into a linter so we can run it in the GitHub workflow to check for
missing changes.
2026-01-26 20:14:09 +01:00
Henrique Moody
0190f3e109
Group lint-related commands together
Since we have so many lint-related commands now, it makes sense to group
them together to it's easier to spot them.
2026-01-26 20:14:09 +01:00
Alexandre Gomes Gaigalas
a91517108e Lint SPDX conventions
The `reuse lint` command only checks for REUSE compliance, which
will accept all sorts of SPDX headers.

In this project, however, we have also other conventions. For
example, we require all PHP and docs files from the project
to have a specific license (not just any license) and also a
specific File Copyright Text (not just any copyright).

This commit introduces a command to solve this problem, validating
the headers more thoroughly.

The introduced command also does some dogfooding, using validators
from the library itself to perform some of its tasks, namely: Call,
Each, Contains, Templated and Named, showcasing potential different
use cases for the project.
2026-01-26 16:07:09 +00:00
Alexandre Gomes Gaigalas
e83e73b771 Adhere to GitHub Community Standards
Makes the project more friendly to GitHub users by providing
conventional files.

Those changes will improve our score under the GitHub
community tab:

https://github.com/Respect/Validation/community

 - The CHANGELOG.md file was removed. It was outdated and
   not being maintained.
 - Minimalistic .github/PULL_REQUEST_TEMPLATE.md
 - Minimalistic .github/SECURITY.md
 - Minimalistic .github/CODE_OF_CONDUCT.md
 - Minimalistic .github/ISSUE_TEMPLATE
2026-01-26 12:00:42 +00:00
Alexandre Gomes Gaigalas
9862963d06 Setup Continuous Performance
A new workflow, continuous-integration-perf.yml was introduced. It:

 - Checks out the `benchmarks` branch locally.
 - Runs the benchmarks, accounting for non-existant baselines
   and target (main/PR).
 - Stores the .phpbench storage folder and a human-readable
   report in the `benchmarks` branch.
 - Does not make a PR fail, and never reports a failure
   when merging to main.
 - Allows workflow_dispatch for quick re-runs, and has an
   option to reset the baseline in case something changes
   (GitHub runner setup gets faster/slower, major refactors,
   etc).

Thus, it keeps a historical record of all benchmark results.

These results can be viewed by exploring GitHub via the web
interface and seeing the changes in `latest.md` (the human
file commited).

Additionally, one can clone the `benchmarks` branch and run
`phpbench log` to explore the history in more detail.

Some adjustments to previously added benchmarks were made:

 - Assertions were included in order to track time and memory
   tresholds.
 - The benchmarks are now more surgical, and address the
   concrete validators instead of the whole chain validate.

These changes were made to make benchmarks more isolated, with
the intention of adding chain-related benchmarks separately
in the future.
2026-01-21 06:31:37 +00:00
Alexandre Gomes Gaigalas
d9cdc118b2 Introduce REUSE compliance
This commit introduces REUSE compliance by annotating all files
with SPDX information and placing the reused licences in the
LICENSES folder.

We additionally removed the docheader tool which is made obsolete
by this change.

The main LICENSE and copyright text of the project is now not under
my personal name anymore, and it belongs to "The Respect Project
Contributors" instead.

This change restores author names to several files, giving the
appropriate attribution for contributions.
2026-01-21 06:28:11 +00:00
Henrique Moody
098c973a2a
Add GitHub action to lint documentation files
When we make changes to the category of a validator, it's easy to forget
to update overall list of validators. This commit a GitHub actions that
will run a console command to check if the documentation it up-to-date.

The job will fail when we need to change the document, but the console
command will fix the issues, so there isn't a lot of friction there.
2026-01-13 23:37:05 -07:00
Henrique Moody
6022914cf0
Remove Yes and No rules
I created those validators to make it easy to parse parameters or
console command inputs that were answers to questions one might ask.

One of the biggest problems is that it depends on the machine's locale,
which can be a bit troublesome, rather than receiving a locale in the
constructor. That doesn’t allow for a lot of flexibility when someone
has a multi-lingual application. Additionally, these validators rely on
the regex from `nl_langinfo()`, which is very permissive, resulting in
false positives.

I have a working version of a console command that retrieves data from
the Unicode Common Locale Data Repository (CLDR) and updates a list of
`yesstr` and `nostr` strings from the main XML file of each language.
However, I came to realise that the whole thing is not worth it.

The validators Yes and No can be replaced by using rules like `Regex`
and `In`. They won’t have the ease of multilingual support, but I don’t
think those validators are used a lot. So, I decided I would just remove
them, and if users really ask for it in the next major version, I’d be
happy to revive my branch.
2026-01-10 05:47:28 +01:00
Henrique Moody
7892a7c902
Port Bash scripts to PHP
It makes more sense to use PHP to generate PHP code than to use Bash. I
love writing Bash scripts, but I know it's not for everyone, and they
can become quite complex. Porting them to PHP code also lowers the
barrier for people to change them.

While I was making those changes, I also noticed a problem with how we
save the domain suffixes. We're converting all of them to ASCII, so we
are not preserving languages such as Chinese, Thai, and Hebrew, which
use non-ASCII characters.
2026-01-06 10:06:22 +01:00
Henrique Moody
17782a256e
Enable auto-merge for regional information PRs
This workflow now automatically enables auto-merge for pull requests
created by the regional information update job. When all required CI
checks pass, the PR will merge automatically using rebase strategy.
2026-01-04 22:40:50 +01:00
Henrique Moody
7796174e73
Automate GitHub releases
This commit adds   "softprops/action-gh-release" to GitHub workflows.

That will allow us to automate the process of creating releases from
tags.
2026-01-04 22:26:21 +01:00
dependabot[bot]
5665392d38
Bump peter-evans/create-pull-request from 4 to 8
Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 4 to 8.
- [Release notes](https://github.com/peter-evans/create-pull-request/releases)
- [Commits](https://github.com/peter-evans/create-pull-request/compare/v4...v8)

---
updated-dependencies:
- dependency-name: peter-evans/create-pull-request
  dependency-version: '8'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-01-04 21:49:07 +01:00
dependabot[bot]
8d904f5b42
Bump actions/checkout from 3 to 6
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-01-04 21:48:23 +01:00
Henrique Moody
7f66bcea10
Bump PHP support from 8.1 to 8.5
We want to release version 3.0 as fresh as possible, without having to
maintain backward compatibility with the previous versions. Because that
version will be on for some time, we decided it will be best to support
only PHP version 8.5 or higher.

Acked-by: Alexandre Gomes Gaigalas <alganet@gmail.com>
2025-12-18 19:03:38 +01:00
Henrique Moody
acf791cc9e
Remove "uopz" as a dependency to run tests
I'm creating a workaround here, which is not exactly happy with, but
adding "uopz" as a dependency to run the tests make it harder for
developers, including myself.
2025-12-18 14:13:09 +01:00
Henrique Moody
94daa8d669
Use Pest instead of PHPT files
Although I love PHPT files, and I've done my fair share of making it
easier to write them in this library, they're very slow, and running
them has become a hindrance.

I've been fidgeting with the idea of using Pest for a while, and I think
it's the right tool for the job. I had to create a couple of functions
to make it easier to run those tests, and now they're working really
alright.

I migrated all the PHPT files into Pest files -- I automated most of the
work with a little script using "nikic/php-parser"; this commit should
contain all the previous PHPT tests as Pest tests.

The previous integration tests would take sixteen seconds, and the Pest
tests take less than a second.
2024-12-16 17:07:47 +01:00
Henrique Moody
298b209059
Add support to PHP 8.4 2024-12-11 15:08:50 +01:00
dependabot[bot]
ea3f81fdbc
Bump codecov/codecov-action from 4 to 5
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4 to 5.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v4...v5)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-26 12:53:36 +01:00
dependabot[bot]
f4b8c74f0b
Bump peter-evans/create-pull-request from 6 to 7
Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 6 to 7.
- [Release notes](https://github.com/peter-evans/create-pull-request/releases)
- [Commits](https://github.com/peter-evans/create-pull-request/compare/v6...v7)

---
updated-dependencies:
- dependency-name: peter-evans/create-pull-request
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-26 12:50:44 +01:00
dependabot[bot]
28b3f88627 Bump codecov/codecov-action from 3 to 4
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 3 to 4.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v3...v4)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-15 11:43:46 +01:00
dependabot[bot]
81e67e277f Bump peter-evans/create-pull-request from 5 to 6
Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 5 to 6.
- [Release notes](https://github.com/peter-evans/create-pull-request/releases)
- [Commits](https://github.com/peter-evans/create-pull-request/compare/v5...v6)

---
updated-dependencies:
- dependency-name: peter-evans/create-pull-request
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-15 11:42:50 +01:00
dependabot[bot]
603911eb87
Bump actions/checkout from 3 to 4
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-23 01:15:04 +01:00
Henrique Moody
a45a0a26ab
Use PHP ISO Codes in the "LanguageCode" rule
Since we now have PHP ISO Codes as a dependency[1], it doesn't make
sense to keep dealing with this data ourselves.

[1]: 04b2722d02

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2024-02-22 19:27:49 +01:00
Henrique Moody
27d7db5cc6
Use PHP ISO Codes in the "CurrencyCode" rule
Since we now have PHP ISO Codes as a dependency[1], it doesn't make
sense to keep dealing with this data ourselves.

[1]: 04b2722d02

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2024-02-22 19:23:01 +01:00
Henrique Moody
bd325668a9
Merge branch '2.3' 2024-01-27 20:41:28 +01:00
Henrique Moody
24edfda1aa
Drop support for PHP 8.0 and below
PHP 8.0 is no longer supported. Some of our dependencies now do not work
on PHP 8.0 anymore.

This commit will also run tests on PHP 8.3.

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2024-01-27 20:04:17 +01:00
dependabot[bot]
e3740860f9 Bump peter-evans/create-pull-request from 4 to 5
Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 4 to 5.
- [Release notes](https://github.com/peter-evans/create-pull-request/releases)
- [Commits](https://github.com/peter-evans/create-pull-request/compare/v4...v5)

---
updated-dependencies:
- dependency-name: peter-evans/create-pull-request
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-13 21:45:56 -03:00
Alexandre Gomes Gaigalas
154cccf408 Add idn2 to gh workflow installs 2023-02-19 00:21:13 -03:00
Alexandre Gomes Gaigalas
ce9608d0a8 Auto update postal code list
- For this particular updater, a list of exceptions to the rules
   downloaded by geonames is included in POSTAL_CODES_EXTRA, for
   cases in which we seem to do better than geonames itself based
   on previous user reports.
 - Added an option to also validate formatting of the postal codes.
 - Combined multiple PR bots into a single one.
2023-02-19 00:19:10 -03:00
Alexandre Gomes Gaigalas
e2b6138bf6 Add PublicDomainSuffix Rule
- List will be auto-updated from https://publicsuffix.org/list/public_suffix_list.dat
 - Updated AbstractSearcher rules to be case insensitive
 - Updated PR creator bots
 - Docs and tests
2023-02-19 00:19:10 -03:00
Alexandre Gomes Gaigalas
8cafa3f298 Drop PHP 7.4 support 2023-02-19 00:19:10 -03:00
dependabot[bot]
7776652c85
Bump actions/checkout from 2 to 3 (#1399)
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-15 04:05:27 +00:00
dependabot[bot]
a96614b5a6
Bump codecov/codecov-action from 1 to 3 (#1398)
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 1 to 3.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v1...v3)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-15 04:04:53 +00:00
Alexandre Gomes Gaigalas
f080f7da08 Improve auto-updaters and pull requesters, auto-tld fix 2023-02-15 00:49:09 -03:00
Alexandre Gomes Gaigalas
8b3c607d03 Update peter-evans/create-pull-request@v4 2023-02-15 00:35:36 -03:00
Alexandre Gomes Gaigalas
74dee73f65 Update updater workflows, remove countries outside ISO-3366-2, cleanup 2023-02-15 00:29:10 -03:00
Alexandre Gomes Gaigalas
15f148da24 Dusting off. See CHANGELOG.md for more details on this commit 2023-02-13 03:59:11 -03:00
Henrique Moody
745a5712eb
Revert "Use "sokil/php-isocodes" on CurrencyCode"
This reverts commit f9b9dd21f9.
2021-03-19 15:12:44 +01:00
Henrique Moody
b78f602f0e
Revert "Use "sokil/php-isocodes" on LanguageCode"
This reverts commit 5450ef86a8.
2021-03-19 15:12:44 +01:00
Henrique Moody
5450ef86a8
Use "sokil/php-isocodes" on LanguageCode
Since we already have that library as a dependency of our repository, it
makes sense to use it as a source of language codes instead of keeping a
list of currencies ourselves.

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2021-02-06 15:53:11 +01:00
Henrique Moody
f9b9dd21f9
Use "sokil/php-isocodes" on CurrencyCode
Since "sokil/php-isocodes" is a dependency of our repository already, it
makes sense to use it as a source of currency codes instead of keeping a
list of currencies ourselves.

By using that library, we can also validate currency codes using
different sets.

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2021-02-06 15:52:40 +01:00
Henrique Moody
f1be7302fc
Use the last MINOR version in updaters
We have three workflows that automatically update the code. They are
using version 2.0 as a base to create their changes. We need to update
that because the last supported version is 2.1.

Since I do not think it is a good idea to change code every time a new
MINOR version is released, I moved that value to a repository secret.

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2021-02-06 13:02:07 +01:00
Henrique Moody
f53b77a186
Add support for PHP 8.0
We already supported PHP 8.0 as our constrains in the "composer.json"
file was ">=7.3", but we were not testing it before.

Because of that, I found a bug on "EndsWith" which is fixed now.

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2020-08-28 08:53:41 +02:00
Henrique Moody
a65980ca45
Remove PHP 8.0 from the build matrix
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2020-08-27 19:22:13 +02:00
Henrique Moody
80ff37ca7f
Configure continuous integration with GitHub actions
This commit will also remove Travis and Scrutinizer and will configure
Codecov as a code coverage tool.

A few changes in the PHPUnit configuration already had to be made
before, but became more visible now. They're along with this commit.

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2020-08-27 19:06:37 +02:00
Henrique Moody
3be622a9fa
Configure GitHub workflow to update top-level domains
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2020-05-26 19:19:25 +02:00