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

ci: move phpunit-nodb to actions #39734

Closed
wants to merge 5 commits into from
Closed

Conversation

kesselb
Copy link
Contributor

@kesselb kesselb commented Aug 6, 2023

Learnings

Learning 1

phpunit -c autotest-external only runs tests for enable apps.

This seems to make sense, but it is not obvious and does not make the CI configuration any easier.

The following apps are part of the server repository and are not enabled by default.
Therefore, they must be enabled for CI runs.

admin_audit
encryption
files_external
user_ldap

Learning 2

phpunit --list-tests lists the available tests.

Unfortunately, it does not list tests from dynamically enabled apps.
I assume that's related to the way the tests are added.

TODO

  • CI
  • Decide: Run nodb tests for PHP 8.0, 8.1 and 8.2 or only PHP 8.0 (like on drone)
  • Review
  • Follow-up to remove nodb from drone
  • Follow-up to exclude PRIMARY-azure,PRIMARY-s3,PRIMARY-swift
  • Follow-up to add php 8.3 (after Allow PHP 8.3 #40630)
  • Ask Côme if the additional apps should be enabled for phpunit-32bits too

Migration

Round 1:

  • No changes to test suite
Actions Drone
Tests executed 10554 10861
Warnings 28 25
Skipped 76 96
PHPUnit 9.6.10 9.5.28

Warnings on Actions but not on Drone:

26) OCA\Theming\Tests\IconBuilderTest::testGetFaviconNotFound
Expecting E_WARNING and E_USER_WARNING is deprecated and will no longer be possible in PHPUnit 10.

27) OCA\Theming\Tests\IconBuilderTest::testGetTouchIconNotFound
Expecting E_WARNING and E_USER_WARNING is deprecated and will no longer be possible in PHPUnit 10.

28) OCA\Theming\Tests\IconBuilderTest::testColorSvgNotFound
Expecting E_WARNING and E_USER_WARNING is deprecated and will no longer be possible in PHPUnit 10.

expectWarning is deprecated since PHPUnit 9.6

Round 2:

  • Exclude PRIMARY-azure,PRIMARY-s3,PRIMARY-swift (they are skipped anyway because the configuration is missing)
  • Added redis extension
Actions Drone
Tests executed 10524 10861
Warnings 28 25
Skipped 46 96
PHPUnit 9.6.10 9.5.28

Round 3:

  • Added ldap extension
  • Print list of tests to be executed
Actions Drone
Tests executed 10524 10861
Warnings 28 25
Skipped 46 96
PHPUnit 9.6.10 9.5.28

Round 4:

Actions Drone
Tests executed 10831 10861
Assertions 23081 23020
Warnings 28 25
Skipped 46 96
PHPUnit 9.6.10 9.5.28

Actions: https://github.com/nextcloud/server/actions/runs/5777400665/job/15657527803
Drone: https://drone.nextcloud.com/nextcloud/server/38222/9/4

Round 5:

  • Include test suite PRIMARY-azure,PRIMARY-s3,PRIMARY-swift again because this cleanup should be done as follow up.
Actions Drone
Tests executed 10861 10861
Assertions 23081 23020
Warnings 28 25
Skipped 76 96
PHPUnit 9.6.10 9.5.28

Actions: https://github.com/nextcloud/server/actions/runs/5777508182/job/15657761644
Drone: https://drone.nextcloud.com/nextcloud/server/38223/9/4

Round 6:

  • Squashed the commits
  • Removed the --list-tests step
Actions Drone
Tests executed 10861 10861
Assertions 23081 23020
Warnings 28 25
Skipped 76 96
PHPUnit 9.6.10 9.5.28

Actions: https://github.com/nextcloud/server/actions/runs/5777613755/job/15657986497
Drone: https://drone.nextcloud.com/nextcloud/server/38224/9/4

Checklist

@kesselb kesselb added the 2. developing Work in progress label Aug 6, 2023
@kesselb kesselb self-assigned this Aug 6, 2023
@kesselb kesselb changed the title Phpunit nodb to gh actions ci: move phpunit-nodb to actions Aug 6, 2023
@kesselb kesselb marked this pull request as ready for review August 6, 2023 16:33
@kesselb kesselb added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Aug 6, 2023
@skjnldsv
Copy link
Member

skjnldsv commented Aug 6, 2023

I did some work in this one: skjnldsv#13
If you want to have a look if anything is worth taking from

@kesselb kesselb force-pushed the phpunit-nodb-to-gh-actions branch 2 times, most recently from ee8f13e to 58c960c Compare August 6, 2023 20:45

on:
pull_request:
paths:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kesselb
Copy link
Contributor Author

kesselb commented Aug 6, 2023

If you want to have a look if anything is worth taking from

Thanks for letting me know, looks very nice 👍

I added the paths filter and when-unrelated workflow, hopefully it will work.

