Gradle Build Error in Github Action

I am getting gradle build error during unit test of my project, every time I build using github actions. But same gradle build is passing in travis ci. Which is very unusual. Could you please help me find out why github action build is failing?

Also, I can’t reproduce this test failure in any other linux environment with similar configuration.

Thank you for your feedback. We found the following error through the workflow log, so please check whether this field exists in your code.
org.dizitart.no2.exceptions.ValidationException: no such field 'employeeNote.text' for type org.dizitart.no2.repository.data.Employee

Hi @niconbw thanks for reply. The field is there. As I mentioned, same commit is building fine in Travis, but not in github action. You can check the travis build log, same commit is working just fine. I am not sure, why github action environment is behaving like this.

We tested with different runs, the same error message could be reproduced when we used ubuntu-20.04 version as yours.

The Ubuntu 20.04 virtual environment is currently provided as a preview only.
The "ubuntu-latest" YAML workflow label still uses the Ubuntu 18.04 virtual environment.

But tested with ubuntu-18.04(ubuntu-latest), it works fine.


Additionally, we check the travis.yml, the runs is Ubuntu 16.04(default).

So we think that the issue is due to the different runs in different forum.
We recommend that you could use ubuntu-18.04 in your workflow file.

Thanks for your understanding.

Thanks for your reply. I’ll test this on 18.04. But don’t you think it is unusual that a java field is visible in certain version of linux in the workflow where jdk version remains same? This kind of scenario should never happen in a java program on different os.

Why this scenario is even coming up in github action? A java program should behave uniformly irrespective of os in a given jdk.

I tried with ubuntu-16.04, and the build passed. Still this behavior is very odd. There is nothing ubuntu version specific in the code I can assure that. I am very curious to know the reason for this bizarre behavior.

Hi, I recommend that you could build in local machine with ubuntu-18.04 or ubuntu-20.04 to check if the scenario is the same as in GitHub action.

My development environment is ubuntu-20.04. I checked in ubuntu-18.04 also, but I have not came across this issue like Github action. This is where my confusion lies. Why specially in github action environment it is behaving like this?

You could set the runs as self-hosted run in workflow file and check if it has the same scenario as in local machine.
And share the snapshot of the relevant logs with us.
Thanks for your time.

I don’t have any self-hosted machine to run the workflow. Is it possible to run the gradle build inside a docker container using github action?

If so could you please point me to any existing doc or example project? And also how do I import github secrets inside docker container?

You could refer the document to add a linux self hosted runner:

If you want run the gradle build in a docker container, see this document to create a docker container action.
And here a ticket may help you too.

I have setup self-hosted runner in my local machine and the gradle build passed. Which log do you want me to send?

Here is the build - https://github.com/nitrite/nitrite-java/actions/runs/218557657

I found out that some static variable was messing with the test configuration. Somehow it never came across in local build or travis build. After the correction, github action build seems to be passing. Thanks for all the support.