-
Notifications
You must be signed in to change notification settings - Fork 52
93 lines (81 loc) · 3.27 KB
/
ansible-install.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
name: ansible-install
run-name: "Testing Ansible install after commit \"${{ github.event.head_commit.message }}\""
on:
push:
branches:
- ansible
- full-test-suite
- updated-deprecated-actions
workflow_dispatch:
jobs:
install-seek-from-ansible:
runs-on: ${{matrix.os}}
continue-on-error: true
strategy:
matrix:
os: [ubuntu-20.04,ubuntu-22.04]
services:
mysql:
image: mysql:8.0.21
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_ROOT_PASSWORD: ''
MYSQL_DATABASE: test
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 --restart=always
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure ansible for local install
working-directory: /home/runner/work/seek/seek/script/ansible/
run: |
sed -i '/vault_password_file/d' ansible.cfg
sed -i '/ssh_connection/d' ansible.cfg
sed -i '/pipelining/d' ansible.cfg
sed -i 's/\- hosts\: \[servers\]/\- hosts\: localhost/g' Deploy-SEEK.yml
sed -i '/\- hosts\: localhost/a \ \ connection\: local' Deploy-SEEK.yml
sed -i 's/user_var\: username/user_var\: runner/' group_vars/vars.yml
sed -i 's/git_dest\: \/home\/username/git_dest\: \/home\/runner\/work/' group_vars/vars.yml
sed -i 's|git_version: main|git_version: '"${GITHUB_REF_NAME}"'|' group_vars/vars.yml
sed -i '/sql_user\: sql_username/a sql_password: mysqlpassword' group_vars/vars.yml
- name: Prepares system for ansible install
run: |
sudo apt install acl -y
- name: Install SEEK through ansible
working-directory: /home/runner/work/seek/seek/script/ansible/
run: |
ansible-playbook Deploy-SEEK.yml --skip-tags database
- name: Configures database
working-directory: /home/runner/work/SEEK
run: |
cp config/database.default.yml config/database.yml
sed -i '/password\: mysqlpassword/a \ \ port\: 3306' config/database.yml
sed -i '/password\: mysqlpassword/a \ \ host\: 127.0.0.1' config/database.yml
sed -i 's/mysqluser/root/g' config/database.yml
sed -i 's/mysqlpassword//g' config/database.yml
bash -lc 'bundle exec rake db:setup'
- name: Runs seek unit tests
working-directory: /home/runner/work/SEEK
run: |
bash -lc 'bundle exec rails test test/unit'
- name: Runs seek integration tests
working-directory: /home/runner/work/SEEK
run: |
bash -lc 'bundle exec rails test test/integration'
- name: Runs seek functional tests
working-directory: /home/runner/work/SEEK
run: |
bash -lc 'bundle exec rails test test/functional'
fail-on-any-os:
# Without this step workflow remains "green" regardles of fails above.
name: Workflow Status
needs:
- install-seek-from-ansible
runs-on: ubuntu-latest
if: always()
steps:
- uses: technote-space/[email protected]
- name: Check Job Status status and fail if they are red
if: env.WORKFLOW_CONCLUSION == 'failure'
run: exit 1