Skip to content

Commit 0399bee

Browse files
authored
autowire for scala3 (#345)
1 parent 5ea6867 commit 0399bee

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1296
-494
lines changed

.github/labeler.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: 1
2+
labels:
3+
- label: "automerge"
4+
authors: ["softwaremill-ci"]
5+
files:
6+
- "build.sbt"
7+
- "project/plugins.sbt"
8+
- "project/build.properties"
9+
- label: "dependency"
10+
authors: ["softwaremill-ci"]
11+
files:
12+
- "build.sbt"
13+
- "project/plugins.sbt"
14+
- "project/build.properties"

.github/workflows/ci.yml

Lines changed: 57 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -7,69 +7,49 @@ on:
77
tags: [v*]
88
jobs:
99
ci:
10-
# run on external PRs, but not on internal PRs since those will be run by push to branch
11-
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
12-
runs-on: ubuntu-20.04
10+
# run on 1) push, 2) external PRs, 3) softwaremill-ci PRs
11+
# do not run on internal, non-steward PRs since those will be run by push to branch
12+
if: |
13+
github.event_name == 'push' ||
14+
github.event.pull_request.head.repo.full_name != github.repository ||
15+
github.event.pull_request.user.login == 'softwaremill-ci'
16+
runs-on: ubuntu-22.04
1317
strategy:
1418
matrix:
15-
java: [ '8', '11', '17' ]
19+
java: [ '11', '17', '21' ]
1620
fail-fast: false
1721
steps:
18-
- name: Set environment variables for Java 8
19-
if: matrix.java == '8'
20-
run: echo 'JAVA_OPTS=-Xmx5G' >> $GITHUB_ENV
21-
- name: Set environment variables for Java 9+
22-
if: matrix.java != '8'
22+
- name: Set environment variables for Java
2323
run: echo 'JAVA_OPTS=-Xmx5G --add-opens java.base/java.lang=ALL-UNNAMED' >> $GITHUB_ENV
2424
- name: Checkout
25-
uses: actions/checkout@v2
25+
uses: actions/checkout@v4
2626
- name: Set up JDK
27-
uses: actions/setup-java@v2
27+
uses: actions/setup-java@v4
2828
with:
29-
distribution: 'adopt'
29+
distribution: 'zulu'
3030
java-version: ${{ matrix.java }}
31-
- name: Cache sbt
32-
uses: actions/cache@v2
33-
with:
34-
path: |
35-
~/.sbt
36-
~/.ivy2/cache
37-
~/.coursier
38-
key: sbt-cache-${{ runner.os }}-${{ hashFiles('project/build.properties') }}-${{ matrix.java }}
31+
cache: 'sbt'
3932
- name: Compile
4033
run: sbt -v compile
4134
- name: Test
4235
run: sbt -v test
43-
- name: Cleanup
44-
run: |
45-
rm -rf "$HOME/.ivy2/local" || true
46-
find $HOME/.ivy2/cache -name "ivydata-*.properties" -delete || true
47-
find $HOME/.ivy2/cache -name "*-LM-SNAPSHOT*" -delete || true
48-
find $HOME/.cache/coursier/v1 -name "ivydata-*.properties" -delete || true
49-
find $HOME/.sbt -name "*.lock" -delete || true
5036

5137
publish:
5238
name: Publish release
5339
needs: [ci]
5440
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v'))
55-
runs-on: ubuntu-20.04
41+
runs-on: ubuntu-22.04
5642
env:
5743
JAVA_OPTS: -Xmx5G
5844
steps:
5945
- name: Checkout
60-
uses: actions/checkout@v2
61-
- name: Set up JDK 11
62-
uses: actions/setup-java@v1
63-
with:
64-
java-version: 11
65-
- name: Cache sbt
66-
uses: actions/cache@v2
46+
uses: actions/checkout@v4
47+
- name: Set up JDK 17
48+
uses: actions/setup-java@v4
6749
with:
68-
path: |
69-
~/.sbt
70-
~/.ivy2/cache
71-
~/.coursier
72-
key: sbt-cache-${{ runner.os }}-${{ hashFiles('project/build.properties') }}
50+
distribution: 'zulu'
51+
java-version: '17'
52+
cache: 'sbt'
7353
- name: Compile
7454
run: sbt compile
7555
- name: Publish artifacts
@@ -95,10 +75,41 @@ jobs:
9575
version: "v${{ env.VERSION }}"
9676
env:
9777
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
98-
- name: Cleanup
78+
79+
# `automerge` label is attached iff there is exactly one file changed by steward and this file belongs to a
80+
# whitelist specified by `labeler.yml`
81+
label:
82+
name: Attach automerge label
83+
# only for PRs by softwaremill-ci
84+
if: github.event.pull_request.user.login == 'softwaremill-ci'
85+
runs-on: ubuntu-22.04
86+
steps:
87+
- uses: actions/checkout@v4
88+
with:
89+
fetch-depth: 2
90+
# count number of files changed
91+
- name: Count number of files changed
92+
id: count-changed-files
9993
run: |
100-
rm -rf "$HOME/.ivy2/local" || true
101-
find $HOME/.ivy2/cache -name "ivydata-*.properties" -delete || true
102-
find $HOME/.ivy2/cache -name "*-LM-SNAPSHOT*" -delete || true
103-
find $HOME/.cache/coursier/v1 -name "ivydata-*.properties" -delete || true
104-
find $HOME/.sbt -name "*.lock" -delete || true
94+
N=$(git diff --name-only -r HEAD^1 HEAD | wc -w)
95+
echo "changed_files_num=$N" >> $GITHUB_OUTPUT
96+
- name: Launch labeler
97+
# skip if more than one file changed
98+
if: steps.count-changed-files.outputs.changed_files_num == 1
99+
uses: srvaroa/labeler@master
100+
env:
101+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
102+
103+
auto-merge:
104+
name: Auto merge
105+
# only for PRs by softwaremill-ci
106+
if: github.event.pull_request.user.login == 'softwaremill-ci'
107+
needs: [ ci, label ]
108+
runs-on: ubuntu-22.04
109+
steps:
110+
- id: automerge
111+
name: automerge
112+
uses: "pascalgn/[email protected]"
113+
env:
114+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
115+
MERGE_METHOD: "squash"

.github/workflows/scala-steward.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ jobs:
1111
runs-on: ubuntu-22.04
1212
steps:
1313
- name: Checkout
14-
uses: actions/checkout@v3
15-
- name: Set up JDK 11
16-
uses: actions/setup-java@v3
14+
uses: actions/checkout@v4
15+
- name: Set up JDK 17
16+
uses: actions/setup-java@v4
1717
with:
18-
distribution: 'temurin'
19-
java-version: 11
18+
distribution: 'zulu'
19+
java-version: 17
2020
cache: 'sbt'
2121
- name: Launch Scala Steward
2222
uses: scala-steward-org/scala-steward-action@v2

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,9 @@
44
target
55
out
66
.sbt
7-
.bsp
7+
.bsp
8+
.bloop
9+
.metals
10+
.vscode
11+
metals.sbt
12+
Workpad.scala

.scala-steward.conf

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
updates.ignore = [
2-
{groupId = "org.scala-lang", artifactId = "scala-compiler", version = "2.12."},
3-
{groupId = "org.scala-lang", artifactId = "scala-compiler", version = "2.13."},
4-
{groupId = "org.scala-lang", artifactId = "scala-compiler", version = "3."}
5-
]
61
updates.pin = [
7-
{groupId = "org.scala-lang", artifactId = "scala3-library", version = "3.3."}
2+
{groupId = "com.typesafe.akka", version = "2.6."},
3+
{groupId = "org.scala-lang", artifactId = "scala3-library", version = "3.3."},
4+
{groupId = "org.scala-lang", artifactId = "scala3-library_sjs1", version = "3.3."},
5+
{groupId = "org.scala-lang", artifactId = "scala-library", version = "2.13."}
86
]

.scalafmt.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version = 3.0.7
1+
version = 3.8.3
22
maxColumn = 120
33
runner.dialect = scala3
44
fileOverride {

0 commit comments

Comments
 (0)