gdcc / pyDataverse

Python module for Dataverse Software (dataverse.org).
http://pydataverse.readthedocs.io/
MIT License
63 stars 41 forks source link

Local testing of pyDataverse #169

Closed JR-1991 closed 2 months ago

JR-1991 commented 6 months ago

In yesterday's community call about pyDataverse, a question was raised whether to supply a Dockerfile and instruction to run tests locally.

The current CI/CD pipeline already makes use of the containerised version of Dataverse and thus it may be worth looking into act which runs GitHub actions locally. I think, that by using the latter, we can make sure that local tests are carried out in exactly the same way as intended.

@pdurbin @poikilotherm and anyone who is interested, what are your thoughts?

pdurbin commented 6 months ago

My first thought is that I'm pretty sure @GPortas has used act and likes it. Also, as the primary maintainer of js-dataverse, he might be interested in something similar.

I don't know if you both plan to attend tomorrow's container meeting but we could certainly talk about it then (or a future meeting).

GPortas commented 6 months ago

@pdurbin I've tried act in the past, but ran into some issues and opted to use fork repositories to test actions instead. That is how I usually test actions and it works well for me.

We can talk more about it tomorrow at the ct meeting.

JR-1991 commented 6 months ago

@GPortas thanks for the information! I was thinking about using act rather as a way to execute pyDataverse tests locally, but if you've had already issues I think it may not be perfectly suited as a general solution to this.

@pdurbin @poikilotherm would it make sense to put the procedure from the action into a shell script users can run to spin up an installation? Or should we rather advise to the quickstart guide?

pdurbin commented 6 months ago

Hmm, I'm interested in some sort of script or something to let people spin up Dataverse for evaluation purposes. I would like it to not required Java or Maven. Ideally, it would work on Mac, Linux, and Windows.

It should boil down to docker compose -f docker-compose-dev.yml up as explained at https://guides.dataverse.org/en/6.1/container/dev-usage.html#running

I'm not sure if the action can help with this use case, but it's the first thing that comes to mind. No need to focus on this use case!

JR-1991 commented 6 months ago

That would be the ideal case. The only thing that needs to be taken care of is to retrieve the API_Token and BASE_URL from within the containers. This is currently handled within the action.yml by parsing the exposed env:

grep "API_TOKEN" "${RUNNER_TEMP}/dv/bootstrap.exposed.env"

One possible solution could be to create an extended docker-compose-dev.yml file that would run all the tests. I will start working on a draft PR to see if this is feasible 🙌

JR-1991 commented 6 months ago

@pdurbin added a pull request #172 using the docker compose approach 🙌