elixir-mongo / mongodb

MongoDB driver for Elixir
Apache License 2.0
568 stars 157 forks source link

GitHub actions #370

Closed joeapearson closed 1 year ago

joeapearson commented 2 years ago

I've added support for matrix builds. Currently there is only one combination:

  1. Ubuntu latest
  2. MongoDB 4.4
  3. Elixir 1.12.3
  4. OTP 24.0.6

We can add more combinations later.

scottmessinger commented 2 years ago

I'm really excited about this!

For our app, we've been using this to start mongodb:


      - name: Start MongoDB
        uses: supercharge/mongodb-github-action@1.3.0
        with:
          mongodb-version: 4.0.27
          mongodb-replica-set: "replica-set"

I'm wondering if this might help solve the problem where the tests are failing b/c they can't connect to Mongodb.

joeapearson commented 2 years ago

I'm really excited about this!

Thanks I am too! I think it's going to help us a lot to accept changes going forward.

I'm wondering if this might help solve the problem where the tests are failing b/c they can't connect to Mongodb.

That might be the way we have to go.

For now I'm trying to go down the docker-compose approach because then there is a guaranteed identical environment in dev and CI.

I've nearly got it running on my machine (most of the tests pass too!).

It looks like:

  1. SSL tests are always disabled in test. Let's fix this one day. I propose not to fix this in this branch and create a separate issue.
  2. Docker test are always disabled in test. Similarly, I think this could be fixed in a separate issue but is less important IMO.

I'd like to report test coverage out too but that'll be a separate effort.

joeapearson commented 2 years ago

For our app, we've been using this to start mongodb:

Scott FYI I tried this and it did get further but since the supercharge action only creates a single member replicaset some of the tests that exercise different write concerns won't work.

joeapearson commented 2 years ago

@scottmessinger would you mind reviewing this please. There are a number of outstanding issues I suggest we tackle in separately:

  1. SSL tests are not exercised during CI (this has always been the case, they are disabled during CI)
  2. Socket tests are not exercised during CI (ditto)
  3. Test coverage is not reported as part of the process
  4. We only run tests with a single combination of Mongo 4.4, Elixir 1.12 etc.
  5. One test fails and I'm not sure why!
  6. The github action manually installs and starts Mongo at the specified version. The code is ugly. This would be fine except github actions appears to cache the ubuntu image between builds, such that we aren't guaranteed a clean build every time. My preference is to use docker-compose to solve this but...
  7. I abandoned my docker-compose work for now because I just don't have time to make it happen yet. The tests (see test_helper.exs expects to be able to use the mongo CLI directly in order to perform some manual setup. I don't like this but it is tricky to work around.
  8. The code-quality (particularly credo) has a bunch of issues that ought to be fixed. Not a huge issue but the consistency makes it easier for folks to work on.

If you're happy I suggest you merge this in, despite it not being perfect (unless you disagree of course!). We'll have some validation going forward and we can pick these issues off one by one. Then I'll create an issue for each of the points above; some of them are excellent starter issues so we can take advantage of some of the recent enthusiasm for contributions we've had too.

ankhers commented 2 years ago

It is mostly because every push may not really need it. If you are experimenting with some new feature and wanted to share some code or a POC, it is less useful to show that tests are (maybe) failing.

But I will let you and Scott decide what is best for this repository. I just wanted to share how I generally set things up.

ankhers commented 2 years ago

A simple first step could be to decide the upper and lower bounds of both Elixir and OTP versions you want to test against and just have the matrix be those two sets. If you want to really make sure everything works, you can install as many versions between those bounds that you want to test against.

ankhers commented 2 years ago

This is fair. I believe there was one in the past but it may be gone now. I think the number of people developing on windows is fairly low as is.

joeapearson commented 2 years ago

A simple first step could be to decide the upper and lower bounds of both Elixir and OTP versions you want to test against

Yes agreed. Again my preference is to start as basic as possible and then gradually expand our "official support" as we get used to taking care of this repo. I started a discussion about that in #372 .

Thanks very much for the unexpected code review by the way, it was my understanding that you'd preferred to put the mongo work down for now otherwise I would have asked you directly.

joeapearson commented 2 years ago

This is fair. I believe there was one in the past but it may be gone now. I think the number of people developing on windows is fairly low as is.

I'm on a mac but when I have had to use Windows it's maddening to find that it's not been properly taken care of. I think this should be a separate issue though.

ankhers commented 2 years ago

Thanks very much for the unexpected code review by the way, it was my understanding that you'd preferred to put the mongo work down for now otherwise I would have asked you directly.

My pleasure. Part of it is I am in the process of modifying the GH actions at $DAYJOB, so I figured I could pitch in a bit here since it is all still fresh in my head.

It's not that I am totally putting this project down, it is just that I don't personally use mongo in any of my own projects at the moment, so I may not be the best person to decide direction of the packages. However, I am still more than happy to pitch in where it makes sense. I think that is mostly in code reviews or if you or anyone else has have questions about the code, I am more than happy to try and help out.

YasirAsar commented 2 years ago

I'm so happy to see this repo active after long time. Thanks guys!!!

scottmessinger commented 2 years ago

@joeapearson I just cut a release! https://hex.pm/packages/mongodb/1.0.0-beta.1

The next step is to get this in before we hit 1.0.0.

etroynov commented 2 years ago

@joeapearson

any news?

scottmessinger commented 1 year ago

@etroynov It's shipped!