Run unit tests with upgraded mysql #12511
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This will automatically use the sbt version in project/build.properties | |
name: Unit tests | |
on: | |
push: | |
branches: [ develop ] | |
pull_request: | |
branches: [ develop ] | |
merge_group: | |
branches: [ develop ] | |
concurrency: | |
# Don't run this workflow concurrently on the same branch | |
group: ${{ github.workflow }}-${{ github.ref }} | |
# For PRs, don't wait for completion of existing runs, cancel them instead | |
cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
services: | |
mysql: | |
image: mysql/mysql-server:5.6 | |
env: | |
MYSQL_ROOT_PASSWORD: leonardo-test | |
MYSQL_USER: leonardo-test | |
MYSQL_PASSWORD: leonardo-test | |
MYSQL_DATABASE: leotestdb | |
options: >- | |
--health-cmd="mysqladmin ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 3307:3306 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: 'temurin' | |
- name: Compile and check scalafmt | |
env: | |
JAVA_OPTS: -Xmx4G -Xms4G -Xss2M | |
JVM_OPTS: -Xmx4G -Xms4G -Xss2M | |
run: sbt -Denv.type=test clean "test:compile" scalafmtCheckAll | |
# Run SlickPlainQueryTest separately from the rest of the unit tests because for some reason, when run together, these | |
# tests will always fail | |
- name: Run tests | |
env: | |
JAVA_OPTS: -Xmx4G -Xms4G -Xss2M -Duser.timezone=UTC -Denv.type=test -Dmysql.host=localhost -Dmysql.port=3307 | |
JVM_OPTS: -Xmx4G -Xms4G -Xss2M | |
run: | | |
sbt "project http" coverage "testOnly org.broadinstitute.dsde.workbench.leonardo.http.db.RuntimeServiceDbQueriesSpec org.broadinstitute.dsde.workbench.leonardo.http.service.RuntimeServiceV2InterpSpec org.broadinstitute.dsde.workbench.leonardo.http.db.RuntimeServiceDbQueriesSpec" coverageReport | |
sbt "project core" coverage test coverageReport | |
sbt "project http" coverage "testOnly -- -l SlickPlainQueryTest" coverageReport | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
fail_ci_if_error: false | |
token: ${{ secrets.CODECOV_TOKEN }} | |
version: "v0.1.15" | |
- name: Setup Cache | |
uses: coursier/cache-action@v5 | |
- name: Cache resources | |
run: | | |
rm -rf "$HOME/.ivy2/local" || true | |
find $HOME/Library/Caches/Coursier/v1 -name "ivydata-*.properties" -delete || true | |
find $HOME/.ivy2/cache -name "ivydata-*.properties" -delete || true | |
find $HOME/.cache/coursier/v1 -name "ivydata-*.properties" -delete || true | |
find $HOME/.sbt -name "*.lock" -delete || true | |
dispatch-tag: | |
needs: [ build ] | |
if: success() && github.event_name == 'push' && github.ref == 'refs/heads/develop' | |
uses: ./.github/workflows/tag.yml | |
with: | |
release-branches: develop | |
secrets: inherit |