From 64e2880790dc1de75aad0fe0d407a709628dc09b Mon Sep 17 00:00:00 2001 From: Ruslan Forostianov Date: Thu, 2 May 2024 10:22:03 +0200 Subject: [PATCH] Run java integration tests with GH workflows unit tests are already run by maven.yml now --- .../java-commands-integration-tests.yml | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/java-commands-integration-tests.yml diff --git a/.github/workflows/java-commands-integration-tests.yml b/.github/workflows/java-commands-integration-tests.yml new file mode 100644 index 00000000..c30f7191 --- /dev/null +++ b/.github/workflows/java-commands-integration-tests.yml @@ -0,0 +1,44 @@ +name: Run integration tests for java loading commands + +on: + push: + branches: [ "inc-data-upload-poc" ] + pull_request: + branches: [ "inc-data-upload-poc" ] + workflow_dispatch: + +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' + 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' + run: | + curl -o cgds.sql https://raw.githubusercontent.com/cBioPortal/cbioportal/${{ env.CBIO_DB_VERSION }}/src/main/resources/db-scripts/cgds.sql + - name: 'Prepare cbiportal db container' + run: | + docker run -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: 'Prepare cbiportal db container' + mvn clean test -Dtest="**/integrationTest/**/*" + - name: Set up JDK 21 + uses: actions/setup-java@v3 + with: + java-version: '21' + distribution: 'temurin' + cache: maven + - name: Run integration tests + run: mvn test -Dtest="**/integrationTest/**/*"