Skip to content

Bump actions/setup-java from 3.10.0 to 3.12.0 #43

Bump actions/setup-java from 3.10.0 to 3.12.0

Bump actions/setup-java from 3.10.0 to 3.12.0 #43

Workflow file for this run

name: CI Build
on:
workflow_dispatch:
pull_request:
push:
branches:
- master
jobs:
build_and_tests:
runs-on: ubuntu-20.04
strategy:
matrix:
java: [ '8', '11' ]
steps:
# Setup Java & Python
- name: Setup Java
uses: actions/setup-java@cd89f46ac9d01407894225f350157564c9c7cee2 # v3.12.0
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
- name: Setup Python
uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435 # v4.5.0
with:
python-version: "3.9.7"
architecture: x64
- name: Cache local Maven repository
uses: actions/cache@69d9d449aced6a2ede0bc19182fadc3a0a42d2b0 # v3.2.6
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@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
with:
repository: icatproject-contrib/icat-ansible
path: icat-ansible
ref: master
- name: Install Ansible
run: pip install -r icat-ansible/requirements.txt
# Prep for running the playbook
- name: Create Hosts File
run: echo -e "[icatdb_minimal_hosts]\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: Add Ansible Roles
run: |
sed -i "/- role: authn_anon$/a\
\ - role: authn_db" icat-ansible/icatdb_minimal_hosts.yml
sed -i "/- role: icat_server$/a\
\ - role: dev_common" icat-ansible/icatdb_minimal_hosts.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/icatdb_minimal_hosts.yml -i icat-ansible/hosts --vault-password-file icat-ansible/vault_pass.txt -vv
# The authn-db deployed by ansible needs to be undeployed so that the build can run
- name: Undeploy authn-db
run: |
cd /home/runner/payara*/glassfish*/bin
PATH=$PATH:`pwd`
asadmin undeploy `asadmin list-applications | grep authn.db | awk '{print $1;}'`
- name: Checkout authn-db
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
# 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 -DskipTests
- name: Run Unit Tests
run: mvn test -B
- name: Run Integration Tests
run: mvn failsafe:integration-test failsafe:verify -B