Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[SCC-334] Update rails to version 7 #1268

[SCC-334] Update rails to version 7

[SCC-334] Update rails to version 7 #1268

Workflow file for this run

name: lint + unit + engine tests
# About security when running the tests and NOT exposing
# the secrets to externals. Currently Github Actions does
# NOT expose the secrets if the branch is coming from a forked
# repository.
# See: https://github.blog/2020-08-03-github-actions-improvements-for-fork-and-pull-request-workflows/
# See: https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions
#
# An alternate would be to set, pull_request_target but this takes the CI code
# from master removing the ability to change the code in a PR easily.
#
# Aditionally, since 2021 pull requests from new contributors will not
# trigger workflows automatically but will wait for approval from somebody
# with write access.
# See: https://docs.github.com/en/actions/managing-workflow-runs/approving-workflow-runs-from-public-forks
on:
pull_request:
branches: [rmt_3]
env:
RAILS_ENV: test
jobs:
test:
runs-on: ubuntu-latest
strategy:
# Only use 2 workers, gh actions seems to kill jobs when we use more
max-parallel: 2
matrix:
# we need to test the Ruby versions of the products we release RMT for,
# those are: SLE15 (2.5.8, 2.5.9)
ruby-version: ['3.2.9']
services:
mysql:
image: registry.opensuse.org/opensuse/mariadb:11.8
env:
MYSQL_DATABASE: rmt_test
MYSQL_USER: rmt
MYSQL_PASSWORD: rmt
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
steps:
- name: Install dependencies
run: sudo apt-get install -y libsqlite3-dev
- uses: actions/checkout@v4
# Run bundle install and cache the installed gems
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true
- name: Setup database config file
run: |
sudo mkdir -p /var/lib/rmt
ruby -e "require 'yaml'; puts({'database_test'=>{'host' => '127.0.0.1', 'port' => 3306, 'username'=>'rmt','password'=>'rmt','database'=>'rmt_test','adapter'=>'mysql2','encoding'=>'utf8','timeout'=>5000,'pool'=>5}}.to_yaml)" > config/rmt.local.yml
- name: Run Shell lint
uses: azohra/shell-linter@latest
with:
path: "ci/rmt-*"
- name: Run Lint
run: |
bundle exec rubocop -D
- name: Prepare database
run: |
bundle exec rails db:drop db:create db:migrate
- name: Run core tests
run: |
bundle exec rake test:core
- name: Run core tests with sqlite
run: |
sed -i 's/adapter: mysql2/adapter: sqlite3/' config/rmt.yml
bundle exec rake test:core
- name: Run PubCloud engines tests
run: |
bundle exec rake test:engines
- name: Run version checks
run: |
echo "::group::Version verification checks"
ruby ci/check-version-matches.rb
echo "::endgroup::"