-
Notifications
You must be signed in to change notification settings - Fork 3
51 lines (42 loc) · 1.52 KB
/
ci-build.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
name: CI
on:
workflow_dispatch:
pull_request:
push:
branches:
- master
jobs:
run_all_roles:
name: Run all ICAT Ansible roles
runs-on: ubuntu-22.04
strategy:
matrix:
java_version: [11, 17, 21]
steps:
- name: Checkout ICAT Ansible
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Run apt update
run: sudo apt-get update
- name: Install requirements
run: pip install -r requirements.txt
# Prep for running the playbook
- name: Create hosts file
run: echo -e "[hosts_all]\nlocalhost ansible_connection=local" > hosts
- name: Prepare vault pass
run: echo -e "icattravispw" > vault_pass.txt
- name: Move vault to directory it'll get detected by Ansible
run: mv vault.yml group_vars/all
- name: Replace default payara user with Actions user
run: |
sed -i -e "s/^payara_user: \"glassfish\"/payara_user: \"runner\"/" group_vars/all/vars.yml
# Force hostname to localhost - bug fix for previous ICAT Ansible issues on Actions
- name: Change hostname to localhost
run: sudo hostname -b localhost
- name: Remove existing mysql
run: |
sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld
sudo apt-get remove --purge "mysql*"
sudo rm -rf /var/lib/mysql* /etc/mysql
- name: Run ICAT Ansible Playbook
run: |
ansible-playbook hosts_all.yml -i hosts --vault-password-file vault_pass.txt -e java_version=${{ matrix.java_version }} -vv