-
Notifications
You must be signed in to change notification settings - Fork 12
99 lines (82 loc) · 2.73 KB
/
build.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
88
89
90
91
92
93
94
95
96
97
98
99
name: Scala tests with coverage
on:
pull_request:
paths-ignore: ['**.md']
push:
paths-ignore: ['**.md']
jobs:
run-unit-tests:
runs-on: ubuntu-20.04
env:
SBT_OPTS: >-
-Xmx3g
-Denv.type=test
-Dpostgres.host=localhost -Dpostgres.port=5432
ARTIFACTORY_USERNAME: ${{secrets.ARTIFACTORY_USERNAME}}
ARTIFACTORY_PASSWORD: ${{secrets.ARTIFACTORY_PASSWORD}}
services:
postgres:
image: postgres:9.6
env:
POSTGRES_USER: sam-test
POSTGRES_PASSWORD: sam-test
POSTGRES_DB: testdb
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v2
# coursier cache action caches both coursier and sbt caches
- name: coursier-cache-action
uses: coursier/cache-action@v5
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
- name: Git secrets setup
run: |
git clone https://github.com/awslabs/git-secrets.git ~/git-secrets
cd ~/git-secrets
git checkout ad82d68ee924906a0401dfd48de5057731a9bc84
sudo make install
- name: Secrets check
run: |
sudo ln -s "$(which echo)" /usr/local/bin/say
./minnie-kenny.sh --force
git secrets --scan-history
- name: Run Scalafmt Check
id: scalafmtCheck
run: sbt scalafmtCheckAll scalafmtSbtCheck
- name: Run unit tests and generate coverage report
id: coverageReport
run: source env/test.env; sbt coverage "testOnly --" coverageReport
generateAndPublishClient:
runs-on: ubuntu-20.04
needs: run-unit-tests
env:
ARTIFACTORY_USERNAME: ${{secrets.ARTIFACTORY_USERNAME}}
ARTIFACTORY_PASSWORD: ${{secrets.ARTIFACTORY_PASSWORD}}
SBT_OPTS: -Xmx3g
steps:
- uses: actions/checkout@v2
# coursier cache action caches both coursier and sbt caches
- name: coursier-cache-action
uses: coursier/cache-action@v5
- name: Generate java client
id: generateJavaClient
run: bash scripts/gen_java_client.sh
- name: Publish java client for merge to develop branch
working-directory: codegen_java
id: publishJavaClient
if: ${{ github.ref_name == 'develop' }}
run: sbt "+ publish" -Dproject.isSnapshot=false
- name: Publish java client as snapshot for PRs
working-directory: codegen_java
id: publishJavaClientSnapshot
if: ${{ github.ref_name != 'develop' }}
run: sbt "+ publish" -Dproject.isSnapshot=true