-
Notifications
You must be signed in to change notification settings - Fork 3
176 lines (161 loc) · 5.47 KB
/
compile_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
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
167
168
169
170
171
172
173
174
175
176
name: Compile and Test
on: [push, pull_request]
env:
CI: true # disables SBT super shell which has problems with CI environments
jobs:
compile-lib:
name: Compile library and test
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
scala: ["3.3"]
platform: [JVM, JS, Native]
env:
SCALA_VERSION: ${{ matrix.scala }}
PROJECT: root${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
- name: Set up Java 8 and SBT
uses: actions/setup-java@v2
with:
distribution: temurin
java-version: 8
- name: Cache Coursier
uses: actions/cache@v1
with:
path: ~/.cache/coursier
key: ${{ runner.os }}-coursier-${{ hashFiles('**/*.sbt') }}
- name: Cache SBT ivy cache
uses: actions/cache@v1
with:
path: ~/.ivy2/cache
key: ${{ runner.os }}-sbt-ivy-cache-${{ hashFiles('**/build.sbt') }}
- name: Cache SBT
uses: actions/cache@v1
with:
path: ~/.sbt
key: ${{ runner.os }}-sbt-${{ hashFiles('**/build.sbt') }}
- name: Compile (Scala ${{ matrix.scala }} - ${{ matrix.platform }})
run: sbt -J-Xmx3G -Dsbt.color=always ++$SCALA_VERSION $PROJECT/compile
- name: Install scala-native libraries
if: matrix.platform == 'native'
run: sudo apt-get update && sudo apt-get -y install libunwind-dev libre2-dev libsdl2-dev
- name: Compile tests (Scala ${{ matrix.scala }} - ${{ matrix.platform }})
run: sbt -J-Xmx3G -Dsbt.color=always ++$SCALA_VERSION $PROJECT/test:compile
- name: Run tests (Scala ${{ matrix.scala }} - ${{ matrix.platform }})
run: sbt -J-Xmx3G -Dsbt.color=always ++$SCALA_VERSION $PROJECT/test
compile-examples:
name: Compile examples
runs-on: ubuntu-latest
strategy:
fail-fast: true
steps:
- uses: actions/checkout@v2
- name: Set up Java 17 and SBT
uses: actions/setup-java@v2
with:
distribution: temurin
java-version: 17
- name: Cache Coursier
uses: actions/cache@v1
with:
path: ~/.cache/coursier
key: ${{ runner.os }}-coursier-${{ hashFiles('**/*.sbt') }}
- name: Cache SBT ivy cache
uses: actions/cache@v1
with:
path: ~/.ivy2/cache
key: ${{ runner.os }}-sbt-ivy-cache-${{ hashFiles('**/build.sbt') }}
- name: Cache SBT
uses: actions/cache@v1
with:
path: ~/.sbt
key: ${{ runner.os }}-sbt-${{ hashFiles('**/build.sbt') }}
- name: Install Scala-CLI
run: |
curl -fL https://github.com/Virtuslab/scala-cli/releases/latest/download/scala-cli-x86_64-pc-linux.gz | gzip -d > scala-cli
chmod +x scala-cli
sudo mv scala-cli /usr/local/bin/scala-cli
- name: Compile examples (Release)
run: |
cd examples/release
ls | grep ".sc\|.md" | xargs scala-cli compile --server=false
- name: Publish Local
run: sbt -J-Xmx3G -Dsbt.color=always publishLocal
- name: Compile examples (Snapshot)
run: |
cd examples/snapshot
ls | grep ".sc\|.md" | xargs scala-cli compile --server=false
compile-templates:
name: Compile templates
runs-on: ubuntu-latest
strategy:
fail-fast: true
steps:
- uses: actions/checkout@v2
- name: Set up Java 17 and SBT
uses: actions/setup-java@v2
with:
distribution: temurin
java-version: 17
- name: Cache Coursier
uses: actions/cache@v1
with:
path: ~/.cache/coursier
key: ${{ runner.os }}-coursier-${{ hashFiles('**/*.sbt') }}
- name: Cache SBT ivy cache
uses: actions/cache@v1
with:
path: ~/.ivy2/cache
key: ${{ runner.os }}-sbt-ivy-cache-${{ hashFiles('**/build.sbt') }}
- name: Cache SBT
uses: actions/cache@v1
with:
path: ~/.sbt
key: ${{ runner.os }}-sbt-${{ hashFiles('**/build.sbt') }}
- name: Install Tools
run: |
curl -fL "https://github.com/coursier/launchers/raw/master/cs-x86_64-pc-linux.gz" | gzip -d > cs
chmod +x cs
./cs setup --yes
- name: Compile templates (Scala CLI)
run: |
./cs launch giter8 -- file://./src/main/g8 --name=scala-cli-g8-test
./cs launch scala-cli -- compile scala-cli-g8-test
- name: Compile templates (SBT)
run: |
./cs launch giter8 -- file://./src/main/g8 --name=sbt-g8-test --sbt_project=yes
cd sbt-g8-test
sbt compile
coverage:
name: Code coverage
runs-on: ubuntu-latest
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
steps:
- uses: actions/checkout@v2
- name: Set up Java 8 and SBT
uses: actions/setup-java@v2
with:
distribution: temurin
java-version: 8
- name: Cache Coursier
uses: actions/cache@v1
with:
path: ~/.cache/coursier
key: ${{ runner.os }}-coursier-${{ hashFiles('**/*.sbt') }}
- name: Cache SBT ivy cache
uses: actions/cache@v1
with:
path: ~/.ivy2/cache
key: ${{ runner.os }}-sbt-ivy-cache-${{ hashFiles('**/build.sbt') }}
- name: Cache SBT
uses: actions/cache@v1
with:
path: ~/.sbt
key: ${{ runner.os }}-sbt-${{ hashFiles('**/build.sbt') }}
- name: Compute coverage
run: sbt -J-Xmx3G -Dsbt.color=always rootJVM/clean coverage rootJVM/test rootJVM/coverageAggregate
- name: Upload report
run: bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r jvm/target/scala-3.3.4/coverage-report/cobertura.xml