Skip to content

Commit aa84ba1

Browse files
authored
Merge pull request #705 from typelevel/build/github-actions
2 parents 54c694c + fa8a2af commit aa84ba1

File tree

12 files changed

+414
-326
lines changed

12 files changed

+414
-326
lines changed

.github/workflows/bench.yml

Lines changed: 0 additions & 38 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 254 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,254 @@
1+
# This file was automatically generated by sbt-github-actions using the
2+
# githubWorkflowGenerate task. You should add and commit this file to
3+
# your git repository. It goes without saying that you shouldn't edit
4+
# this file by hand! Instead, if you wish to make changes, you should
5+
# change your sbt build configuration to revise the workflow description
6+
# to meet your needs, then regenerate this file.
7+
8+
name: Continuous Integration
9+
10+
on:
11+
pull_request:
12+
branches: ['*']
13+
push:
14+
branches: ['*']
15+
16+
env:
17+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18+
19+
jobs:
20+
build:
21+
name: Build and Test
22+
strategy:
23+
matrix:
24+
os: [ubuntu-latest]
25+
scala: [0.27.0-RC1, 3.0.0-M1, 2.11.12, 2.12.10, 2.13.3]
26+
27+
platform: [jvm]
28+
workers: [1, 4]
29+
include:
30+
- workers: 1
31+
os: ubuntu-latest
32+
33+
scala: 0.27.0-RC1
34+
platform: js
35+
pluginversion: 1.3.0
36+
- workers: 1
37+
os: ubuntu-latest
38+
39+
scala: 2.12.10
40+
platform: js
41+
pluginversion: 1.3.0
42+
- workers: 1
43+
os: ubuntu-latest
44+
45+
scala: 2.13.3
46+
platform: js
47+
pluginversion: 1.3.0
48+
- workers: 1
49+
os: ubuntu-latest
50+
51+
scala: 2.11.12
52+
platform: js
53+
pluginversion: 0.6.33
54+
- workers: 1
55+
os: ubuntu-latest
56+
57+
scala: 2.11.12
58+
platform: native
59+
pluginversion: 0.3.9
60+
- workers: 1
61+
os: ubuntu-latest
62+
63+
scala: 2.11.12
64+
platform: native
65+
pluginversion: 0.4.0-M2
66+
runs-on: ${{ matrix.os }}
67+
steps:
68+
- name: Checkout current branch (full)
69+
uses: actions/checkout@v2
70+
with:
71+
fetch-depth: 0
72+
73+
- name: Setup Java and Scala
74+
uses: olafurpg/setup-scala@v10
75+
with:
76+
java-version: ${{ matrix.java }}
77+
78+
- name: Cache ivy2
79+
uses: actions/cache@v1
80+
with:
81+
path: ~/.ivy2/cache
82+
key: ${{ runner.os }}-sbt-ivy-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
83+
84+
- name: Cache coursier (generic)
85+
uses: actions/cache@v1
86+
with:
87+
path: ~/.coursier/cache/v1
88+
key: ${{ runner.os }}-generic-sbt-coursier-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
89+
90+
- name: Cache coursier (linux)
91+
if: contains(runner.os, 'linux')
92+
uses: actions/cache@v1
93+
with:
94+
path: ~/.cache/coursier/v1
95+
key: ${{ runner.os }}-sbt-coursier-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
96+
97+
- name: Cache coursier (macOS)
98+
if: contains(runner.os, 'macos')
99+
uses: actions/cache@v1
100+
with:
101+
path: ~/Library/Caches/Coursier/v1
102+
key: ${{ runner.os }}-sbt-coursier-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
103+
104+
- name: Cache coursier (windows)
105+
if: contains(runner.os, 'windows')
106+
uses: actions/cache@v1
107+
with:
108+
path: ~/AppData/Local/Coursier/Cache/v1
109+
key: ${{ runner.os }}-sbt-coursier-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
110+
111+
- name: Cache sbt
112+
uses: actions/cache@v1
113+
with:
114+
path: ~/.sbt
115+
key: ${{ runner.os }}-sbt-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
116+
117+
- name: Setup scala native dependencies
118+
if: matrix.platform == 'native'
119+
run: sudo apt install clang libunwind-dev libgc-dev libre2-dev
120+
121+
- name: Check that workflows are up to date
122+
run: sbt ++${{ matrix.scala }} githubWorkflowCheck
123+
124+
- name: Run the build script
125+
env:
126+
PLATFORM: ${{ matrix.platform }}
127+
PLUGIN_VERSION: ${{ matrix.pluginversion }}
128+
TRAVIS_SCALA_VERSION: ${{ matrix.scala }}
129+
WORKERS: ${{ matrix.workers }}
130+
run: ./tools/travis-script.sh
131+
132+
examples:
133+
name: Examples
134+
strategy:
135+
matrix:
136+
os: [ubuntu-latest]
137+
scala: [2.13.3]
138+
139+
runs-on: ${{ matrix.os }}
140+
steps:
141+
- name: Checkout current branch (full)
142+
uses: actions/checkout@v2
143+
with:
144+
fetch-depth: 0
145+
146+
- name: Setup Java and Scala
147+
uses: olafurpg/setup-scala@v10
148+
with:
149+
java-version: ${{ matrix.java }}
150+
151+
- name: Cache ivy2
152+
uses: actions/cache@v1
153+
with:
154+
path: ~/.ivy2/cache
155+
key: ${{ runner.os }}-sbt-ivy-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
156+
157+
- name: Cache coursier (generic)
158+
uses: actions/cache@v1
159+
with:
160+
path: ~/.coursier/cache/v1
161+
key: ${{ runner.os }}-generic-sbt-coursier-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
162+
163+
- name: Cache coursier (linux)
164+
if: contains(runner.os, 'linux')
165+
uses: actions/cache@v1
166+
with:
167+
path: ~/.cache/coursier/v1
168+
key: ${{ runner.os }}-sbt-coursier-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
169+
170+
- name: Cache coursier (macOS)
171+
if: contains(runner.os, 'macos')
172+
uses: actions/cache@v1
173+
with:
174+
path: ~/Library/Caches/Coursier/v1
175+
key: ${{ runner.os }}-sbt-coursier-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
176+
177+
- name: Cache coursier (windows)
178+
if: contains(runner.os, 'windows')
179+
uses: actions/cache@v1
180+
with:
181+
path: ~/AppData/Local/Coursier/Cache/v1
182+
key: ${{ runner.os }}-sbt-coursier-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
183+
184+
- name: Cache sbt
185+
uses: actions/cache@v1
186+
with:
187+
path: ~/.sbt
188+
key: ${{ runner.os }}-sbt-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
189+
190+
- name: Build examples
191+
run: |
192+
cd examples
193+
for d in */ ; do cd "$d" && sbt test:compile && cd ../ ; done
194+
195+
bench:
196+
name: Bench
197+
strategy:
198+
matrix:
199+
os: [ubuntu-latest]
200+
scala: [0.27.0-RC1, 3.0.0-M1, 2.11.12, 2.12.10, 2.13.3]
201+
202+
runs-on: ${{ matrix.os }}
203+
steps:
204+
- name: Checkout current branch (full)
205+
uses: actions/checkout@v2
206+
with:
207+
fetch-depth: 0
208+
209+
- name: Setup Java and Scala
210+
uses: olafurpg/setup-scala@v10
211+
with:
212+
java-version: ${{ matrix.java }}
213+
214+
- name: Cache ivy2
215+
uses: actions/cache@v1
216+
with:
217+
path: ~/.ivy2/cache
218+
key: ${{ runner.os }}-sbt-ivy-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
219+
220+
- name: Cache coursier (generic)
221+
uses: actions/cache@v1
222+
with:
223+
path: ~/.coursier/cache/v1
224+
key: ${{ runner.os }}-generic-sbt-coursier-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
225+
226+
- name: Cache coursier (linux)
227+
if: contains(runner.os, 'linux')
228+
uses: actions/cache@v1
229+
with:
230+
path: ~/.cache/coursier/v1
231+
key: ${{ runner.os }}-sbt-coursier-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
232+
233+
- name: Cache coursier (macOS)
234+
if: contains(runner.os, 'macos')
235+
uses: actions/cache@v1
236+
with:
237+
path: ~/Library/Caches/Coursier/v1
238+
key: ${{ runner.os }}-sbt-coursier-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
239+
240+
- name: Cache coursier (windows)
241+
if: contains(runner.os, 'windows')
242+
uses: actions/cache@v1
243+
with:
244+
path: ~/AppData/Local/Coursier/Cache/v1
245+
key: ${{ runner.os }}-sbt-coursier-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
246+
247+
- name: Cache sbt
248+
uses: actions/cache@v1
249+
with:
250+
path: ~/.sbt
251+
key: ${{ runner.os }}-sbt-cache-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
252+
253+
- name: Run dubious benchmark suite
254+
run: 'sbt ++${{ matrix.scala }} ''bench/jmh:run -p genSize=0 -p seedCount=0 -bs 1 -wi 0 -i 1 -f 0 -t 1 -r 0 org.scalacheck.bench.GenBench'''

