Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to React 0.14 #1842

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
run: docker-compose up -d selenium

- name: Run specs (capybara)
run: docker-compose run --rm -e RAILS_ENV=test -e COVERAGE=true -e FEATURES=true -e SELENIUM_URL web bundle exec rspec
run: docker-compose run --rm -e RAILS_ENV=test -e COVERAGE=true -e FEATURES=true -e SELENIUM_URL web bundle exec rspec --format=documentation

- name: Run specs (cucumber)
run: docker-compose run --rm -e RAILS_ENV=test -e COVERAGE=true -e SELENIUM_URL web bundle exec cucumber
Expand All @@ -78,6 +78,13 @@ jobs:
path: resultset.*.json
retention-days: 1

- uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: capybara_screenshots
path: tmp/capybara/*
retention-days: 7

analysis:
runs-on: ubuntu-latest
needs:
Expand All @@ -94,7 +101,7 @@ jobs:
- uses: actions/download-artifact@v3
with:
name: integration_tests_coverage
- run: docker-compose run --no-deps --rm web rake coverage:report
- run: docker-compose run --no-deps --rm web bundle exec rails coverage:report

- uses: actions/upload-artifact@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.3.8
2.4.10
31 changes: 17 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM instedd/nginx-rails:2.3
FROM ruby:2.4

# Cleanup expired Let's Encrypt CA (Sept 30, 2021)
RUN sed -i '/^mozilla\/DST_Root_CA_X3/s/^/!/' /etc/ca-certificates.conf && update-ca-certificates -f
Expand All @@ -17,41 +17,44 @@ RUN curl -L https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/
dpkg -i wkhtmltopdf.deb && \
rm -f wkhtmltopdf.deb

## Create a user for the web app.
RUN \
addgroup --gid 9999 app && \
adduser --uid 9999 --gid 9999 --disabled-password --gecos "Application" app && \
usermod -L app
# Create a user for the web app.
RUN addgroup --gid 9999 app && \
adduser --uid 9999 --gid 9999 --disabled-password --gecos "Application" app && \
usermod -L app

# Application directory
RUN mkdir /app
WORKDIR /app

# Configuration
ARG gemfile=Gemfile
ENV BUNDLE_GEMFILE=${gemfile}
ENV POIROT_STDOUT true
ENV POIROT_SUPPRESS_RAILS_LOG true
ENV PUMA_OPTIONS "--preload -w 4"
ENV PUMA_OPTIONS "--preload -w 4 -p 3000"
ENV NNDD_VERSION "cdx-0.11-pre7"
ENV RAILS_ENV=production

# Install gem bundle
COPY Gemfile* cdx.gemspec cdx-api-elasticsearch.gemspec /app/
COPY deps/ /app/deps/

RUN bundle install --jobs 8 --deployment --without development test

# Install the application
ADD . /app

# Precompile assets
RUN bundle exec rake assets:precompile RAILS_ENV=production
RUN bundle exec rake assets:precompile RAILS_ENV=${RAILS_ENV}

# Download NNDD
RUN \
mkdir -p /app/public/ && \
curl -L https://github.com/instedd/notifiable-diseases/releases/download/$NNDD_VERSION/nndd.tar.gz | tar -xzv -C /app/public/
RUN mkdir -p /app/public/ && \
curl -L https://github.com/instedd/notifiable-diseases/releases/download/$NNDD_VERSION/nndd.tar.gz | tar -xzv -C /app/public/

# Configure NNDD
RUN /app/docker/config-nndd

# Set permissions for tmp and log directories
RUN mkdir -p /app/tmp /app/log && chown -R app:app /app/tmp /app/log

# Add config files
ADD docker/web-run /etc/service/web/run
EXPOSE 3000
CMD ["/app/docker/web-run"]
6 changes: 3 additions & 3 deletions Dockerfile-dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ruby:2.3
FROM ruby:2.4

# ENV POIROT_STDOUT true
# ENV POIROT_SUPPRESS_RAILS_LOG true
Expand Down Expand Up @@ -32,12 +32,12 @@ RUN \
imagemagick \
ghostscript \
libgs-dev \
mysql-client \
default-mysql-client \
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

ARG TARGETARCH

# wkhtmltopdf
RUN curl -L https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.stretch_${TARGETARCH}.deb --output wkhtmltopdf.deb && \
RUN curl -L https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.buster_${TARGETARCH}.deb --output wkhtmltopdf.deb && \
dpkg -i wkhtmltopdf.deb && \
rm -f wkhtmltopdf.deb
11 changes: 2 additions & 9 deletions Dockerfile.selenium
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
FROM alpine

RUN apk add firefox-esr
RUN echo "https://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
RUN apk add firefox-esr geckodriver
RUN ln -sf /usr/bin/firefox-esr /usr/bin/firefox

# FIXME: can't upgrade to 0.30 because Geckodriver only starts on loopback
RUN apk add curl && \
curl -L https://github.com/mozilla/geckodriver/releases/download/v0.29.1/geckodriver-v0.29.1-linux64.tar.gz | tar -C /usr/local/bin -zx && \
apk del curl

EXPOSE 4444
EXPOSE 5900

ENTRYPOINT ["geckodriver", "--host", "0.0.0.0"]

28 changes: 14 additions & 14 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ gem 'mysql2', '~> 0.3'
gem 'elasticsearch', '~> 1.0'

# Models
gem 'encryptor', '~> 1.3'
gem 'encryptor', '~> 2.0'
gem 'kaminari', '~> 0.16'
gem 'paperclip', git: 'https://github.com/instedd/paperclip', branch: 'fix/v4.3.6-no-mimemagic'
gem 'paranoia', '<= 2.4.2' # last version to support ruby 2.2
gem 'paranoia', '< 2.5.0' # last version to support ruby 2.4 / rails 5.0
gem 'premailer-rails', '< 1.10' # 1.10 requires Rails.application.assets_manifest

# Views
Expand All @@ -38,7 +38,7 @@ gem 'wicked_pdf', '~> 2.1'
# Authentication
# gem 'bcrypt-ruby', '~> 3.1.2'
gem 'devise', '~> 4.0.0'
gem 'devise-security', '<= 0.12.0' # last version to support ruby 2.2
gem 'devise-security', '< 0.15.0' # last version to support ruby 2.4
gem 'devise_invitable', '~> 1.5'
gem 'doorkeeper', '~> 4.2.0'
gem 'omniauth', '~> 1.2'
Expand All @@ -54,12 +54,12 @@ gem 'dotiw', '~> 3.0'
gem 'faker', '< 1.9.2' # NOTE: kept until we upgrade to ruby 2.5+ then we can upgrade to ffaker 2.20 to replace Faker::Number
gem 'ffaker', '< 2.12.0'
gem 'guid', '~> 0.1'
gem 'nokogiri', '~> 1.6', '< 1.10.0' # last version to support ruby 2.2
gem 'nokogiri', '~> 1.6', '< 1.11.0' # last version to support ruby 2.4
gem 'oj', '~> 2.12', '< 2.17.3' # NOTE: 2.17.3 will stringify Time as a Float then load a BigDecimal...
gem 'poirot_rails', git: 'https://github.com/instedd/poirot_rails.git', branch: 'master'
gem 'rails-i18n', '~> 5.0'
gem 'rchardet', '~> 1.6'
gem 'rest-client', '~> 1.8' # NOTE: only used for a single HTTP call
gem 'rest-client', '~> 2.1' # NOTE: only used for a single HTTP call + Nuntium (SMS) + LocationService
gem 'rubyzip', '>= 1.0.0'
gem 'rqrcode', '~> 0.10' # required by Barby::QRCode

Expand Down Expand Up @@ -98,7 +98,7 @@ gem 'jquery-rails', '~> 4.0'
gem 'jquery-turbolinks', '~> 2.1.0'
gem 'leaflet-rails', '~> 0.7.4'
gem 'lodash-rails', '~> 3.10.1'
gem 'react-rails', '~> 1.3.2'
gem 'react-rails', '~> 1.6.2' # NOTE: required for JSX templates

source 'https://rails-assets.org' do
gem 'rails-assets-urijs', '~> 1.17.0'
Expand All @@ -111,16 +111,16 @@ group :development do
gem 'spring-commands-parallel-tests'
gem 'spring-commands-rspec'
gem 'spring-watcher-listen', '~> 2.0.0'
gem 'web-console', '< 4.0' # last version to support ruby 2.2
gem 'web-console', '< 4.0' # last version to support ruby 2.4 / rails 5
end

group :development, :test do
gem 'pry-byebug', '< 2.7.0' # last version to support ruby 2.2
gem 'pry-byebug', '< 3.10.0' # last version to support ruby 2.4
gem 'pry-rescue'
gem 'pry-stack_explorer'

gem 'parallel_tests', '~> 2.32.0' # last version to support ruby 2.2
gem 'parallel', '~> 1.19.2' # TODO: remove after upgrading ruby and parallel_tests
gem 'parallel_tests', '~> 3.5.1' # last version to support ruby 2.4
gem 'parallel', '~> 1.20.0' # TODO: remove after upgrading ruby and parallel_tests
end

group :test do
Expand All @@ -133,12 +133,12 @@ group :test do
gem 'rails-controller-testing'
gem 'simplecov', require: false
gem 'timecop', '~> 0.8'
gem 'webmock', '~> 1.23.0', require: false # a spec fails with 1.24.x
gem 'webmock', '~> 2.3.1', require: false

# integration tests
gem 'capybara', '~> 2.4'
gem 'capybara', '~> 3.29.0' # limited by site_prism 3.6
gem 'capybara-screenshot', '~> 1.0'
gem 'cucumber-rails', '~> 1.5', require: false
gem 'selenium-webdriver', '< 4.0'
gem 'site_prism', '~> 2.17'
gem 'selenium-webdriver'
gem 'site_prism', '~> 3.6.0' # last version to support ruby 2.4
end
Loading