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

Automatically activate --logger-github in github CI #1560

Closed
mfn opened this issue Aug 23, 2021 · 4 comments · Fixed by #1645
Closed

Automatically activate --logger-github in github CI #1560

mfn opened this issue Aug 23, 2021 · 4 comments · Fixed by #1645
Labels
DX Developer Experience Feature Request

Comments

@mfn
Copy link
Contributor

mfn commented Aug 23, 2021

I've come up with an infection script / command line combination I would like to use locally as well as on GHA CI.

However in github CI I want to add --logger-github but not locally.

No I know I can find ways to do this, but I learned to like that tools use library like https://github.com/OndraM/ci-detector and just auto-detect and activate, like e.g. phpstan did it: phpstan/phpstan-src@6fd85e3

I realized infection is already depending on this package

"ondram/ci-detector": "^3.3.0",
but it seems it's used for other cases .

What do you think, does something like this make sense?

@maks-rafalko maks-rafalko added DX Developer Experience Feature Request labels Jan 11, 2022
@maks-rafalko
Copy link
Member

Sounds good. The only question is do we then need --logger-github if it will be detected automatically?

@mfn
Copy link
Contributor Author

mfn commented Jan 11, 2022

I guess a reasonable behaviour would be:

  • nothing explicitly specified? detect it
  • otherwise the provided option is considered authoritative

does that make sense?

@maks-rafalko
Copy link
Member

Probably yes. Feel free to contribute

@mfn
Copy link
Contributor Author

mfn commented Jan 11, 2022

@maks-rafalko thanks, I gave it a shot with #1645

mfn added a commit to mfn/infection that referenced this issue Jan 31, 2022
maks-rafalko added a commit that referenced this issue May 15, 2022
…1645)

* Auto-detect Github Actions CI and activate github logger accordingly

Fixes #1560

* Remove explicit --logger-github flag, not that it is auto-detected in CI

* Lower min-msi so it passes

See feedback in #1645 (comment)

* Add doc to option itself that it's auto-detected

* Add `--logger-github=false` to E2E tests

* Import CiDetector class for const usage

* Restore accidently removed commits

* Fix incorrect condition after refactoring, fix tests

* Do not use deprecated `Safe\sprintf`

* Decrease MSI

* Try to catch all types of exception, including "sh: 1: git: not found"

* Simplify code, remove nested `elseif`. Disable GH logger for e2e tests

* Set env var differently

* Set env var differently 2

* Fix CS

Co-authored-by: maks-rafalko <b0rn@list.ru>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DX Developer Experience Feature Request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants