-
Notifications
You must be signed in to change notification settings - Fork 21
87 lines (76 loc) · 3.01 KB
/
unit_test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# 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