-
-
Notifications
You must be signed in to change notification settings - Fork 33
138 lines (132 loc) · 4.17 KB
/
ci.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: CI
on:
push:
branches: [ master ]
pull_request:
jobs:
rubocop:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup prerequisites theforeman-rubocop
run: |
sudo apt-get update && sudo apt-get -y install libyaml-dev
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler-cache: true
- name: Run rubocop
run: bundle exec rubocop -P --format github
build:
runs-on: ubuntu-latest
needs: rubocop
services:
db:
image: postgres:13
ports: ['5432:5432']
env:
POSTGRES_USER: foreman
POSTGRES_PASSWORD: foreman
POSTGRES_DB: foreman
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
with:
repository: theforeman/foreman
ref: develop
path: foreman
- uses: actions/checkout@v3
with:
repository: theforeman/foreman_fog_proxmox
path: foreman_fog_proxmox
- uses: actions/checkout@v3
with:
repository: fog/fog-proxmox
path: fog-proxmox
- uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7'
bundler-cache: true
- name: Setup foreman
env:
PGHOST: 127.0.0.1
PGDB: foreman
PGPWD: foreman
PGUSER: foreman
RAILS_ENV: test
DISABLE_SPRING: true
working-directory: ./foreman
run: |
sudo apt-get update && sudo apt-get -y install build-essential libpq-dev libsystemd-dev
gem install bundler
echo -n -e "gem 'foreman_fog_proxmox', :path => '../foreman_fog_proxmox'\n gem 'fog-proxmox', :path => '../fog-proxmox'\n gem 'simplecov'" > bundler.d/Gemfile.local.rb
cp config/settings.yaml.test config/settings.yaml
echo -n -e "test:\n adapter: postgresql \n port: 5432 \n database: foreman \n username: foreman \n password: foreman \n encoding: utf8 \n pool: 10" > config/database.yml
cp config/ignored_environments.yml.sample config/ignored_environments.yml
bundle config set without 'libvirt ovirt mysql2'
bundle install --jobs 4 --retry 3
bundle exec bin/rake db:migrate
bundle exec bin/rake db:seed
- uses: actions/setup-node@v1
with:
node-version: '14'
- name: Setup node assets
working-directory: ./foreman
env:
PGHOST: 127.0.0.1
PGDB: foreman
PGPWD: foreman
PGUSER: foreman
RAILS_ENV: test
DISABLE_SPRING: true
run: |
npm install
bundle exec bin/rake assets:precompile locale:pack webpack:compile
- name: Run test suite with coverage report
working-directory: ./foreman
env:
PGHOST: 127.0.0.1
PGDB: foreman
PGPWD: foreman
PGUSER: foreman
RAILS_ENV: test
DISABLE_SPRING: true
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
COVERAGE: true
run: |
bundle exec bin/rake test:foreman_fog_proxmox
- name: Upload simplecov results for coverage
uses: actions/upload-artifact@v1
with:
name: coverage
path: foreman_fog_proxmox/coverage/
coverage:
needs: [ build ]
name: publish coverage report
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
repository: theforeman/foreman_fog_proxmox
path: foreman_fog_proxmox
- name: Download tests result from test
uses: actions/download-artifact@v1
with:
name: coverage
path: foreman_fog_proxmox/coverage
- name: Publish code coverage to codeclimate
uses: paambaati/[email protected]
env:
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
GIT_BRANCH: ${{ github.ref }}
GIT_COMMIT_SHA: ${{ github.sha }}
with:
workingDirectory: ${{github.workspace}}/foreman_fog_proxmox
debug: true
coverageLocations: |
${{github.workspace}}/foreman_fog_proxmox/coverage/coverage.json:simplecov