-
Notifications
You must be signed in to change notification settings - Fork 2
166 lines (147 loc) · 5.77 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
name: "Build All"
on:
push:
branches:
- "**"
pull_request:
branches:
- main
env:
GH_JAVA_VERSION: "17"
GH_SBT_OPTS: "-Xss64m -Xms4G -XX:MaxMetaspaceSize=1G -Xmx6G -XX:MaxInlineLevel=18 -XX:+UnlockExperimentalVMOptions"
GH_JVM_OPTS: "-Xss64m -Xms4G -XX:MaxMetaspaceSize=1G -Xmx6G -XX:MaxInlineLevel=18 -XX:+UnlockExperimentalVMOptions -XX:+UseJVMCICompiler"
CLI_SCALA_VERSION: "3.3.0"
CLI_SCALA_BINARY_VERSION: "3"
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
scala:
- { name: "Scala 3", version: "3.3.0", binary-version: "3", java-version: "17" }
steps:
- uses: actions/checkout@v4
- uses: olafurpg/setup-scala@v14
with:
java-version: ${{ matrix.scala.java-version }}
- name: Cache SBT
uses: actions/[email protected]
with:
path: |
~/.ivy2/cache
~/.cache/coursier
~/.sbt
key: ${{ runner.os }}-sbt-${{ matrix.scala.binary-version }}-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('**/build.properties') }}
restore-keys: |
${{ runner.os }}-sbt-${{ matrix.scala.binary-version }}-
- name: "[Push] Build All for ${{ matrix.scala.name }} ${{ matrix.scala.version }} - ${{ github.run_number }}"
if: github.event_name == 'push'
env:
CURRENT_BRANCH_NAME: ${{ github.ref }}
RUN_ID: ${{ github.run_id }}
RUN_NUMBER: ${{ github.run_number }}
JVM_OPTS: ${{ env.GH_JVM_OPTS }}
SBT_OPTS: ${{ env.GH_SBT_OPTS }}
run: |
echo "[BEFORE]CURRENT_BRANCH_NAME=${CURRENT_BRANCH_NAME}"
export CURRENT_BRANCH_NAME="${CURRENT_BRANCH_NAME#refs/heads/}"
echo " [AFTER]CURRENT_BRANCH_NAME=${CURRENT_BRANCH_NAME}"
echo "RUN_ID=${RUN_ID}"
echo "RUN_NUMBER=${RUN_NUMBER}"
echo "Push #${PUSH_NUMBER}"
echo "JVM_OPTS=${JVM_OPTS}"
echo "SBT_OPTS=${SBT_OPTS}"
java -version
.github/workflows/sbt-build-all.sh ${{ matrix.scala.version }}
- name: "[PR] Build All for ${{ matrix.scala.name }} ${{ matrix.scala.version }} - PR-#${{ github.event.pull_request.number }} - ${{ github.run_number }}"
if: github.event_name == 'pull_request'
env:
CURRENT_BRANCH_NAME: ${{ github.base_ref }}
RUN_ID: ${{ github.run_id }}
RUN_NUMBER: ${{ github.run_number }}
PR_NUMBER: ${{ github.event.pull_request.number }}
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
JVM_OPTS: ${{ env.GH_JVM_OPTS }}
SBT_OPTS: ${{ env.GH_SBT_OPTS }}
run: |
echo "Rull request to the '${CURRENT_BRANCH_NAME}' branch"
echo "RUN_ID=${RUN_ID}"
echo "RUN_NUMBER=${RUN_NUMBER}"
echo "PR #${PR_NUMBER}"
echo "JVM_OPTS=${JVM_OPTS}"
echo "SBT_OPTS=${SBT_OPTS}"
java -version
.github/workflows/sbt-build-all.sh ${{ matrix.scala.version }}
build-package-bin:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: olafurpg/setup-scala@v14
with:
java-version: ${{ env.GH_JAVA_VERSION }}
- name: Cache SBT
uses: actions/[email protected]
with:
path: |
~/.ivy2/cache
~/.cache/coursier
~/.sbt
key: ${{ runner.os }}-sbt-${{ env.CLI_SCALA_BINARY_VERSION }}-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('**/build.properties') }}
restore-keys: |
${{ runner.os }}-sbt-${{ env.CLI_SCALA_BINARY_VERSION }}-
- name: "[Push] Build bin package - ${{ github.run_number }}"
if: github.event_name == 'push'
env:
CURRENT_BRANCH_NAME: ${{ github.ref }}
RUN_ID: ${{ github.run_id }}
RUN_NUMBER: ${{ github.run_number }}
JVM_OPTS: ${{ env.GH_JVM_OPTS }}
SBT_OPTS: ${{ env.GH_SBT_OPTS }}
run: |
echo "[BEFORE]CURRENT_BRANCH_NAME=${CURRENT_BRANCH_NAME}"
export CURRENT_BRANCH_NAME="${CURRENT_BRANCH_NAME#refs/heads/}"
echo " [AFTER]CURRENT_BRANCH_NAME=${CURRENT_BRANCH_NAME}"
echo "RUN_ID=${RUN_ID}"
echo "RUN_NUMBER=${RUN_NUMBER}"
echo "Push #${PUSH_NUMBER}"
echo "JVM_OPTS=${JVM_OPTS}"
echo "SBT_OPTS=${SBT_OPTS}"
java -version
sbt \
++${{ env.CLI_SCALA_VERSION }}! \
clean \
universal:packageBin
cd modules/whatsub-cli/target/universal
unzip whatsub-cli-*.zip
rm whatsub-cli-*.zip
mv whatsub-cli-* whatsub-cli
cd whatsub-cli/bin
./whatsub --version
- name: "[PR] Build bin package for - PR-#${{ github.event.pull_request.number }} - ${{ github.run_number }}"
if: github.event_name == 'pull_request'
env:
CURRENT_BRANCH_NAME: ${{ github.base_ref }}
RUN_ID: ${{ github.run_id }}
RUN_NUMBER: ${{ github.run_number }}
PR_NUMBER: ${{ github.event.pull_request.number }}
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
JVM_OPTS: ${{ env.GH_JVM_OPTS }}
SBT_OPTS: ${{ env.GH_SBT_OPTS }}
run: |
echo "Rull request to the '${CURRENT_BRANCH_NAME}' branch"
echo "RUN_ID=${RUN_ID}"
echo "RUN_NUMBER=${RUN_NUMBER}"
echo "PR #${PR_NUMBER}"
echo "JVM_OPTS=${JVM_OPTS}"
echo "SBT_OPTS=${SBT_OPTS}"
java -version
sbt \
++${{ env.CLI_SCALA_VERSION }}! \
clean \
universal:packageBin
cd modules/whatsub-cli/target/universal
unzip whatsub-cli-*.zip
rm whatsub-cli-*.zip
mv whatsub-cli-* whatsub-cli
cd whatsub-cli/bin
./whatsub --version