You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Feature][DX] Add Docker Configuration for Development (#109)
* Fixes#120
* Add docker configuration for development
This makes it easier to run the test suite in your local dev environment
* Add a development section for contributors
This should make it easier for people to set up the library and run the test suite within Docker
* Added ruby service to make it easier to get started with your contribution
* Update password to match Docker configuration
* Removed outdated docker-compose file
* Use older mysql to avoid trilogy error, fix docker compose and instructions, mount code for easier development
* Update readme to point to CONTRIBUTE.md file
* Run ./bin/setup so that we have the config file in place for tests
* Relax dependency
* Add a line about the Docker + DX change
---------
Co-authored-by: Ariel Juodziukynas <arieljuod@gmail.com>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,7 @@
3
3
* Provide a 'Changelog' link on Rubygems: https://github.com/DatabaseCleaner/database_cleaner-active_record/pull/114
4
4
* Fix bundling and CONTRIBUTE.md instructions: https://github.com/DatabaseCleaner/database_cleaner-active_record/pull/123
5
5
* Fix order of arguments in `truncate_tables` expectation https://github.com/DatabaseCleaner/database_cleaner-active_record/pull/124
6
+
* Add Docker to make it easier to run tests locally for maintainers and contributors https://github.com/DatabaseCleaner/database_cleaner-active_record/pull/109
Copy file name to clipboardExpand all lines: CONTRIBUTE.md
+16-3Lines changed: 16 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,15 +12,28 @@ upstream:
12
12
13
13
The gem uses Appraisal to configure different Gemfiles to test different Rails versions.
14
14
15
-
- You can run all the databases through docker if needed with `docker compose up` (you can also have them running on your system, just comment out the ones you don't need from the `docker-compose.yml` file)
16
-
- Copy `spec/support/sample.config.yml` to `spec/support/config.yml` and edit it
15
+
### Run tests without Docker (or using Docker only for the databases)
16
+
17
+
- You can run all the databases through docker if needed with `docker compose -f docker-compose.db.yml up` (you can also have them running on your system, just comment out the ones you don't need from the `docker-compose.db.yml` file)
18
+
- Copy `spec/support/sample.config.yml` to `spec/support/config.yml` and edit it as needed
17
19
-`BUNDLE_GEMFILE=gemfiles/rails_6.1.gemfile bundle install` (change `6.1` with any version from the `gemfiles` directory)
Note that if you don't have all the supported databases installed and running,
21
23
some tests will fail.
22
24
23
-
> Note that you can check the `.github/workflows/ci.yml` file for different combinations of Ruby and Rails that are expected to work
25
+
> Check the `.github/workflows/ci.yml` file for different combinations of Ruby and Rails that are expected to work
26
+
27
+
### Run tests with Docker
28
+
29
+
- Open `docker-compose.yml` and configure the Ruby version and Gemfile file to use
30
+
- Copy `spec/support/sample.docker.config.yml` to `spec/support/config.yml` (not this config file is specific for the Docker setup)
31
+
- Run `docker compose up` to start the container, run the tests, and exit
32
+
- Run `docker compose run ruby bash` to open `bash` inside the container for more control, run `rake` to run the tests
33
+
34
+
> Note that the code is mounted inside the docker container, so changes in the container will reflect in the code. There's no need to re-build the container for code changes, but changing the Ruby version or Gemfile in the docker-compose.yml will require a container re-build with `docker compose build --no-cache`
35
+
36
+
> Check the `.github/workflows/ci.yml` file for different combinations of Ruby and Rails that are expected to work
0 commit comments