-
Notifications
You must be signed in to change notification settings - Fork 1
145 lines (124 loc) · 4.95 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
name: Build All
on:
push:
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
scala:
- { name: "Scala 2", version: "2.12.18", binary-version: "2.12", java-version: "adopt@1.11", params: "" }
- { name: "Scala 2", version: "2.13.12", binary-version: "2.13", java-version: "adopt@1.11", params: "" }
- { name: "Scala 3.1", version: "3.3.1", binary-version: "3", java-version: "adopt@1.11", params: '; set useAggressiveScalacOptions := true ;' }
steps:
- uses: actions/checkout@v4
- uses: olafurpg/setup-scala@v14
with:
java-version: ${{ matrix.scala.java-version }}
- name: Cache SBT
uses: actions/cache@v3
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 Scala ${{ matrix.scala.version }}"
if: github.event_name == 'push'
env:
CURRENT_BRANCH_NAME: ${{ github.ref }}
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}"
java -version
.github/workflows/sbt-build-all.sh ${{ matrix.scala.version }} "${{ matrix.scala.params }}"
- name: "[PR] Build All for Scala ${{ matrix.scala.version }}"
if: github.event_name == 'pull_request'
env:
CURRENT_BRANCH_NAME: ${{ github.base_ref }}
run: |
echo "Rull request to the '${CURRENT_BRANCH_NAME}' branch"
java -version
.github/workflows/sbt-build-all.sh ${{ matrix.scala.version }} "${{ matrix.scala.params }}"
scalafix:
runs-on: ubuntu-latest
env:
GH_JAVA_VERSION: "adopt@1.11"
steps:
- uses: actions/checkout@v4
- uses: olafurpg/setup-scala@v14
with:
java-version: ${{ env.GH_JAVA_VERSION }}
- name: Cache SBT
uses: actions/cache@v3
with:
path: |
~/.ivy2/cache
~/.cache/coursier
~/.sbt
key: ${{ runner.os }}-sbt-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('**/build.properties') }}
restore-keys: |
${{ runner.os }}-sbt
- name: "sbt +scalafix"
run: |
sbt \
-J-XX:MaxMetaspaceSize=1024m \
-J-Xmx2048m \
clean \
+scalafixAll
build_with_test_coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache Coursier
uses: actions/cache@v3
with:
path: ~/.cache/coursier
key: ${{ runner.os }}-coursier-scala-2_13-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('**/build.properties') }}
restore-keys: |
${{ runner.os }}-coursier-scala-2_13-
- name: Cache Ivy
uses: actions/cache@v3
with:
path: ~/.ivy2/cache
key: ${{ runner.os }}-ivy-scala-2_13-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('**/build.properties') }}
restore-keys: |
${{ runner.os }}-ivy-scala-2_13-
- name: "[Push] Build with Test Coverage - ${{ github.run_number }}"
if: github.event_name == 'push'
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
CURRENT_BRANCH_NAME: ${{ github.ref }}
RUN_ID: ${{ github.run_id }}
RUN_NUMBER: ${{ github.run_number }}
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}"
export CI_BRANCH=$CURRENT_BRANCH_NAME
.github/workflows/sbt-build-all-with-coverage.sh 2.13.12
- name: "[PR] Build with Test Coverage - PR-#${{ github.event.pull_request.number }} - ${{ github.run_number }}"
if: github.event_name == 'pull_request'
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
CURRENT_BRANCH_NAME: ${{ github.base_ref }}
RUN_ID: ${{ github.run_id }}
RUN_NUMBER: ${{ github.run_number }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
export CI_BRANCH="PR-$CURRENT_BRANCH_NAME"
echo "RUN_ID=${RUN_ID}"
echo "RUN_NUMBER=${RUN_NUMBER}"
echo "PR #${PR_NUMBER}"
echo "Rull request to the '${CURRENT_BRANCH_NAME}' branch"
.github/workflows/sbt-build-all-with-coverage.sh 2.13.12
- if: github.event_name == 'pull_request'
uses: codecov/codecov-action@v3