-
Notifications
You must be signed in to change notification settings - Fork 532
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
166 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
2.7.7 | ||
3.0.5 | ||
3.1.3 | ||
3.2.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
xargs -L 1 ./test_ruby < ruby_versions.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
cd /src | ||
bundle update; | ||
|
||
RUBY_VERSION=$(ruby -v); | ||
|
||
echo "Testing With MySQL and Ruby $RUBY_VERSION"; | ||
export DATABASE_URL="mysql2://test:password@mysql:3306/test" | ||
bundle exec rake test; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
cd /src | ||
bundle update; | ||
|
||
RUBY_VERSION=$(ruby -v); | ||
|
||
echo "Testing With PostgreSQL and Ruby $RUBY_VERSION"; | ||
export DATABASE_URL="postgresql://postgres:password@postgres:5432/test" | ||
bundle exec rake test; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
|
||
rbenv global $1; | ||
|
||
../test_postgresql | ||
../test_mysql | ||
../test_sqlite |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
cd /src | ||
bundle update; | ||
|
||
RUBY_VERSION=$(ruby -v); | ||
|
||
echo "Testing With SQLite and Ruby $RUBY_VERSION"; | ||
export DATABASE_URL="sqlite3:test_db" | ||
bundle exec rake test; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
FROM buildpack-deps:bullseye | ||
|
||
# Install rbenv | ||
RUN git clone https://github.com/sstephenson/rbenv.git /root/.rbenv | ||
RUN git clone https://github.com/sstephenson/ruby-build.git /root/.rbenv/plugins/ruby-build | ||
RUN /root/.rbenv/plugins/ruby-build/install.sh | ||
ENV PATH /root/.rbenv/bin:/root/.rbenv/shims:$PATH | ||
RUN echo 'eval "$(rbenv init -)"' >> /etc/profile.d/rbenv.sh # or /etc/profile | ||
RUN echo 'eval "$(rbenv init -)"' >> .bashrc | ||
|
||
# Install supported ruby versions | ||
RUN echo 'gem: --no-document' >> ~/.gemrc | ||
|
||
COPY .docker/ruby_versions.txt / | ||
RUN xargs -I % sh -c 'rbenv install %; rbenv global %; gem install bundler' < ruby_versions.txt | ||
RUN rbenv rehash | ||
|
||
# COPY just enough to bundle. This allows for most code changes without needing to reinstall all gems | ||
RUN mkdir src | ||
COPY Gemfile jsonapi-resources.gemspec Rakefile ./src/ | ||
COPY lib/jsonapi/resources/version.rb ./src/lib/jsonapi/resources/ | ||
# This will run bundle install for each ruby version and leave the global version set as the last one. | ||
# So we can control the default ruby version with the order in the ruby_versions.txt file, with last being the default | ||
RUN xargs -I % sh -c 'cd src; rbenv global %; bundle install' < /ruby_versions.txt | ||
|
||
# Scripts | ||
COPY .docker/scripts/* / | ||
RUN chmod +x /test_* | ||
|
||
# COPY in the rest of the project | ||
COPY lib/ ./src/lib | ||
COPY locales/ ./src/locales | ||
COPY test/ ./src/test | ||
RUN ls -la | ||
|
||
CMD ["/test_all"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
version: "3.9" | ||
|
||
networks: | ||
back: | ||
|
||
services: | ||
postgres: | ||
image: postgres:latest | ||
ports: | ||
- "5432" | ||
networks: | ||
back: | ||
environment: | ||
- POSTGRES_PASSWORD=password | ||
- POSTGRES_DB=test | ||
healthcheck: | ||
test: [ "CMD-SHELL", "pg_isready -U postgres" ] | ||
interval: 2s | ||
retries: 15 | ||
|
||
mysql: | ||
image: mysql:latest | ||
command: --default-authentication-plugin=mysql_native_password | ||
ports: | ||
- 3306 | ||
networks: | ||
- back | ||
environment: | ||
- MYSQL_DATABASE=test | ||
- MYSQL_USER=test | ||
- MYSQL_PASSWORD=password | ||
- MYSQL_ROOT_PASSWORD=password | ||
healthcheck: | ||
test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ] | ||
interval: 2s | ||
retries: 15 | ||
|
||
tests: | ||
image: jr_tests:latest | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
networks: | ||
- back | ||
depends_on: | ||
postgres: | ||
condition: service_healthy | ||
mysql: | ||
condition: service_healthy |