Skip to content

Commit c644663

Browse files
authored
github actions workflows refactor (#383)
github actions workflows refactor
1 parent 1229575 commit c644663

File tree

2 files changed

+21
-165
lines changed

2 files changed

+21
-165
lines changed

.github/workflows/ci.yml

Lines changed: 18 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -6,175 +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-
JAVA_OPTS: -Xmx4G
20-
steps:
21-
- name: Checkout
22-
uses: actions/checkout@v2
23-
- name: Set up JDK 11
24-
uses: actions/setup-java@v1
25-
with:
26-
java-version: 11
27-
- name: Cache sbt
28-
uses: actions/cache@v2
29-
with:
30-
path: |
31-
~/.sbt
32-
~/.ivy2/cache
33-
~/.coursier
34-
key: sbt-cache-${{ runner.os }}-${{ hashFiles('project/build.properties') }}
35-
- name: Install libidn2-dev
36-
run: |
37-
sudo apt-get update
38-
sudo apt-get install libidn2-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: '-Xmx4G'
19+
sttp-native: 1
20+
install-libidn2: 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-
env:
60-
JAVA_OPTS: -Xmx4G
61-
steps:
62-
- name: Checkout
63-
uses: actions/checkout@v2
64-
with:
65-
fetch-depth: 0 # checkout tags so that dynver works properly (we need the version for MiMa)
66-
- name: Set up JDK 11
67-
uses: actions/setup-java@v1
68-
with:
69-
java-version: 11
70-
- name: Cache sbt
71-
uses: actions/cache@v2
72-
with:
73-
path: |
74-
~/.sbt
75-
~/.ivy2/cache
76-
~/.coursier
77-
key: sbt-cache-${{ runner.os }}-${{ hashFiles('project/build.properties') }}
78-
- name: Check MiMa # disable for major releases
79-
run: sbt -v mimaReportBinaryIssues
80-
- name: Cleanup
81-
run: |
82-
rm -rf "$HOME/.ivy2/local" || true
83-
find $HOME/.ivy2/cache -name "ivydata-*.properties" -delete || true
84-
find $HOME/.ivy2/cache -name "*-LM-SNAPSHOT*" -delete || true
85-
find $HOME/.cache/coursier/v1 -name "ivydata-*.properties" -delete || true
86-
find $HOME/.sbt -name "*.lock" -delete || true
30+
with:
31+
java-opts: "-Xmx4G"
8732

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

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

16847
auto-merge:
169-
name: Auto merge
17048
# only for PRs by softwaremill-ci
17149
if: github.event.pull_request.user.login == 'softwaremill-ci'
172-
needs: [ ci, mima, label ]
173-
runs-on: ubuntu-22.04
174-
steps:
175-
- id: automerge
176-
name: automerge
177-
uses: "pascalgn/[email protected]"
178-
env:
179-
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
180-
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)