Skip to content

Commit

Permalink
Merge branch 'master' into fix/timeout-error-test
Browse files Browse the repository at this point in the history
  • Loading branch information
akostadinov committed May 10, 2022
2 parents c9923a8 + 886ef39 commit 47e9d4a
Show file tree
Hide file tree
Showing 97 changed files with 4,286 additions and 648 deletions.
62 changes: 49 additions & 13 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,64 @@
version: 2
version: 2.1
jobs:
docker-build:
resource_class: small
working_directory: /home/circleci/zync
docker:
- image: circleci/buildpack-deps:latest
environment:
POSGRES_CONTAINER_NAME: db
DATABASE_URL: postgresql://postgres:postgres@db:5432/zync
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: zync
RAILS_ENV: production
steps:
- checkout
- setup_remote_docker
- run: docker build --tag zync:build --file ./Dockerfile .
- run: docker network create net0
- run: docker run --net net0 --name ${POSGRES_CONTAINER_NAME} -d -p 5432:5432 -e POSTGRES_USER=${POSTGRES_USER} -e POSTGRES_PASSWORD=${POSTGRES_PASSWORD} -e POSTGRES_DB=${POSTGRES_DB} postgres:12-alpine
- run:
command: |
docker run --net net0 -e RAILS_ENV=${RAILS_ENV} -e DATABASE_URL=${DATABASE_URL} \
zync:build rails db:setup
build:
working_directory: /home/circleci/zync
parameters:
postgresql_version:
type: string
working_directory: /opt/app-root/zync
docker:
- image: circleci/ruby:2.4.6
- image: circleci/postgres:10-alpine-ram
- image: registry.access.redhat.com/ubi7/ruby-27
- image: circleci/postgres:<< parameters.postgresql_version >>-ram
environment:
RAILS_ENV: test
DISABLE_SPRING: 1 # we can't really run spring as it hangs on local circleci build
DATABASE_URL: postgres://postgres:@localhost/circle_test
steps:
- run: sudo sh -c 'apt update && apt install -y --no-install-recommends -y postgresql-client'

- checkout

# Restore bundle cache
- restore_cache:
keys:
- zync-bundle-{{ arch }}-{{ checksum "Gemfile.lock" }}
- zync-bundle-{{ arch }}-{{ .Branch }}
- zync-branch-{{ arch }}-master
- zync-bundle-v2-{{ arch }}-{{ checksum "Gemfile.lock" }}
- zync-bundle-v2-{{ arch }}-{{ .Branch }}
- zync-branch-v2-{{ arch }}-master

- run:
name: bundle install
command: |
gem install bundler --version=2.0.1
bundle install --deployment --path vendor/bundle --jobs $(grep -c processor /proc/cpuinfo) --retry 3
gem install bundler --version=$(grep -A 1 "BUNDLED WITH" Gemfile.lock | tr -d ' '| tail -n 1)
bundle config --local force_ruby_platform true
bundle config set --local deployment 'true'
bundle config set --local path 'vendor/bundle'
bundle install --jobs $(grep -c processor /proc/cpuinfo) --retry 3
- run:
name: boot zync
command: BUNDLE_WITHOUT=development:test bundle exec bin/rails runner --environment=production 'puts Rails.env'

- save_cache:
key: zync-bundle-{{ arch }}-{{ checksum "Gemfile.lock" }}
key: zync-bundle-v2-{{ arch }}-{{ checksum "Gemfile.lock" }}
paths:
- vendor/bundle

Expand All @@ -53,6 +79,16 @@ jobs:
path: test/reports

- save_cache:
key: zync-branch-{{ arch }}-{{ .Branch }}
key: zync-branch-v2-{{ arch }}-{{ .Branch }}
paths:
- vendor/bundle

workflows:
version: 2.1
build_and_test_docker:
jobs:
- build:
matrix:
parameters:
postgresql_version: [ "10-alpine", "12-alpine" ]
- docker-build
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Dockerfile
.dockerignore
.bundle
log
openshift.local.clusterup
tmp
28 changes: 28 additions & 0 deletions .github/workflows/fast-forward-candidate-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Fast-forward candidate branch to HEAD of default branch
on:
workflow_dispatch:
inputs:
release:
description: 'The release version number (e.g, 2.11)'
required: true
ref:
description: 'The SHA1 or branch name the candidate branch will point to'
required: true
default: origin/master

jobs:
fast-forward:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: 3scale-${{ github.event.inputs.release }}-candidate
fetch-depth: 0
token: ${{ secrets.FF_CANDIDATE_BRANCH_PAT_TOKEN }}
- run: |
export candidate_branch="3scale-${{ github.event.inputs.release }}-candidate"
git checkout ${candidate_branch} && git pull || git checkout -b ${candidate_branch}
git merge ${{ github.event.inputs.ref }} --ff-only
git push origin ${candidate_branch}
name: Push to candidate branch
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,8 @@
/coverage

.byebug_history
.env

openshift.local.clusterup
.ruby-version
.tool-versions
31 changes: 31 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
language: ruby
sudo: false
dist: bionic
arch:
- ppc64le
- s390x
services:
- postgresql

