Skip to content

Commit c79942d

Browse files
authored
Merge pull request #25 from mconf/add-portal-main-workflows
[DEVOPS-26] Add portal main workflows
2 parents 122c64c + 73ed9c6 commit c79942d

File tree

3 files changed

+138
-0
lines changed

3 files changed

+138
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Run Ruby lint
2+
3+
on:
4+
workflow_dispatch:
5+
workflow_call:
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.repository }}-${{ github.ref }}-lint
9+
cancel-in-progress: true
10+
11+
jobs:
12+
lint:
13+
runs-on: [self-hosted, ubuntu-22.04]
14+
steps:
15+
- name: Install packages
16+
run: |
17+
sudo apt-get update
18+
sudo DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
19+
build-essential git libmariadb-dev libsqlite3-dev libyaml-dev pkg-config
20+
- name: Checkout code
21+
uses: actions/checkout@v5
22+
- name: Set up Ruby
23+
uses: ruby/setup-ruby@v1
24+
with:
25+
ruby-version: .ruby-version
26+
bundler-cache: true
27+
- name: Lint Ruby code for syntax errors and bugs
28+
# -l runs a lint check only, -f github formats the output for GitHub
29+
run: bundle exec rubocop -l -f github --config .rubocop.yml
30+
- name: Lint HAML files
31+
run: bundle exec haml-lint -c .haml-lint.yml app/views
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Run Ruby scan
2+
3+
on:
4+
workflow_dispatch:
5+
workflow_call:
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.repository }}-${{ github.ref }}-scan
9+
cancel-in-progress: true
10+
11+
jobs:
12+
scan_ruby:
13+
runs-on: [self-hosted, ubuntu-22.04]
14+
steps:
15+
- name: Install packages
16+
run: |
17+
sudo apt-get update
18+
sudo DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
19+
build-essential git libmariadb-dev libsqlite3-dev libyaml-dev pkg-config tzdata
20+
- name: Checkout code
21+
uses: actions/checkout@v5
22+
- name: Set up Ruby
23+
uses: ruby/setup-ruby@v1
24+
with:
25+
ruby-version: .ruby-version
26+
bundler-cache: true
27+
- name: Scan for common Rails security vulnerabilities using static analysis
28+
run: bundle exec brakeman -q
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Run Ruby tests
2+
3+
on:
4+
workflow_dispatch:
5+
workflow_call:
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.repository }}-${{ github.ref }}-tests
9+
cancel-in-progress: true
10+
11+
jobs:
12+
test:
13+
runs-on: [self-hosted, ubuntu-22.04]
14+
services:
15+
mysql:
16+
image: mysql:5.7
17+
env:
18+
MYSQL_ALLOW_EMPTY_PASSWORD: yes
19+
MYSQL_DATABASE: mconf_web_test
20+
ports:
21+
- 3306:3306
22+
options: --health-cmd="mysqladmin ping -h localhost" --health-interval=10s --health-timeout=5s --health-retries=3
23+
redis:
24+
image: redis:3.2
25+
ports:
26+
- 6379:6379
27+
options: >-
28+
--health-cmd "redis-cli ping"
29+
--health-interval 10s
30+
--health-timeout 5s
31+
--health-retries 5
32+
steps:
33+
- name: Checkout code
34+
uses: actions/checkout@v5
35+
- name: Install Chromium
36+
run: |
37+
sudo apt-get update
38+
if apt-cache show chromium-browser >/dev/null 2>&1; then
39+
sudo apt-get install --no-install-recommends -y chromium-browser
40+
elif apt-cache show chromium >/dev/null 2>&1; then
41+
sudo apt-get install --no-install-recommends -y chromium
42+
else
43+
echo "Chromium not available via apt on this runner; skipping install"
44+
fi
45+
- name: Install packages
46+
run: |
47+
sudo apt-get update
48+
sudo DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
49+
build-essential git libmariadb-dev libsqlite3-dev libyaml-dev pkg-config nodejs tzdata \
50+
imagemagick libmagickcore-dev libmagickwand-dev
51+
- name: Set up Ruby
52+
uses: ruby/setup-ruby@v1
53+
with:
54+
ruby-version: .ruby-version
55+
bundler-cache: true
56+
- name: Run tests
57+
env:
58+
RAILS_ENV: test
59+
DATABASE_URL: mysql2://root@127.0.0.1:3306/mconf_web_test
60+
MCONF_REDIS_HOST: 127.0.0.1
61+
MCONF_LOG_LEVEL: fatal
62+
MCONF_EMAIL_TRACK_CLICKED: false
63+
MCONF_EMAIL_TRACK_OPENED: true
64+
MCONF_OMNIAUTH_GOOGLE_KEY: ${{ secrets.GOOGLE_OAUTH_KEY }}
65+
MCONF_OMNIAUTH_FACEBOOK_KEY: ${{ secrets.FACEBOOK_OAUTH_KEY }}
66+
MCONF_OMNIAUTH_GOOGLE_SECRET: ${{ secrets.GOOGLE_OAUTH_SECRET }}
67+
MCONF_OMNIAUTH_FACEBOOK_SECRET: ${{ secrets.FACEBOOK_OAUTH_SECRET }}
68+
MCONF_CAN_CONTACT_PORTAL: localhost,http://localhost:4000
69+
MCONF_CAN_RECORD_DEFAULT: false
70+
MCONF_COOKIES_SECURE: false
71+
MCONF_COOKIES_SAME_SITE: lax
72+
MCONF_RD_TRAFFIC_SOURCE: Elos
73+
MCONF_RD_TRAFFIC_MEDIUM: portal
74+
MCONF_RD_TRAFFIC_CAMPAIGN: none
75+
MCONF_HIDE_PENDING_TESTS: 1
76+
MCONF_DEVISE_PEPPER: ${{ secrets.DEVISE_PEPPER }}
77+
MCONF_DEVISE_SECRET_KEY: ${{ secrets.DEVISE_SECRET_KEY }}
78+
DEVISE_SECRET_KEY: ${{ secrets.DEVISE_JWT_SECRET_KEY }}
79+
run: bin/rails db:prepare spec

0 commit comments

Comments
 (0)