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

GitHub actions #512

Merged
merged 41 commits into from
Mar 23, 2021
Merged

Conversation

DeveloperMarius
Copy link
Contributor

Hey,

you asked about a CI when the user are creating a pull request or you are pushing.

I had to delete syntaxCheck="false", because it throws an error. But this option was useless according to the author of PHPUnit.

The Problem is, that the PHPUnit tests are printing the following:

PHPUnit 9.5.3 by Sebastian Bergmann and contributors.
Warning: No code coverage driver available
Warning: Your XML configuration validates against a deprecated schema.
Suggestion: Migrate your XML configuration using "--migrate-configuration"!
...............Middleware loaded!............................................ 59 / 59 (100%)

I'm not good with unit tests and don't know how to migrate this.
I think it has something to do that you are using Version 6 and github/ php-actions/phpunit@v2 is using 9.5.3. Maby you can specify the unittest version?

I will look more into it tomorrow. Maby you have an idea until then.

~ Marius

@skipperbent
Copy link
Owner

Hi Marius.

Nice thanks, I'm not good at it either - especially not integrating it up against GitHub. But at least now we're two brains working on it haha.

Maybe the error is because the project is using php-unit 6?

Try adding this phpunit.xml and see if it helps:

<?xml version="1.0" encoding="UTF-8"?>

<phpunit backupGlobals="false"
         backupStaticAttributes="false"
         colors="true"
         bootstrap="tests/bootstrap.php"
         convertErrorsToExceptions="true"
         convertNoticesToExceptions="true"
         convertWarningsToExceptions="true"
         processIsolation="false"
         stopOnFailure="false"
         syntaxCheck="false">
    <testsuites>
        <testsuite name="simple-php-router test suite">
            <directory>tests/Pecee/SimpleRouter/</directory>
        </testsuite>
    </testsuites>
    <filter>
        <whitelist processUncoveredFilesFromWhitelist="true">
            <directory suffix=".php">src</directory>
        </whitelist>
    </filter>
</phpunit>

@DeveloperMarius
Copy link
Contributor Author

I would try to update the phounit version tomorrow if this is okay for you?
Then I will see if the new version is accepted by GitHub Actions.

~ Marius

@skipperbent
Copy link
Owner

Yeah that's cool no stress - feel free to update it, I just couldn't be bothered because the version it was using was working fine. Was too afraid that I had to rewrite many of the tests and have enough work on my hands as it is. Maybe it will just work without having to rewrite the tests- haven't tried.

@DeveloperMarius
Copy link
Contributor Author

I know this feeling 😂
I will keep you up to date and try it.

@skipperbent
Copy link
Owner

Hey Marius.

Hope you haven't pulled out all your hair yet. Is the actions giving you trouble?

I don't know if it can be of any help- but this one of my project has GitHub actions and are also using an elder version of php-unit. Maybe you can copy paste some of the configuration and remove any MySQL reference to get it working? Not sure what kind of action it uses, I can't remember to be honest, but I know that GitHub runs the unit tests when pushing to the repository.

(files in the root directory, .yml + .xml)

https://github.com/skipperbent/pecee-pixie

/ Simon

@DeveloperMarius
Copy link
Contributor Author

Finally 🥳
It is working. I added tests for php 7.3 and 7.4 on windows and ubuntu with lowest and highest composer dependencies.
Please follow my composer.json changes and require PHP 7.3, because support for 7.2 expired a view months ago (https://www.php.net/supported-versions.php).
Also we need 7.3, because unit tests 8.5 requires it.

I also changed the phpunit.xml to the latest version (I think) because the filter tag was not supported or shown in the new docs.

I made a test if the tests would fail and they do. But currently every test return a success (look into the actions tab in my fork).

~ Marius

@DeveloperMarius
Copy link
Contributor Author

Hey,

I don't see any reference (a .github folder) to github actions in your project, but my version works now. Feel free to test it.

~ Marius

@skipperbent
Copy link
Owner

Nice work! Looks good! Was is difficult updating the php-unit?

I think the other project was before the github-actions had its own marketplace. Anyway as long as it's working and testing on push it's all good.

Would it be possible to downgrade to php version 7.1? At least for this upcoming release 4.3? I do want to upgrade the php-version, but if we update it now, some users might not get the update because they're stuck on 7.1. Remember often times production environments are using old tech because it cost $$ to upgrade their code.

@DeveloperMarius
Copy link
Contributor Author

PHPunit upgrade was okay, but to get into the GitHub Actions stuff was a bit difficult.
I will look into PHP 7.1 in a view hours and write you then.

@skipperbent
Copy link
Owner

PHPunit upgrade was okay, but to get into the GitHub Actions stuff was a bit difficult.
I will look into PHP 7.1 in a view hours and write you then.

Yeah i could imagine, they make it look so easy with their configuration - but in reality you need to know every little configuration parameter and read through tons of documentation.

Great, but if it's too much work we can just add this to the major release. I'm thinking i will start work on v5 once v4.3 is released.

@DeveloperMarius
Copy link
Contributor Author

Okay, PHP 7.1 is working now. I will create an other pull request for the next major update with the requirement of php 7.3.
You have to downgrade PHPUnit to 7, because it is the newsest version supporting php 7.1.

~ Marius

@skipperbent
Copy link
Owner

Wow, you're good. Tried setting up travis-ci - what nightmare 😄 Seems like there's some kind of php-bug, I get errors in test when running on travis but nothing locally. I can only get tests to semi-work when i set travis to use php 7.4.2 - but then it freezes during the tests.

@skipperbent
Copy link
Owner

Is it ready to merge?

@skipperbent
Copy link
Owner

The version is not that important.. as long as it's there. Lucikly the project is not really doing any advanced unit-testing that requires any special version of php-unit.

@DeveloperMarius
Copy link
Contributor Author

DeveloperMarius commented Mar 23, 2021

Okay, never worked with travis-ci.
Yes it is ready to merge 🥳🎉.

@skipperbent
Copy link
Owner

Okay, never worked with travis-ci.
Yes it is ready to merge 🥳🎉.

Me neither, it's just uphill with all that configuration... again nice work, so cool that you got it working! I'll merge 👍

@skipperbent skipperbent merged commit 22d5311 into skipperbent:v4-development Mar 23, 2021
@DeveloperMarius DeveloperMarius deleted the github-actions branch November 15, 2022 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants