Skip to content

Commit

Permalink
Merge branch 'main' into bump-ruby
Browse files Browse the repository at this point in the history
  • Loading branch information
philippthun committed May 6, 2022
2 parents d282f49 + 3505845 commit 2f87230
Show file tree
Hide file tree
Showing 95 changed files with 1,908 additions and 1,079 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/composite/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: "setup"
description: "Configure Ubuntu to run Cloud_Controller_NG and its tests"

inputs:
BOSH_CLI_VERSION:
description: "Bosh CLI Version"
required: true
default: 6.4.17
WORKING_DIRECTORY:
description: "The Current Work Directory from which installs specifically bundle installs should take place"
required: true
default: "."
runs:
using: "composite"
steps:
- name: Install OS dependencies
run: |
sudo apt-get update && \
sudo apt-get -y install \
build-essential \
curl \
debconf-utils \
git \
libcurl4-openssl-dev \
libpq-dev \
libreadline-dev \
libsqlite3-dev \
libssl-dev \
libxml2-dev \
libxslt-dev \
libyaml-dev \
libv8-dev \
software-properties-common \
unzip \
wget \
zip \
zlib1g-dev
sudo wget -O /usr/local/bin/bosh https://s3.amazonaws.com/bosh-cli-artifacts/bosh-cli-${{ inputs.BOSH_CLI_VERSION }}-linux-amd64 && sudo chmod +x /usr/local/bin/bosh
shell: bash
working-directory: ${{ inputs.WORKING_DIRECTORY }}
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
working-directory: ${{ inputs.WORKING_DIRECTORY }}
- name: Install Ruby dependencies
run: bundle install
shell: bash
working-directory: ${{ inputs.WORKING_DIRECTORY }}
36 changes: 36 additions & 0 deletions .github/workflows/docs_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Docs Tests

on:
workflow_dispatch:
pull_request:
branches: [ main ]
paths:
- 'docs/**'
- '.github/workflows/docs_test.yml'
push:
branches: [ main ]
paths:
- 'docs/**'
- '.github/workflows/docs_test.yml'

jobs:
Test-Docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Prepare setup
run: cp -a .ruby-version docs/v3/.ruby-version
- uses: ./.github/workflows/composite/setup
with:
WORKING_DIRECTORY: docs/v3
- name: Run docs tests
run: |
bundle install
bundle exec rake check_doc_links
- uses: ravsamhq/notify-slack-action@v1.1
if: github.event_name == 'push'
with:
status: ${{ job.status }}
notify_when: 'failure' # default is 'success,failure,warnings'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required
119 changes: 52 additions & 67 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
name: Unit Tests

on:
workflow_dispatch:
pull_request:
branches: [ main ]
paths-ignore:
- 'docs/**'
- 'decisions/**'
- '.github/workflows/docs_test.yml'
push:
branches: [ main ]
paths-ignore:
- 'docs/**'
- 'decisions/**'
- '.github/workflows/docs_test.yml'

jobs:
rubocop:
Rubocop:
runs-on: ubuntu-latest
container:
image: "cloudfoundry/capi:ruby-units"
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: bundle install
- uses: actions/checkout@v3
- uses: ./.github/workflows/composite/setup
- name: Run Rubocop
run: bundle exec rake rubocop
- uses: ravsamhq/notify-slack-action@v1.1
Expand All @@ -24,83 +30,62 @@ jobs:
notify_when: 'failure' # default is 'success,failure,warnings'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required
test_postgres:
runs-on: ubuntu-latest
container:
image: "cloudfoundry/capi:ruby-units"
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: bundle install
- name: Setup PostgreSQL
run: service postgresql restart
- name: Run tests
run: DB=postgres bundle exec rake spec:all
- uses: ravsamhq/notify-slack-action@v1.1
if: github.event_name == 'push'
with:
status: ${{ job.status }}
notify_when: 'failure' # default is 'success,failure,warnings'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required
test_mysql:

Test-Postgres:
runs-on: ubuntu-latest
container:
image: "cloudfoundry/capi:ruby-units"
strategy:
fail-fast: false
matrix:
image: ["postgres:10", "postgres:14"]
services:
postgres:
image: ${{ matrix.image }}
env:
POSTGRES_PASSWORD: rootpassword
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: bundle install
- name: Setup MySQL
run: |
find /var/lib/mysql/mysql -exec touch -c -a {} +
service mysql restart
- uses: actions/checkout@v3
- uses: ./.github/workflows/composite/setup
- name: Run tests
run: DB=mysql bundle exec rake spec:all
run: DB=postgres POSTGRES_CONNECTION_PREFIX="postgres://postgres:rootpassword@localhost:5432" bundle exec rake spec
- uses: ravsamhq/notify-slack-action@v1.1
if: github.event_name == 'push'
with:
status: ${{ job.status }}
notify_when: 'failure' # default is 'success,failure,warnings'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required
test_mysql8:

Test-Mysql:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
image: ["mysql:5.7", "mysql:8.0"]
services:
mysql:
image: ${{ matrix.image }}
env:
MYSQL_DATABASE: cc_test
MYSQL_ROOT_PASSWORD: password
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
ports:
- 3306:3306
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Setup MySQL
run: |
sudo systemctl start mysql.service
- uses: actions/checkout@v3
- uses: ./.github/workflows/composite/setup
- name: Run tests
run: DB=mysql MYSQL_CONNECTION_PREFIX=mysql2://root:root@localhost:3306 bundle exec rake spec:all
run: DB=mysql MYSQL_CONNECTION_PREFIX="mysql2://root:password@127.0.0.1:3306" bundle exec rake spec
- uses: ravsamhq/notify-slack-action@v1.1
if: github.event_name == 'push'
with:
status: ${{ job.status }}
notify_when: 'failure' # default is 'success,failure,warnings'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required
test_docs:
runs-on: ubuntu-latest
container:
image: "cloudfoundry/capi:rc-docs"
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: |
bundle install
cd docs/v3
bundle install
cd -
- name: Run docs tests
run: bundle exec rake check_doc_links
- uses: ravsamhq/notify-slack-action@v1.1
if: github.event_name == 'push'
with:
status: ${{ job.status }}
notify_when: 'failure' # default is 'success,failure,warnings'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required
2 changes: 2 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ AllCops:
Exclude:
- errors/**/*
- lib/diego/bbs/models/**/*
- lib/locket/**/*
- lib/logcache/v2/**/*
- vendor/bundle/**/*

Bundler/DuplicatedGem:
Enabled: false
Expand Down
16 changes: 8 additions & 8 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ gem 'rake'
gem 'retryable'
gem 'rfc822'
gem 'rubyzip', '>= 1.3.0'
gem 'sequel', '~> 5.53'
gem 'sequel', '~> 5.55'
gem 'sequel_pg', require: 'sequel'
gem 'sinatra', '~> 2.2'
gem 'sinatra-contrib'
Expand All @@ -47,10 +47,10 @@ gem 'vmstat', '~> 2.3'
gem 'yajl-ruby'

# Rails Components
gem 'actionpack', '~> 6.1.4'
gem 'actionview', '~> 6.1.4'
gem 'activemodel', '~> 6.1.4'
gem 'railties', '~> 6.1.4'
gem 'actionpack', '~> 6.1.5', '>= 6.1.5.1'
gem 'actionview', '~> 6.1.5', '>= 6.1.5.1'
gem 'activemodel', '~> 6.1.5'
gem 'railties', '~> 6.1.5', '>= 6.1.5.1'

# Blobstore and Bits Service Dependencies
gem 'bits_service_client', '~> 3.3', '>= 3.3.0'
Expand All @@ -69,7 +69,7 @@ gem 'cf-uaa-lib', '~> 4.0.1'
gem 'vcap-concurrency', git: 'https://github.com/cloudfoundry/vcap-concurrency.git', ref: '2a5b0179'

group :db do
gem 'mysql2', '~> 0.5.3'
gem 'mysql2', '~> 0.5.4'
gem 'pg'
end

Expand All @@ -87,10 +87,10 @@ group :test do
gem 'rspec-collection_matchers'
gem 'rspec-instafail'
gem 'rspec-its'
gem 'rspec-rails', '~> 5.1.0'
gem 'rspec-rails', '~> 5.1.2'
gem 'rspec-wait'
gem 'rspec_api_documentation', '>= 6.1.0'
gem 'rubocop', '~> 1.25.1'
gem 'rubocop', '~> 1.28.2'
gem 'timecop'
gem 'webmock', '> 2.3.1'
end
Expand Down
Loading

0 comments on commit 2f87230

Please sign in to comment.