Also tried adding the run script to composer.json, but that didn't work (in the workflow) because phpunit-autotest.xml must be called from the tests/ folder because the paths are relative.

@come-nc
Copy link
Contributor

come-nc commented Aug 14, 2023

I’m not sure if you can use ini-file: development along with ini-values: but if yes it would make sure the tests are running without php deprecation warnings.

@kesselb
Copy link
Contributor Author

kesselb commented Aug 14, 2023

I’m not sure if you can use ini-file: development along with ini-values: but if yes it would make sure the tests are running without php deprecation warnings.

Thank you, good to know 👍

I don't mind the deprecation warnings, just documented them to explain the difference in the test outcome.
Do you want me to set ini-file to development?

@come-nc
Copy link
Contributor

come-nc commented Aug 14, 2023

I’m not sure if you can use ini-file: development along with ini-values: but if yes it would make sure the tests are running without php deprecation warnings.

Thank you, good to know +1

I don't mind the deprecation warnings, just documented them to explain the difference in the test outcome. Do you want me to set ini-file to development?

Yes please, I tested in #39796 for 32 bits CI and it does work with ini-values.
The CI should run without deprecation warnings (so it should fail on those if there are any).

@kesselb
Copy link
Contributor Author

kesselb commented Aug 14, 2023

Make sense 👍

I first thought you were referring to the PHPUnit deprecation warnings, but you wanted to let me know that setup-php uses the php.ini-production by default and therefore error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT.

@kesselb kesselb removed the 3. to review Waiting for reviews label Aug 15, 2023
@kesselb kesselb added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Sep 29, 2023
@kesselb
Copy link
Contributor Author

kesselb commented Sep 29, 2023

Ready to review 🎉

Comment on lines 5 to 15
paths:
- '!**.json'
- 'package.json'
- 'package-lock.json'
- '!**.sh'
- '!**.yml'
- '!**.xml'
- '!**.php'
- '!**/tests/**'
- '!3rdparty'
- '!apps/theming/css'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have to use the quirk from https://github.com/nextcloud/.github/pull/230/files otherwise this executes way too often

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point.

I think the paths filter for the nodb-when-unrelated workflow is wrong anyway.
It only excludes paths, but does not include anything and will therefore never run 🙈

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but does not include anything and will therefore never run 🙈

Yeah, I debugged this last week in https://github.com/nickvergessen/turbo-lamp/pulls and the pattern in https://github.com/nextcloud/.github/pull/230/files is what we need to use. So you need to paths-ignore the same thing in unrelated you require in the actual job and then add the work around with the second exclude list, to make sure the fake summary does not run when the real summary should be used.

Copy link
Contributor Author

@kesselb kesselb Sep 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about 44b5b7a?

https://github.com/marketplace/actions/paths-changes-filter is similar to our drone-run-php-tests.sh script.

The workflow is more complicated because we have a changes job, a conditional "main" job and the summary job with a check if the conditional job was required or not. This approach works without the when-unreated workflow.

I think not having two workflows is a good trade-off for the higher complexity.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.github/workflows/nodb.yml Outdated Show resolved Hide resolved
@kesselb kesselb force-pushed the phpunit-nodb-to-gh-actions branch 2 times, most recently from 44b5b7a to c7a98a3 Compare October 2, 2023 14:09
@come-nc
Copy link
Contributor

come-nc commented Oct 9, 2023

memcache and redis tests are skipped, not sure if we should ignore or configure those, or if they should be tested in their own job?

@kesselb
Copy link
Contributor Author

kesselb commented Oct 9, 2023

memcache and redis tests are skipped, not sure if we should ignore or configure those, or if they should be tested in their own job?

I think memcache and redis have another job in drone.
The memcache and redis tests are also skipped on drone.

@come-nc
Copy link
Contributor

come-nc commented Oct 16, 2023

memcache and redis tests are skipped, not sure if we should ignore or configure those, or if they should be tested in their own job?

I think memcache and redis have another job in drone. The memcache and redis tests are also skipped on drone.

Yes but could they be added to a group that we add to the exclude-groups in https://github.com/nextcloud/server/pull/39734/files#diff-2c10cc6204050ae8a99af53744687db4d3690d7157685a9a221fba3bb78e6946R86
That would clean up the output of the job, making it easier to see failures/warnings.

@kesselb
Copy link
Contributor Author

kesselb commented Oct 16, 2023

Yes but could they be added to a group that we add to the exclude-groups in #39734 (files)
That would clean up the output of the job, making it easier to see failures/warnings.

Done. You already added the groups in 2d8e696 🎉

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
@kesselb
Copy link
Contributor Author

kesselb commented Oct 26, 2023

Replaced by #41003

@kesselb kesselb closed this Oct 26, 2023
@kesselb kesselb deleted the phpunit-nodb-to-gh-actions branch October 26, 2023 10:59
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.

None yet

5 participants