.github/workflows/clean.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# This file was automatically generated by sbt-github-actions using the
2+
# githubWorkflowGenerate task. You should add and commit this file to
3+
# your git repository. It goes without saying that you shouldn't edit
4+
# this file by hand! Instead, if you wish to make changes, you should
5+
# change your sbt build configuration to revise the workflow description
6+
# to meet your needs, then regenerate this file.
7+
8+
name: Clean
9+
10+
on: push
11+
12+
jobs:
13+
delete-artifacts:
14+
name: Delete Artifacts
15+
runs-on: ubuntu-latest
16+
env:
17+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18+
steps:
19+
- name: Delete artifacts
20+
run: |
21+
# Customize those three lines with your repository and credentials:
22+
REPO=${GITHUB_API_URL}/repos/${{ github.repository }}
23+
24+
# A shortcut to call GitHub API.
25+
ghapi() { curl --silent --location --user _:$GITHUB_TOKEN "$@"; }
26+
27+
# A temporary file which receives HTTP response headers.
28+
TMPFILE=/tmp/tmp.$$
29+
30+
# An associative array, key: artifact name, value: number of artifacts of that name.
31+
declare -A ARTCOUNT
32+
33+
# Process all artifacts on this repository, loop on returned "pages".
34+
URL=$REPO/actions/artifacts
35+
while [[ -n "$URL" ]]; do
36+
37+
# Get current page, get response headers in a temporary file.
38+
JSON=$(ghapi --dump-header $TMPFILE "$URL")
39+
40+
# Get URL of next page. Will be empty if we are at the last page.
41+
URL=$(grep '^Link:' "$TMPFILE" | tr ',' '\n' | grep 'rel="next"' | head -1 | sed -e 's/.*<//' -e 's/>.*//')
42+
rm -f $TMPFILE
43+
44+
# Number of artifacts on this page:
45+
COUNT=$(( $(jq <<<$JSON -r '.artifacts | length') ))
46+
47+
# Loop on all artifacts on this page.
48+
for ((i=0; $i < $COUNT; i++)); do
49+
50+
# Get name of artifact and count instances of this name.
51+
name=$(jq <<<$JSON -r ".artifacts[$i].name?")
52+
ARTCOUNT[$name]=$(( $(( ${ARTCOUNT[$name]} )) + 1))
53+
54+
id=$(jq <<<$JSON -r ".artifacts[$i].id?")
55+
size=$(( $(jq <<<$JSON -r ".artifacts[$i].size_in_bytes?") ))
56+
printf "Deleting '%s' #%d, %'d bytes\n" $name ${ARTCOUNT[$name]} $size
57+
ghapi -X DELETE $REPO/actions/artifacts/$id
58+
done
59+
done

.github/workflows/examples.yml

Lines changed: 0 additions & 40 deletions
This file was deleted.

0 commit comments

Comments
 (0)