Update rmt-server.changes #663
Workflow file for this run
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: 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: [master] | |
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: ['2.5.8', '2.5.9'] | |
# skipping Ruby3 tests for now, because RMT isn't Ruby3 compatible yet, and the failing | |
# tests confuse the team. | |
# ruby-version: ['2.5.8', '2.5.9', '3.0.3'] | |
services: | |
mysql: | |
image: registry.suse.com/suse/mariadb:10.6 | |
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: | |
- 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 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::" |