Skip to content

Commit dde1fdf

Browse files
committed
github actions refactor
1 parent 25e7dfa commit dde1fdf

File tree

2 files changed

+21
-168
lines changed

2 files changed

+21
-168
lines changed

.github/workflows/ci.yml

Lines changed: 18 additions & 150 deletions
Original file line numberDiff line numberDiff line change
@@ -6,178 +6,46 @@ on:
66
branches: ['**']
77
tags: [v*]
88
jobs:
9-
ci:
9+
build:
10+
uses: softwaremill/github-actions-workflows/.github/workflows/build-scala.yml@main
1011
# run on 1) push, 2) external PRs, 3) softwaremill-ci PRs
1112
# do not run on internal, non-steward PRs since those will be run by push to branch
1213
if: |
1314
github.event_name == 'push' ||
1415
github.event.pull_request.head.repo.full_name != github.repository ||
1516
github.event.pull_request.user.login == 'softwaremill-ci'
16-
runs-on: ubuntu-20.04
17-
env:
18-
STTP_NATIVE: 1
19-
steps:
20-
- name: Set Java Opts
21-
run: |
22-
echo "JAVA_OPTS=-Xmx3000M -Dsbt.task.timings=true" >> $GITHUB_ENV
23-
- name: Checkout
24-
uses: actions/checkout@v2
25-
- name: Set up JDK 11
26-
uses: actions/setup-java@v1
27-
with:
28-
java-version: 11
29-
- name: Cache sbt
30-
uses: actions/cache@v2
31-
with:
32-
path: |
33-
~/.sbt
34-
~/.ivy2/cache
35-
~/.coursier
36-
key: sbt-cache-${{ runner.os }}-${{ hashFiles('project/build.properties') }}
37-
- name: Install libidn11-dev
38-
run: sudo apt-get install libidn11-dev
39-
- name: Compile
40-
run: sbt -v compile
41-
- name: Test
42-
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
17+
with:
18+
java-opts: '-Xmx3000M -Dsbt.task.timings=true'
19+
sttp-native: 1
20+
install-libidn11: true
5021

5122
mima:
23+
uses: softwaremill/github-actions-workflows/.github/workflows/mima.yml@main
5224
# run on 1) push, 2) external PRs, 3) softwaremill-ci PRs
5325
# do not run on internal, non-steward PRs since those will be run by push to branch
5426
if: |
5527
github.event_name == 'push' ||
5628
github.event.pull_request.head.repo.full_name != github.repository ||
5729
github.event.pull_request.user.login == 'softwaremill-ci'
58-
runs-on: ubuntu-20.04
59-
steps:
60-
- name: Set Java Opts
61-
run: |
62-
echo "JAVA_OPTS=-Xmx3000M -Dsbt.task.timings=true" >> $GITHUB_ENV
63-
- name: Checkout
64-
uses: actions/checkout@v2
65-
with:
66-
fetch-depth: 0 # checkout tags so that dynver works properly (we need the version for MiMa)
67-
- name: Set up JDK 11
68-
uses: actions/setup-java@v1
69-
with:
70-
java-version: 11
71-
- name: Cache sbt
72-
uses: actions/cache@v2
73-
with:
74-
path: |
75-
~/.sbt
76-
~/.ivy2/cache
77-
~/.coursier
78-
key: sbt-cache-${{ runner.os }}-${{ hashFiles('project/build.properties') }}
79-
- name: Check MiMa # disable for major releases
80-
run: sbt -v mimaReportBinaryIssues
81-
- name: Cleanup
82-
run: |
83-
rm -rf "$HOME/.ivy2/local" || true
84-
find $HOME/.ivy2/cache -name "ivydata-*.properties" -delete || true
85-
find $HOME/.ivy2/cache -name "*-LM-SNAPSHOT*" -delete || true
86-
find $HOME/.cache/coursier/v1 -name "ivydata-*.properties" -delete || true
87-
find $HOME/.sbt -name "*.lock" -delete || true
30+
with:
31+
java-opts: '-Xmx3000M -Dsbt.task.timings=true'
8832

