Skip to content

Commit

Permalink
Run java integration tests with GH workflows
Browse files Browse the repository at this point in the history
unit tests are already run by maven.yml now
  • Loading branch information
forus committed May 10, 2024
1 parent 55e781c commit ac4cb0f
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/java-commands-integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Run integration tests for java loading commands

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: 'Checkout Code'
uses: actions/checkout@v4
with:
path: ./cbioportal-core

- name: 'Get the cbioportal db version from pom.xml'
working-directory: ./cbioportal-core
run: |
CBIO_DB_VERSION=$(python -c "import xml.etree.ElementTree as ET; tree = ET.parse('pom.xml'); root = tree.getroot(); ns = {'ns': 'http://maven.apache.org/POM/4.0.0'}; print(root.find('.//ns:cbioportal.version', ns).text)")
echo "CBIO_DB_VERSION=$CBIO_DB_VERSION" | tee -a $GITHUB_ENV
- name: 'Download cgds.sql with cbioportal db schema of the given version'
working-directory: ./cbioportal-core
run: |
curl -o cgds.sql https://raw.githubusercontent.com/cBioPortal/cbioportal/${{ env.CBIO_DB_VERSION }}/src/main/resources/db-scripts/cgds.sql
- name: 'Prepare cbioportal db container'
working-directory: ./cbioportal-core
run: |
docker run -d -p 3306:3306 \
-v $(pwd)/src/test/resources/seed_mini.sql:/docker-entrypoint-initdb.d/seed.sql:ro \
-v $(pwd)/cgds.sql:/docker-entrypoint-initdb.d/cgds.sql:ro \
-e MYSQL_ROOT_PASSWORD=root \
-e MYSQL_USER=cbio_user \
-e MYSQL_PASSWORD=somepassword \
-e MYSQL_DATABASE=cgds_test \
mysql:5.7
- name: 'Wait for cBioPortal database'
run: |
until mysqladmin ping -h"127.0.0.1" -P"3306" --silent; do
echo 'waiting for cBioPortal database'
sleep 3
done
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'temurin'
cache: maven

- name: 'Run database-dependent tests'
working-directory: ./cbioportal-core
run: mvn integration-test

0 comments on commit ac4cb0f

Please sign in to comment.