Skip to content

Merge pull request #59 from ral-facilities/mysql_connector_j_9.1.0 #52

Merge pull request #59 from ral-facilities/mysql_connector_j_9.1.0

Merge pull request #59 from ral-facilities/mysql_connector_j_9.1.0 #52

Workflow file for this run

name: CI Build
on:
workflow_dispatch:
pull_request:
push:
branches:
- master
jobs:
build_and_tests:
runs-on: ubuntu-22.04
strategy:
matrix:
java_version:
- 11
# Errors with `java.lang.IllegalArgumentException: ArquillianServletRunnerEE9 not found. Could not determine ContextRoot from ProtocolMetadata, please contact DeployableContainer developer.`
# Bumping various Arquillian dependencies does not fix, leave as just Java 11
# - 17
steps:
- name: Setup Java
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
with:
distribution: 'temurin'
java-version: ${{ matrix.java_version }}
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Run apt-get update
run: sudo apt-get update
- name: Cache local Maven repository
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
# ICAT Ansible clone and install dependencies
- name: Checkout icat-ansible
uses: actions/checkout@cd7d8d697e10461458bc61a30d094dc601a8b017 # v4.0.0
with:
repository: icatproject-contrib/icat-ansible
path: icat-ansible
- name: Install Ansible
run: pip install -r icat-ansible/requirements.txt
# Prep for running the playbook
- name: Create Hosts File
run: echo -e "[hosts_all]\nlocalhost ansible_connection=local" > icat-ansible/hosts
- name: Prepare vault pass
run: echo -e "icattravispw" > icat-ansible/vault_pass.txt
- name: Move vault to directory it'll get detected by Ansible
run: mv icat-ansible/vault.yml icat-ansible/group_vars/all
- name: Replace default payara user with Actions user
run: |
sed -i -e "s/^payara_user: \"glassfish\"/payara_user: \"runner\"/" icat-ansible/group_vars/all/vars.yml
- name: Set ids.server version
run: |
echo "ids_server_version: 2.1.0" >> icat-ansible/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
# Remove existing MySQL installation so it doesn't interfere with GitHub Actions
- 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
# Create local instance of ICAT
- name: Run ICAT Ansible Playbook
run: |
ansible-playbook icat-ansible/hosts_all.yml -i icat-ansible/hosts --vault-password-file icat-ansible/vault_pass.txt -vv
- name: Checkout
uses: actions/checkout@cd7d8d697e10461458bc61a30d094dc601a8b017 # v4.0.0
- name: LILS Generator requirements
run: pip install -r tools/requirements.txt
- name: LILS Generator
run: python tools/lorum_facility_generator.py
# Payara must be sourced otherwise the Maven build command fails
- name: Run Build
run: |
grep payara ~/.bash_profile > payara_path_command
source payara_path_command
mvn install -B -DskipTests
- name: Run Unit Tests
run: mvn test -B
# Upload logs on failure
- name: Upload DataGatewayDownload API log
uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: DataGatewayDownload API logs
path: /home/runner/logs/datagateway-download-api.log
- name: Upload IDS log
uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: IDS logs
path: /home/runner/logs/ids.log
- name: Upload ICAT log
uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: ICAT logs
path: /home/runner/logs/icat.log
- name: Payara logs
uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: Payara logs
path: /home/runner/payara*/glassfish/domains/domain1/logs/server.log