-
Notifications
You must be signed in to change notification settings - Fork 3
93 lines (86 loc) · 2.94 KB
/
build_save-agent_reusable.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
name: Reusable build save-agent and save-demo-agent
on:
workflow_call:
inputs:
branch:
type: string
required: true
build-save-agent:
type: boolean
required: true
build-save-demo-agent:
type: boolean
required: true
jobs:
build:
name: Build save-agent and save-demo-agent
if: inputs.build-save-agent || inputs.build-save-demo-agent
runs-on: ubuntu-latest
steps:
- name: Checkout save-cloud
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ inputs.branch }}
- name: Prepare to build
run: |
echo SAVE_AGENT_GRADLE_TASK = >> $GITHUB_ENV
echo SAVE_DEMO_AGENT_GRADLE_TASK = >> $GITHUB_ENV
- name: Set save-agent build task
if: inputs.build-save-agent
run: |
echo SAVE_AGENT_GRADLE_TASK=':save-agent:copyAgentDistribution' >> $GITHUB_ENV
- name: Set save-demo-agent build task
if: inputs.build-save-demo-agent
run: |
echo SAVE_DEMO_AGENT_GRADLE_TASK=':save-demo-agent:copyAgentDistribution' >> $GITHUB_ENV
- name: Store Kotlin version in env
run: |
kv=$(cat gradle/libs.versions.toml | grep -m1 '^kotlin =' | awk -F'[=]' '{print $2}' | tr -d '" ')
echo KOTLIN_VERSION=$kv >> $GITHUB_ENV
- name: Cache konan
uses: actions/cache@v4
with:
path: ~/.konan
key: ${{ runner.os }}-gradle-konan-${{ env.KOTLIN_VERSION }}
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
- name: Install system packages
# libcurl is needed for ktor-client-curl
run: sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev
- name: Build save-agent and save-demo-agent
uses: gradle/gradle-build-action@v3
with:
gradle-version: wrapper
arguments: |
${{ env.SAVE_AGENT_GRADLE_TASK }}
${{ env.SAVE_DEMO_AGENT_GRADLE_TASK }}
--stacktrace
--build-cache
-Pdetekt.multiplatform.disabled=true
-x detekt
-x spotlessCheck
-PgprUser=${{ github.actor }}
-PgprKey=${{ secrets.GITHUB_TOKEN }}
- name: Upload save-agent
if: inputs.build-save-agent
uses: actions/upload-artifact@v4
with:
name: save-agent
path: 'save-agent/build/libs/save-agent-*-distribution.jar'
- name: Upload save-demo-agent
if: inputs.build-save-demo-agent
uses: actions/upload-artifact@v4
with:
name: save-demo-agent
path: 'save-demo-agent/build/libs/save-demo-agent-*-distribution.jar'
- name: Upload gradle reports
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: gradle-reports
path: '**/build/reports/'
retention-days: 1