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

BIB-49: Removes Rails 6.1 to make Rails 7.0 the only Rails version #2579

Merged
merged 16 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from 13 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
283 changes: 0 additions & 283 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -268,288 +268,6 @@ jobs:
name: Wait for PostgreSQL to start
command: dockerize -wait tcp://localhost:5432 -timeout 1m

- run:
name: Setup Database
command: |
bundle exec rails db:create --trace
bundle exec rails db:structure:load --trace

- run:
name: RSpec
command: |
mkdir -p /tmp/test-results/rspec coverage
./cc-test-reporter before-build
RSPEC_CMD="bundle exec rspec --profile 10 --order random --format RspecJunitFormatter --out /tmp/test-results/rspec/rspec.xml --format progress --color --require spec_helper"
circleci tests glob "spec/**/*_spec.rb" | circleci tests run --command="xargs $RSPEC_CMD" --verbose --split-by=timings
- run:
name: Save Code Climate Test Coverage
# If there is a codeclimate json file, persist it to the workspace
# If not (e.g. when rerunning failed tests), create a file indicating that (required by persist_to_workspace)
command: |
if [ -f "coverage/codeclimate.$CIRCLE_NODE_INDEX.json" ]; then
./cc-test-reporter format-coverage -t simplecov -o "coverage/codeclimate.$CIRCLE_NODE_INDEX.json"
else
echo "Coverage file doesn't exist"
touch coverage/codeclimate.no-coverage.json
ls -lah coverage/
fi
- persist_to_workspace:
root: coverage
paths:
- codeclimate.*.json
- run:
name: "Jest: Tests"
command: |
mkdir -p /tmp/test-results/junit
yarn jest --ci --runInBand --reporters=default --reporters=jest-junit
environment:
JEST_JUNIT_OUTPUT: "/tmp/test-results/junit/js-test-results.xml" # This is the env variable for the old version of jest-junit
JEST_JUNIT_OUTPUT_DIR: "/tmp/test-results/junit/"
- store_test_results:
path: /tmp/test-results
- store_artifacts:
path: coverage
build_next:
working_directory: ~/bikeindex/bike_index
parallelism: 2
shell: /bin/bash --login
environment:
BUNDLE_GEMFILE: Gemfile.next
RAILS_ENV: test
NODE_ENV: test
RACK_ENV: test
COVERAGE: true
CC_TEST_REPORTER_ID: 04daa6564351115dc1515504790cd379ad8dc25e7778f0641e0f8c63185f887c
TRANSLATION_BRANCH: main
TZ: /usr/share/zoneinfo/America/Chicago
RETRY_FLAKY: true

docker:
- image: cimg/ruby:2.7.8-node
environment:
PGHOST: 127.0.0.1
PGUSER: root
PSQL_PAGER: ""
- image: cimg/postgres:13.5-postgis
environment:
POSTGRES_USER: root
POSTGRES_DB: bikeindex_test
POSTGRES_PASSWORD: ""
- image: redis:7.2.3

# The resource_class feature allows configuring CPU and RAM resources for each job. Different resource classes are available for different executors. https://circleci.com/docs/2.0/configuration-reference/#resourceclass
resource_class: large

steps:
- add_ssh_keys:
fingerprints:
- "b7:01:89:de:d8:f8:77:cc:9e:5a:ca:ee:0c:24:57:13"

- checkout

- run:
name: "Apt: install system / build dependencies"
command: |
sudo apt-get update
sudo apt-get -y install \
curl \
gettext \
imagemagick \
libcurl4-gnutls-dev \
libexpat1-dev \
libssl-dev \
libz-dev \
postgresql-client \
ripgrep

- run:
name: "Update Node.js and npm"
command: |
curl -sSL "https://nodejs.org/download/release/v16.20.2/node-v16.20.2-linux-x64.tar.xz" | sudo tar --strip-components=2 -xJ -C /usr/local/bin/ node-v16.20.2-linux-x64/bin/node
# curl https://www.npmjs.com/install.sh | sudo bash

- restore_cache:
name: "Dockerize: cache restore"
keys:
- CACHE_V4-dockerize-0.6.1
- CACHE_V4-dockerize-

- run:
name: "Dockerize: install"
environment:
DOCKERIZE_VERSION: v0.6.1
command: |
dockerize_tar=dockerize-linux-amd64-${DOCKERIZE_VERSION}.tar.gz
if [[ ! -f ~/.cache/dockerize/${dockerize_tar} ]]; then
wget https://github.com/jwilder/dockerize/releases/download/${DOCKERIZE_VERSION}/${dockerize_tar}
fi
sudo tar -C /usr/local/bin -xzvf ${dockerize_tar}

- type: cache-save
name: "Dockerize: cache save"
key: CACHE_V4-dockerize-0.6.1
paths:
- ~/.cache/dockerize