8933
publish:
90-
name: Publish release
91-
needs: [ci]
34+
uses: softwaremill/github-actions-workflows/.github/workflows/publish-release.yml@main
35+
needs: [build]
9236
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v'))
93-
runs-on: ubuntu-20.04
94-
env:
95-
STTP_NATIVE: 1
96-
steps:
97-
- name: Set Java Opts
98-
run: |
99-
echo "JAVA_OPTS=-Xmx3000M -Dsbt.task.timings=true" >> $GITHUB_ENV
100-
- name: Checkout
101-
uses: actions/checkout@v2
102-
- name: Set up JDK 11
103-
uses: actions/setup-java@v1
104-
with:
105-
java-version: 11
106-
- name: Cache sbt
107-
uses: actions/cache@v2
108-
with:
109-
path: |
110-
~/.sbt
111-
~/.ivy2/cache
112-
~/.coursier
113-
key: sbt-cache-${{ runner.os }}-${{ hashFiles('project/build.properties') }}
114-
- name: Compile
115-
run: sbt compile
116-
- name: Publish artifacts
117-
run: sbt ci-release
118-
env:
119-
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
120-
PGP_SECRET: ${{ secrets.PGP_SECRET }}
121-
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
122-
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
123-
- name: Extract version from commit message
124-
run: |
125-
version=${GITHUB_REF/refs\/tags\/v/}
126-
echo "VERSION=$version" >> $GITHUB_ENV
127-
env:
128-
COMMIT_MSG: ${{ github.event.head_commit.message }}
129-
- name: Publish release notes
130-
uses: release-drafter/release-drafter@v5
131-
with:
132-
config-name: release-drafter.yml
133-
publish: true
134-
name: "v${{ env.VERSION }}"
135-
tag: "v${{ env.VERSION }}"
136-
version: "v${{ env.VERSION }}"
137-
env:
138-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
139-
- name: Cleanup
140-
run: |
141-
rm -rf "$HOME/.ivy2/local" || true
142-
find $HOME/.ivy2/cache -name "ivydata-*.properties" -delete || true
143-
find $HOME/.ivy2/cache -name "*-LM-SNAPSHOT*" -delete || true
144-
find $HOME/.cache/coursier/v1 -name "ivydata-*.properties" -delete || true
145-
find $HOME/.sbt -name "*.lock" -delete || true
37+
secrets: inherit
38+
with:
39+
java-opts: "-Xmx3000M -Dsbt.task.timings=true"
40+
sttp-native: 1
14641

147-
# `automerge` label is attached iff there is exactly one file changed by steward and this file belongs to a
148-
# whitelist specified by `labeler.yml`
14942
label:
150-
name: Attach automerge label
15143
# only for PRs by softwaremill-ci
15244
if: github.event.pull_request.user.login == 'softwaremill-ci'
153-
runs-on: ubuntu-22.04
154-
steps:
155-
- uses: actions/checkout@v4
156-
with:
157-
fetch-depth: 2
158-
# count number of files changed
159-
- name: Count number of files changed
160-
id: count-changed-files
161-
run: |
162-
N=$(git diff --name-only -r HEAD^1 HEAD | wc -w)
163-
echo "changed_files_num=$N" >> $GITHUB_OUTPUT
164-
- name: Launch labeler
165-
# skip if more than one file changed
166-
if: steps.count-changed-files.outputs.changed_files_num == 1
167-
uses: srvaroa/labeler@master
168-
env:
169-
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
45+
uses: softwaremill/github-actions-workflows/.github/workflows/label.yml@main
17046

17147
auto-merge:
172-
name: Auto merge
17348
# only for PRs by softwaremill-ci
17449
if: github.event.pull_request.user.login == 'softwaremill-ci'
175-
needs: [ ci, mima, label ]
176-
runs-on: ubuntu-22.04
177-
steps:
178-
- id: automerge
179-
name: automerge
180-
uses: "pascalgn/[email protected]"
181-
env:
182-
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
183-
MERGE_METHOD: "squash"
50+
needs: [ build, mima, label ]
51+
uses: softwaremill/github-actions-workflows/.github/workflows/auto-merge.yml@main

.github/workflows/scala-steward.yml

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,6 @@ on:
88

99
jobs:
1010
scala-steward:
11-
runs-on: ubuntu-22.04
12-
steps:
13-
- name: Checkout
14-
uses: actions/checkout@v3
15-
- name: Set up JDK 11
16-
uses: actions/setup-java@v3
17-
with:
18-
distribution: 'temurin'
19-
java-version: 11
20-
cache: 'sbt'
21-
- name: Launch Scala Steward
22-
uses: scala-steward-org/scala-steward-action@v2
23-
with:
24-
author-name: scala-steward
25-
author-email: scala-steward
26-
github-token: ${{ secrets.REPO_GITHUB_TOKEN }}
27-
repo-config: .scala-steward.conf
28-
ignore-opts-files: false
11+
uses: softwaremill/github-actions-workflows/.github/workflows/scala-steward.yml@main
12+
secrets:
13+
repo-github-token: ${{secrets.REPO_GITHUB_TOKEN}}

0 commit comments

Comments
 (0)