-
Notifications
You must be signed in to change notification settings - Fork 28
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
6 changed files
with
106 additions
and
35 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 |
---|---|---|
|
@@ -6,3 +6,4 @@ pkg/* | |
.ruby-version | ||
.tool-versions | ||
coverage | ||
.standard_todo.yml |
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,60 @@ | ||
FROM bash AS base | ||
|
||
ENV LANG C.UTF-8 | ||
ENV LC_ALL C.UTF-8 | ||
ENV ASDF_DIR=/root/.asdf \ | ||
GEM_HOME=/root/gems \ | ||
PATH=/root/gems/bin:$PATH | ||
|
||
# Install dependencies | ||
RUN apk update && \ | ||
apk add --no-cache \ | ||
build-base \ | ||
git \ | ||
libffi-dev \ | ||
openssl-dev \ | ||
readline-dev \ | ||
tzdata \ | ||
yaml-dev \ | ||
zlib-dev | ||
|
||
RUN git clone https://github.com/asdf-vm/asdf.git /root/.asdf --branch v0.14.0 && \ | ||
. "$ASDF_DIR/asdf.sh" && \ | ||
asdf plugin add ruby | ||
|
||
## For parallelism, build in stages | ||
# Ruby 3.1.4 | ||
FROM base AS ruby-3.1.4 | ||
RUN . "$ASDF_DIR/asdf.sh" && \ | ||
asdf install ruby 3.1.4 && \ | ||
asdf global ruby 3.1.4 && \ | ||
gem install bundler | ||
|
||
# Ruby 3.2.2 | ||
FROM base AS ruby-3.2.2 | ||
RUN . "$ASDF_DIR/asdf.sh" && \ | ||
asdf install ruby 3.2.2 && \ | ||
asdf global ruby 3.2.2 && \ | ||
gem install bundler | ||
|
||
# Final Image with Application Code | ||
FROM base AS final | ||
|
||
ENV GEM_HOME=/root/gems \ | ||
PATH=/root/gems/bin:$PATH | ||
|
||
# Copy and merge installed ASDF directory from ruby versions | ||
COPY --from=ruby-3.1.4 /root/.asdf /tmp/.asdf-3.1.4 | ||
COPY --from=ruby-3.2.2 /root/.asdf /tmp/.asdf-3.2.2 | ||
RUN cp -rn /tmp/.asdf-3.1.4/* /root/.asdf && rm -rf /tmp/.asdf-3.1.4 | ||
RUN cp -rn /tmp/.asdf-3.2.2/* /root/.asdf && rm -rf /tmp/.asdf-3.2.2 | ||
|
||
WORKDIR /app | ||
|
||
COPY gemfiles gemfiles | ||
COPY lib lib | ||
COPY spec spec | ||
COPY cached_resource.gemspec Gemfile Rakefile scripts/docker/run_tests.sh . | ||
|
||
# Run tests or any other final commands | ||
CMD ["./run_tests.sh"] |
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
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,28 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
# Matrix of Ruby and Rails versions | ||
RUBY_VERSIONS="3.1.4 3.2.2" | ||
RAILS_VERSIONS="6.1 7.0 7.1" | ||
|
||
# Iterate over Ruby versions | ||
for RUBY_VERSION in $RUBY_VERSIONS; do | ||
. "$ASDF_DIR/asdf.sh" | ||
asdf local ruby $RUBY_VERSION | ||
|
||
# Iterate over Rails versions | ||
for RAILS_VERSION in $RAILS_VERSIONS; do | ||
# Set the Rails version environment variable | ||
export TEST_RAILS_VERSION=$RAILS_VERSION | ||
echo "Testing with Ruby $RUBY_VERSION and Rails $RAILS_VERSION" | ||
|
||
# Install gems | ||
bundle install | ||
|
||
# Run tests | ||
bundle exec rspec | ||
done | ||
done | ||
|
||
bundle exec standardrb --generate-todo |
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