env:
- DATABASE_URL=postgres://postgres@localhost:5431/travis_test
- RAILS_ENV:test

include:
- os: linux
addons:
packages:
- build-essential
- make
- gcc
- wget
- gem
- shared-mime-info.ppc64le
- zlib.ppc64le
- zlib-devel.ppc64le

before_install:
- ./.travis/setup_${TRAVIS_OS_NAME}_environment.sh

script:
- ./.travis/run_test_${TRAVIS_OS_NAME}.sh
8 changes: 8 additions & 0 deletions .travis/run_test_linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

# Rails Tests
bundle exec bin/rails test

# License Finder
bundle exec license_finder

10 changes: 10 additions & 0 deletions .travis/setup_linux_environment.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

set -ev

# Config & Install
gem install bundler:$(grep -A 1 "BUNDLED WITH" Gemfile.lock | tr -d ' '| tail -n 1)
bundle install --deployment --path vendor/bundle --jobs $(grep -c processor /proc/cpuinfo) --retry 3

# Rails db:setup
bundle exec bin/rails db:wait db:setup
33 changes: 33 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM registry.access.redhat.com/ubi8/ruby-27

USER root
RUN dnf --setopt=skip_missing_names_on_install=False,tsflags=nodocs --save \
&& rpm -Uvh https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm \
&& dnf update -y \
&& dnf remove -y postgresql \
&& dnf install -y shared-mime-info postgresql12 postgresql12-devel postgresql12-libs \
&& dnf clean all \
&& rm -rf /var/cache/yum

USER default
WORKDIR ${APP_ROOT}

RUN gem install bundler --version=2.2.19 --no-document

COPY --chown=default:root Gemfile* ./

RUN bundle config build.pg --with-pg-config=/usr/pgsql-12/bin/pg_config \
&& bundle install --deployment --path vendor/bundle --jobs $(grep -c processor /proc/cpuinfo) --retry 3

COPY --chown=default:root . .

ENV RAILS_LOG_TO_STDOUT=1

RUN bundle exec bin/rails server -e production -d; \
rm -rf tmp/pids

RUN mkdir -p -m 0775 tmp/cache log \
&& chown -fR default tmp log db \
&& chmod -fR g+w tmp log db

CMD [".s2i/bin/run"]
37 changes: 19 additions & 18 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ end


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.2.3'
gem 'rails', '~> 6.1.2'
gem 'pg', '>= 0.20'
gem 'schema_plus_enums'

# Use Puma as the app server
gem 'puma', '~> 3.12'

gem 'puma', '~> 5.2'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
# gem 'jbuilder', '~> 2.5'
# Use ActiveModel has_secure_password
Expand All @@ -25,10 +24,12 @@ gem 'puma', '~> 3.12'
# Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible
# gem 'rack-cors'

gem 'responders', '~> 2.4.1'
gem '3scale-api', '~> 0.1.9'
gem 'activerecord-pg_enum'

gem 'responders', '~> 3.0.1'
gem '3scale-api'

gem 'bootsnap'
gem 'bootsnap', '>= 1.4.4'

gem 'que', '>= 1.0.0.beta3'
gem 'que-web'
Expand All @@ -40,18 +41,19 @@ gem 'bugsnag-capistrano', '< 2', require: false

# This fork allows setting SSL_CERT_FILE and SSL_CERT_DIR
# https://github.com/nahi/httpclient/issues/369
gem 'httpclient', github: 'mikz/httpclient', branch: 'ssl-env-cert'
gem 'httpclient', github: '3scale/httpclient', branch: 'ssl-env-cert'
gem 'oauth2'
gem 'k8s-client', '>= 0.10'

gem 'lograge'

gem 'message_bus' # for publishing notifications about integration status

gem 'validate_url'

gem 'prometheus-client', require: %w[prometheus/client]
gem 'prometheus-client', '~> 2.1.0', require: %w[prometheus/client]
gem 'yabeda-rails'
gem 'yabeda-prometheus'
gem 'yabeda-prometheus', '~> 0.6.1'
gem 'yabeda-puma-plugin'

group :development, :test do
Expand All @@ -61,22 +63,21 @@ group :development, :test do
gem 'pry-rescue'
gem 'pry-stack_explorer'

gem 'license_finder', '~> 5.8'
gem 'license_finder', '~> 6.10'
gem 'license_finder_xml_reporter', git: 'https://github.com/3scale/license_finder_xml_reporter.git', tag: '1.0.0'
# rubyzip is a transitive depencency from license_finder with vulnerability on < 1.3.0
gem 'rubyzip', '>= 1.3.0'

gem 'httplog'
end

group :development do
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
# gem 'httplog'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

group :test do
gem 'minitest-reporters'
gem 'webmock', '~>3.5'
gem 'minitest-stub-const'
gem 'webmock'
gem 'codecov', require: false
gem 'simplecov', '~> 0.21.2', require: false
end

0 comments on commit 47e9d4a

Please sign in to comment.