From b1207aea14802e42b779d2553cf3ac6a89def5c5 Mon Sep 17 00:00:00 2001 From: Javier Ferrer Date: Wed, 24 Jul 2024 12:13:15 +0100 Subject: [PATCH 1/3] migrate to github actions --- .github/workflows/build.yaml | 70 ++++++++++++++++++++++++++++++++++++ .travis.yml | 26 -------------- README.md | 2 +- 3 files changed, 71 insertions(+), 27 deletions(-) create mode 100644 .github/workflows/build.yaml delete mode 100644 .travis.yml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 00000000..d8f6d466 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,70 @@ +name: Build + +on: + release: + types: + - published + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + + permissions: + contents: write + + env: + TAG: ${{ github.ref_name }} + SCALA_VERSION: 2.12.12 + OUTPUT_PATH: target/scala-2.12 + + steps: + - id: prepare-tag + name: Prepare tag + run: echo "TAG=$(echo $TAG | sed 's/^v//')" >> $GITHUB_ENV + + - id: checkout + name: Check out repo + uses: actions/checkout@v4 + + - id: scala-setup + name: Install Scala + uses: olafurpg/setup-scala@v11 + with: + java-version: openjdk@1.11 + + - id: cache + name: Cache dependencies + uses: actions/cache@v4 + with: + path: | + ~/.cache/coursier + ~/.ivy2/cache + ~/.sbt + key: ${{ runner.os }}-sbt-${{ hashFiles('**/build.sbt') }} + + - id: linter + name: Lint code + run: sbt ++${{ env.SCALA_VERSION }} scalafmtCheckAll + + - id: compile + name: Compile code + run: sbt ++${{ env.SCALA_VERSION }} clean compile + + - id: test + name: Run tests + run: sbt ++${{ env.SCALA_VERSION }} coverage test coverageReport + + - id: assembly + name: Build jar + run: sbt ++${{env.SCALA_VERSION }} 'set test in assembly := {}' assembly + + - id: rename + name: Rename jar + run: mv ${{ env.OUTPUT_PATH }}/etl-backend-*.jar ${{ env.OUTPUT_PATH }}/etl-backend-${{ env.TAG }}.jar + + - id: push-to-release + uses: svenstaro/upload-release-action@v2 + with: + file: ${{ env.OUTPUT_PATH }}/etl-backend-${{ env.TAG }}.jar diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 64607785..00000000 --- a/.travis.yml +++ /dev/null @@ -1,26 +0,0 @@ -dist: trusty -language: scala -scala: - - 2.12.12 -jdk: - - oraclejdk11 -script: - - sbt ++$TRAVIS_SCALA_VERSION scalafmtCheckAll - - sbt ++$TRAVIS_SCALA_VERSION clean compile - - sbt ++$TRAVIS_SCALA_VERSION coverage test coverageReport - - sbt ++$TRAVIS_SCALA_VERSION 'set test in assembly := {}' assembly -before_deploy: - - git config --local user.name "opentargets-admin" - - git config --local user.email "administrator@opentargets.org" -deploy: - provider: releases - api_key: $GITHUB_TOKEN - skip_cleanup: true - file_glob: true - file: - - "target/scala-2.12/io-opentargets-etl-backend-assembly-*" - on: - repo: opentargets/platform-etl-backend - tags: true - all_branches: false - diff --git a/README.md b/README.md index 578571cb..cf816c24 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build Status](https://travis-ci.com/opentargets/platform-etl-backend.svg?branch=master)](https://travis-ci.com/opentargets/platform-etl-backend) +![Build status](https://github.com/opentargets/platform-etl-backend/actions/workflows/build.yaml/badge.svg) # Open Targets Post-Pipeline ETL process From 916e292b05761ccd60d4f43fcd470d61bbc93420 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Irene=20L=C3=B3pez=20Santiago?= <45119610+ireneisdoomed@users.noreply.github.com> Date: Mon, 29 Jul 2024 16:22:32 +0100 Subject: [PATCH 2/3] fix(molecule): harmonise null drug types The raw data can have `Unknown` as drug type. After coalescing, this field can have `unknown` or `Unknown` as reported by an user here https://github.com/opentargets/issues/issues/3354 This should fix the problem, but please double check that the Scala syntax is correct. --- src/main/scala/io/opentargets/etl/backend/drug/Molecule.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/scala/io/opentargets/etl/backend/drug/Molecule.scala b/src/main/scala/io/opentargets/etl/backend/drug/Molecule.scala index c000c8a8..79f3ed54 100644 --- a/src/main/scala/io/opentargets/etl/backend/drug/Molecule.scala +++ b/src/main/scala/io/opentargets/etl/backend/drug/Molecule.scala @@ -70,7 +70,7 @@ object Molecule extends LazyLogging { col("molecule_chembl_id").as("id"), col("molecule_structures.canonical_smiles").as("canonicalSmiles"), col("molecule_structures.standard_inchi_key").as("inchiKey"), - coalesce(col("molecule_type"), lit("unknown")).as("drugType"), + when(col("molecule_type").isNull || col("molecule_type") === "Unknown", lit("unknown")).otherwise(col("molecule_type")).as("drugType"), col("chebi_par_id"), col("black_box_warning").as("blackBoxWarning"), col("pref_name").as("name"), From fb02256cc5f2a76bb1997ab529539c2baef8248d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Irene=20L=C3=B3pez=20Santiago?= <45119610+ireneisdoomed@users.noreply.github.com> Date: Tue, 13 Aug 2024 15:58:31 +0100 Subject: [PATCH 3/3] chore(molecule): set `drugType` nulls to `Unknown` --- src/main/scala/io/opentargets/etl/backend/drug/Molecule.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/scala/io/opentargets/etl/backend/drug/Molecule.scala b/src/main/scala/io/opentargets/etl/backend/drug/Molecule.scala index 79f3ed54..a18723b0 100644 --- a/src/main/scala/io/opentargets/etl/backend/drug/Molecule.scala +++ b/src/main/scala/io/opentargets/etl/backend/drug/Molecule.scala @@ -70,7 +70,7 @@ object Molecule extends LazyLogging { col("molecule_chembl_id").as("id"), col("molecule_structures.canonical_smiles").as("canonicalSmiles"), col("molecule_structures.standard_inchi_key").as("inchiKey"), - when(col("molecule_type").isNull || col("molecule_type") === "Unknown", lit("unknown")).otherwise(col("molecule_type")).as("drugType"), + coalesce(col("molecule_type"), lit("Unknown")).as("drugType"), col("chebi_par_id"), col("black_box_warning").as("blackBoxWarning"), col("pref_name").as("name"),