Merge pull request #2172 from newrelic/update_docker_compose_for_m1 #1306
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
name: Scheduled Continuous Integration | |
on: | |
push: | |
branches: | |
- main | |
- dev | |
schedule: | |
- cron: '0 9 * * *' | |
workflow_dispatch: | |
jobs: | |
run_rubocop: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Configure git | |
run: 'git config --global init.defaultBranch main' | |
- uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # tag v3.5.0 | |
- uses: ruby/setup-ruby@bc1dd263b68cb5626dbb55d5c89777d79372c484 # tag v1.151.0 | |
with: | |
ruby-version: '3.2' | |
- run: bundle | |
- run: rubocop | |
unit_tests: | |
runs-on: ubuntu-22.04 | |
services: | |
mysql: | |
image: mysql:5.7 | |
env: | |
MYSQL_ALLOW_EMPTY_PASSWORD: yes | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
ports: | |
- "3306:3306" | |
strategy: | |
fail-fast: false | |
matrix: | |
ruby-version: [2.4.10, 2.5.9, 2.6.10, 2.7.8, 3.0.6, 3.1.4, 3.2.2, 3.3.0-preview1] | |
steps: | |
- name: Configure git | |
run: 'git config --global init.defaultBranch main' | |
- uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # tag v3.5.0 | |
# - curl is needed for Curb | |
# - xslt is needed for older Nokogiris, RUBY_VERSION < 2.5 | |
# - sasl is needed for memcached | |
- name: Install OS packages | |
run: sudo apt-get update; sudo apt-get install -y --no-install-recommends libcurl4-nss-dev libsasl2-dev libxslt1-dev | |
- name: Install Ruby ${{ matrix.ruby-version }} | |
uses: ruby/setup-ruby@bc1dd263b68cb5626dbb55d5c89777d79372c484 # tag v1.151.0 | |
with: | |
ruby-version: ${{ matrix.ruby-version }} | |
- name: Set up mini-envs for ruby version | |
uses: kanga333/variable-mapper@3681b75f5c6c00162721168fb91ab74925eaebcb # tag v0.3.0 | |
with: | |
key: ${{ matrix.ruby-version }} | |
map: | | |
{ | |
"2.4.10": { | |
"rails": "norails,rails52,rails51,rails50,rails42,rails41,rails40" | |
}, | |
"2.5.9": { | |
"rails": "norails,rails61,rails60,rails52,rails51,rails50,rails42" | |
}, | |
"2.6.10": { | |
"rails": "norails,rails61,rails60,rails52,rails51,rails50,rails42" | |
}, | |
"2.7.8": { | |
"rails": "norails,rails61,rails60,rails70,railsedge" | |
}, | |
"3.0.6": { | |
"rails": "norails,rails61,rails60,rails70,railsedge" | |
}, | |
"3.1.4": { | |
"rails": "norails,rails61,rails70,railsedge" | |
}, | |
"3.2.2": { | |
"rails": "norails,rails61,rails70,railsedge" | |
}, | |
"3.3.0-preview1": { | |
"rails": "norails,rails61,rails70,railsedge" | |
} | |
} | |
- if: matrix.ruby-version == '2.4.10' || matrix.ruby-version == '2.5.9' || matrix.ruby-version == '2.6.10' | |
name: Prepare mysql directory | |
run: sudo chown -R $USER /usr/local | |
- if: matrix.ruby-version == '2.4.10' || matrix.ruby-version == '2.5.9' || matrix.ruby-version == '2.6.10' | |
name: Cache mysql55 | |
id: mysql55-cache | |
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # tag v3.3.1 | |
with: | |
path: /usr/local/mysql55 | |
key: mysql55-install | |
- if: steps.mysql55-cache.outputs.cache-hit != 'true' && ( matrix.ruby-version == '2.4.10' || matrix.ruby-version == '2.5.9' || matrix.ruby-version == '2.6.10') | |
name: Install mysql55 | |
run: sudo ./test/script/install_mysql55 | |
- name: Setup bundler | |
run: ./.github/workflows/scripts/setup_bundler | |
env: | |
RUBY_VERSION: ${{ matrix.ruby-version }} | |
RAILS_VERSION: ${{ env.rails }} | |
- name: Run Unit Tests | |
uses: nick-fields/retry@943e742917ac94714d2f408a0e8320f2d1fcafcd # tag v2.8.3 | |
with: | |
timeout_minutes: 30 | |
max_attempts: 2 | |
command: bundle exec rake test:env[${{ env.rails }}] | |
env: | |
VERBOSE_TEST_OUTPUT: true | |
DB_PORT: ${{ job.services.mysql.ports[3306] }} | |
CI_CRON: true | |
multiverse: | |
runs-on: ubuntu-22.04 | |
services: | |
elasticsearch7: | |
image: elasticsearch:7.16.2 | |
env: | |
discovery.type: single-node | |
ports: | |
- 9200:9200 | |
options: >- | |
--health-cmd "curl http://localhost:9200/_cluster/health" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 10 | |
elasticsearch8: | |
image: elasticsearch:8.4.2 | |
env: | |
discovery.type: single-node | |
xpack.security.enabled: false | |
ports: | |
- 9250:9200 | |
options: >- | |
--health-cmd "curl http://localhost:9200/_cluster/health" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 10 | |
memcached: | |
image: memcached:latest | |
ports: | |
- 11211:11211 | |
options: >- | |
--health-cmd "timeout 5 bash -c 'cat < /dev/null > /dev/udp/127.0.0.1/11211'" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
mongodb: | |
image: ${{ contains(fromJson('["2.4.10"]'), matrix.ruby-version) && 'mongo:5.0.11' || 'mongo:latest' }} | |
ports: | |
- 27017:27017 | |
mysql: | |
image: mysql:5.7 | |
env: | |
MYSQL_ROOT_PASSWORD: root | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
ports: | |
- 3306 | |
postgres: | |
image: postgres:latest | |
env: | |
POSTGRES_USERNAME: postgres | |
POSTGRES_PASSWORD: password | |
ports: | |
- 5432:5432 | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
rabbitmq: | |
image: rabbitmq:latest | |
ports: | |
- 5672:5672 | |
options: >- | |
--health-cmd "rabbitmq-diagnostics -q check_port_connectivity" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
redis: | |
image: redis | |
ports: | |
- 6379:6379 | |
options: >- | |
--health-cmd "redis-cli ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
strategy: | |
fail-fast: false | |
matrix: | |
multiverse: [agent, background, background_2, database, frameworks, httpclients, httpclients_2, rails, rest] | |
ruby-version: [2.4.10, 2.5.9, 2.6.10, 2.7.8, 3.0.6, 3.1.4, 3.2.2, 3.3.0-preview1] | |
steps: | |
- name: Configure git | |
run: 'git config --global init.defaultBranch main' | |
- uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # tag v3.5.0 | |
# - curl is needed for Curb | |
# - xslt is needed for older Nokogiris, RUBY_VERSION < 2.5 | |
# - sasl is needed for memcached | |
- name: Install OS packages | |
run: sudo apt-get update; sudo apt-get install -y --no-install-recommends libcurl4-nss-dev libsasl2-dev libxslt1-dev | |
- name: Install Ruby ${{ matrix.ruby-version }} | |
uses: ruby/setup-ruby@bc1dd263b68cb5626dbb55d5c89777d79372c484 # tag v1.151.0 | |
with: | |
ruby-version: ${{ matrix.ruby-version }} | |
- if: matrix.ruby-version == '2.4.10' | |
name: Prepare mysql dirextory | |
run: sudo chown -R $USER /usr/local | |
- if: matrix.ruby-version == '2.4.10' | |
name: Cache mysql55 | |
id: mysql55-cache | |
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # tag v3.3.1 | |
with: | |
path: /usr/local/mysql55 | |
key: mysql55-install | |
- if: steps.mysql55-cache.outputs.cache-hit != 'true' && ( matrix.ruby-version == '2.4.10') | |
name: Install mysql55 | |
run: sudo ./test/script/install_mysql55 | |
- name: Setup bundler | |
run: ./.github/workflows/scripts/setup_bundler | |
env: | |
RUBY_VERSION: ${{ matrix.ruby-version }} | |
- name: Wait for/Check Mysql | |
uses: nick-fields/retry@943e742917ac94714d2f408a0e8320f2d1fcafcd # tag v2.8.3 | |
with: | |
timeout_minutes: 1 | |
max_attempts: 20 | |
command: | | |
mysql --host 127.0.0.1 --port ${{ job.services.mysql.ports[3306] }} -uroot -proot -e "SHOW GRANTS FOR 'root'@'localhost'"; | |
if [[ $? != 0 ]]; then | |
sleep 1; | |
fi | |
- name: Run Multiverse Tests | |
uses: nick-fields/retry@943e742917ac94714d2f408a0e8320f2d1fcafcd # tag v2.8.3 | |
with: | |
timeout_minutes: 60 | |
max_attempts: 2 | |
command: bundle exec rake test:multiverse[group="${{ matrix.multiverse }}"] | |
env: | |
VERBOSE_TEST_OUTPUT: true | |
DB_PASSWORD: root | |
MYSQL_PASSWORD: root | |
DB_PORT: ${{ job.services.mysql.ports[3306] }} | |
MYSQL_PORT: ${{ job.services.mysql.ports[3306] }} | |
MYSQL_HOST: 127.0.0.1 | |
POSTGRES_USERNAME: postgres | |
POSTGRES_PASSWORD: password | |
SERIALIZE: 1 | |
- name: Annotate errors | |
if: ${{ failure() }} | |
uses: ./.github/actions/annotate | |
infinite_tracing: | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
ruby-version: [2.5.9, 2.6.10, 2.7.8, 3.0.6, 3.1.4, 3.2.2, 3.3.0-preview1] | |
steps: | |
- name: Configure git | |
run: 'git config --global init.defaultBranch main' | |
- uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # tag v3.5.0 | |
- name: Install Ruby ${{ matrix.ruby-version }} | |
uses: ruby/setup-ruby@bc1dd263b68cb5626dbb55d5c89777d79372c484 # tag v1.151.0 | |
with: | |
ruby-version: ${{ matrix.ruby-version }} | |
- name: Bundle | |
run: bundle install | |
- name: Run Multiverse Tests | |
uses: nick-fields/retry@943e742917ac94714d2f408a0e8320f2d1fcafcd # tag v2.8.3 | |
with: | |
timeout_minutes: 15 | |
max_attempts: 2 | |
command: bundle exec rake test:multiverse[group=infinite_tracing] | |
env: | |
VERBOSE_TEST_OUTPUT: true | |
SERIALIZE: 1 | |
- name: Annotate errors | |
if: ${{ failure() }} | |
uses: ./.github/actions/annotate | |
notify_slack_fail: | |
name: Notify slack fail | |
needs: [unit_tests, multiverse, infinite_tracing] | |
runs-on: ubuntu-22.04 | |
if: always() | |
steps: | |
- uses: technote-space/workflow-conclusion-action@45ce8e0eb155657ab8ccf346ade734257fd196a5 # tag v3.0.3 | |
- uses: voxmedia/github-action-slack-notify-build@3665186a8c1a022b28a1dbe0954e73aa9081ea9e # v1.6.0 | |
if: ${{ env.WORKFLOW_CONCLUSION == 'failure' && github.event_name != 'workflow_dispatch' }} | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.RUBY_GITHUB_ACTIONS_BOT_WEBHOOK }} | |
with: | |
channel: ruby-agent-notifications | |
status: FAILED | |
color: danger | |
notify_slack_success: | |
name: Notify slack success | |
needs: [unit_tests, multiverse, infinite_tracing] | |
runs-on: ubuntu-22.04 | |
if: always() | |
steps: | |
- uses: technote-space/workflow-conclusion-action@45ce8e0eb155657ab8ccf346ade734257fd196a5 # tag v3.0.3 | |
- run: echo ${{ github.event_name }} | |
- uses: Mercymeilya/last-workflow-status@3418710aefe8556d73b6f173a0564d38bcfd9a43 # tag v0.3.3 | |
id: last_status | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: voxmedia/github-action-slack-notify-build@3665186a8c1a022b28a1dbe0954e73aa9081ea9e # v1.6.0 | |
if: ${{ env.WORKFLOW_CONCLUSION == 'success' && steps.last_status.outputs.last_status == 'failure' && github.event_name != 'workflow_dispatch' }} | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.RUBY_GITHUB_ACTIONS_BOT_WEBHOOK }} | |
with: | |
channel: ruby-agent-notifications | |
status: SUCCESS | |
color: good |