-
Notifications
You must be signed in to change notification settings - Fork 34
ci: make failing tests fail the CI #155
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
Conversation
32787bb to
24b0f00
Compare
|
But there is an issue with
@gportay do you have an idea if it can be solved in GitHub Actions ? |
|
@florentsfl, Since it outputs something, I strongly think I guess |
|
It needs /dev to be mounted has well, with |
|
|
|
actions/runner#241 and https://github.com/gfx/example-github-actions-with-tty i’m gonna investigate that |
09226a0 to
d429e81
Compare
|
So there is this hacky solution to allocate a TTY using the |
I have no strong opinion about that script. If it works, go with it. I do not mind skipping the tests as well. I have not tested what OOS, Maybe we should do that kind of change for that test. |
|
|
35ef0c1 to
a6aa606
Compare
| local nc='\033[0m' | ||
| local c | ||
|
|
||
| # Only colorize a few terminal types |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest to test for NO_COLOR and to test if stdout is tty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added NO_COLOR and i tried [ -t 1 ] but it seems to fail in GH Actions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is definitely not a tty:
I strace tty from GitHub action, and I get:
ioctl(0, TCGETS, 0x7ffc276301d0) = -1 ENOTTY (Inappropriate ioctl for device)
So I was wrong with the /dev and /proc filesystems. and you were right with the script.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are pipes if I am correct:
+ test -t 0
+ echo 0 is a not tty
+ test -t 1
+ echo 1 is a not tty
+ test -t 2
+ echo 2 is a not tty
+ test -r /dev/stdin
+ echo /dev/stdin is readable
+ test -r /dev/stdout
+ echo /dev/stdout is readable
+ test -r /dev/stderr
+ echo /dev/stderr is readable
+ readlink /proc/self/fd/0
0 is a not tty
1 is a not tty
2 is a not tty
/dev/stdin is readable
/dev/stdout is readable
/dev/stderr is readable
pipe:[10230]
+ echo /proc/self/fd/0 is a symlink
/proc/self/fd/0 is a symlink
+ readlink /proc/self/fd/1
pipe:[10231]
+ echo /proc/self/fd/1 is a symlink
+ readlink /proc/self/fd/2
/proc/self/fd/1 is a symlink
pipe:[10232]
+ echo /proc/self/fd/2 is a symlink
/proc/self/fd/2 is a symlink
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i tried [ -t 1 ] but it seems to fail in GH Actions
By failing, I guess you mean you have no color if adding the test [ -t 1]?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes that was returning non colored text when adding this test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was normal since it is not a tty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok but GH Actions is able to render colors even not being a tty, so I thought the test was too restrictive
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed.
26ae49a to
6f9abfc
Compare
6f9abfc to
907026f
Compare
c1b6850 to
e681d4c
Compare
|
Thanks for the comments ! It should be good now |
deribaucourt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, maybe we should consider using a proper shell testing framework rather than defining coloration ourselves?
e681d4c to
52a540e
Compare
|
Yes, I took the colorize function from cukinia, but if you have an example of a framework we can use, why not ! |
|
LGTM, for what it worth. |
Currently, when a test is failing, the CI does not fail because the script does not detect correctly a failure. This commit makes the test of a failing test more explicit
This commit skips the tty test if it it runs in GitHub Actions because GitHub does not allocate a tty in any case
This commit makes it more explicit that some tests have been skipped
This colorize function makes the test report more clear, with easy to spot skipped and failed tests
52a540e to
419e5e3
Compare
|
@florentsfl We could use cukinia itself, or bats to run the tests in the future. |
Currently, when a test is failing, the CI does not fail because the script does not detect correctly a failure.
This commit makes the test of a failing test more explicit