# Updated all restore_cache to make things more functional when changing a single dependency, see PR#2366
- restore_cache:
name: "Git: cache restore"
keys:
- CACHE_V4-git-2.22.0
- CACHE_V4-git-

- run:
name: "Git: install"
environment:
GIT_VERSION: 2.22.0
command: |
set -x

git_binary=~/.cache/git/git-${GIT_VERSION}/git

if [[ ! -f $git_binary ]]; then
rm -rf ~/.cache/git
mkdir -p ~/.cache/git
cd ~/.cache/git

wget -O git.tgz https://mirrors.edge.kernel.org/pub/software/scm/git/git-${GIT_VERSION}.tar.gz
tar -xzf git.tgz
cd git-${GIT_VERSION}

export DEFAULT_HELP_FORMAT="man"
autoconf
./configure

sudo make man
sudo make install-man
fi

cd ~/.cache/git/git-${GIT_VERSION}
sudo make prefix=/usr/local all
sudo make install
sudo cp ${git_binary} /usr/local/bin/git

- type: cache-save
name: "Git: cache save"
key: CACHE_V4-git-2.22.0
paths:
- ~/.cache/git/git-2.22.0

- restore_cache:
name: "Hub: cache restore"
keys:
- CACHE_V4-hub-2.12.3
- CACHE_V4-hub-

- run:
name: "Hub: install"
environment:
HUB_VERSION: 2.12.3
command: |
set -x

hub_binary=~/.cache/hub/hub-linux-amd64-${HUB_VERSION}/bin/hub

if [[ ! -f ${hub_binary} ]]; then
rm -rf ~/.cache/hub
mkdir -p ~/.cache/hub
cd ~/.cache/hub

wget -O hub.tgz https://github.com/github/hub/releases/download/v${HUB_VERSION}/hub-linux-amd64-${HUB_VERSION}.tgz
tar -xzf hub.tgz
fi

sudo cp ${hub_binary} /usr/local/bin/hub

- restore_cache:
name: "Hub: cache save"
keys:
- CACHE_V4-hub-2.12.3
- CACHE_V4-hub-
paths:
- ~/.cache/hub

- run:
name: "Bundler: install"
command: gem install bundler -v 2.4.22

- restore_cache:
name: "Ruby dependencies: cache restore"
keys:
- CACHE_V4-gems-{{ checksum "Gemfile.lock" }}
- CACHE_V4-gems-

- run:
name: "Ruby dependencies: install"
command: |
set -x
bundle config set --local path '~/.cache/bundle'
bundle install

- type: cache-save
name: "Ruby dependencies: cache save"
key: CACHE_V4-gems-{{ checksum "Gemfile.lock" }}
paths:
- ~/.cache/bundle

- run:
name: Sync translations (only on main by default)
command: bin/check_translations

- restore_cache:
name: "Node dependencies: cache restore"
keys:
- CACHE_V4-yarn-{{ checksum "yarn.lock" }}
- CACHE_V4-yarn-

- run:
name: "Node dependencies: install"
command: |
set -x
[[ -d ~/.cache/yarn ]] && use_local="--prefer-offline"
yarn install --cache-folder ~/.cache/yarn $use_local

- type: cache-save
name: "Node dependencies: cache save"
key: CACHE_V4-yarn-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/yarn

- restore_cache:
name: "Assets: cache restore"
keys:
- CACHE_V4-assets-{{ .Environment.CIRCLE_SHA1 }}
- CACHE_V4-assets-

- run:
name: "Assets: precompile"
command: |
set -x
node --version
bin/webpack
bundle exec rails assets:precompile assets:clean --trace

- type: cache-save
name: "Assets: cache save"
key: CACHE_V4-assets-{{ .Environment.CIRCLE_SHA1 }}
paths:
- .sass-cache
- public/assets
- public/packs
- public/packs-test
- tmp/cache/assets
- tmp/cache/webpacker

- run:
name: Install Code Climate Test Reporter
command: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter

- run:
name: Wait for PostgreSQL to start
command: dockerize -wait tcp://localhost:5432 -timeout 1m

- run:
name: Setup Database
command: |
Expand Down Expand Up @@ -632,7 +350,6 @@ workflows:
commit:
jobs:
- build
- build_next
- brakeman_scan
- upload-coverage:
requires:
Expand Down
6 changes: 1 addition & 5 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@ git_source(:gitlab) { |repo| "https://gitlab.com/#{repo}.git" }
ruby "2.7.8"
gem "rack", "~> 2.2.3"

if next?
gem "rails", "~> 7.0.8.4"
else
gem "rails", "~> 6.0"
end
gem "rails", "~> 7.0.8.4"

gem "puma" # App server
gem "bcrypt", "~> 3.1.7" # encryption
Expand Down
Loading