-
Notifications
You must be signed in to change notification settings - Fork 45
79 lines (66 loc) · 2.2 KB
/
lint-unit.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: RMT lint, unit + engines tests
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: mysql:5.7
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
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- 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:migrate
- name: Run core tests
run: |
bundle exec rspec --format documentation
- 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::"