Skip to content

Commit 62d8fe9

Browse files
Merge pull request #161 from typelevel/typelevel-migration-the-second
Typelevel Migration II: return of the Typelevel migration
2 parents 0eb1cee + f2849ff commit 62d8fe9

File tree

11 files changed

+297
-133
lines changed

11 files changed

+297
-133
lines changed

.github/workflows/ci.yml

Lines changed: 156 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,166 @@
1-
name: CI
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
29

310
on:
4-
push:
511
pull_request:
12+
branches: ['**', '!update/**', '!pr/**']
13+
push:
14+
branches: ['**', '!update/**', '!pr/**']
15+
tags: [v*]
16+
17+
env:
18+
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
19+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
20+
SONATYPE_CREDENTIAL_HOST: ${{ secrets.SONATYPE_CREDENTIAL_HOST }}
21+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
22+
PGP_SECRET: ${{ secrets.PGP_SECRET }}
23+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
624

725
jobs:
826
build:
9-
runs-on: ubuntu-latest
10-
27+
name: Build and Test
1128
strategy:
1229
matrix:
13-
java-version: [8, 11, 17]
30+
os: [ubuntu-latest]
31+
scala: [2.12.18]
32+
java: [temurin@8]
33+
runs-on: ${{ matrix.os }}
34+
steps:
35+
- name: Checkout current branch (full)
36+
uses: actions/checkout@v3
37+
with:
38+
fetch-depth: 0
39+
40+
- name: Download Java (temurin@8)
41+
id: download-java-temurin-8
42+
if: matrix.java == 'temurin@8'
43+
uses: typelevel/download-java@v2
44+
with:
45+
distribution: temurin
46+
java-version: 8
47+
48+
- name: Setup Java (temurin@8)
49+
if: matrix.java == 'temurin@8'
50+
uses: actions/setup-java@v3
51+
with:
52+
distribution: jdkfile
53+
java-version: 8
54+
jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }}
55+
56+
- name: Cache sbt
57+
uses: actions/cache@v3
58+
with:
59+
path: |
60+
~/.sbt
61+
~/.ivy2/cache
62+
~/.coursier/cache/v1
63+
~/.cache/coursier/v1
64+
~/AppData/Local/Coursier/Cache/v1
65+
~/Library/Caches/Coursier/v1
66+
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
67+
68+
- name: Check that workflows are up to date
69+
run: sbt githubWorkflowCheck
70+
71+
- name: Check headers and formatting
72+
if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-latest'
73+
run: sbt '++ ${{ matrix.scala }}' headerCheckAll scalafmtCheckAll 'project /' scalafmtSbtCheck
74+
75+
- name: Test
76+
run: sbt '++ ${{ matrix.scala }}' test
77+
78+
- name: Check binary compatibility
79+
if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-latest'
80+
run: sbt '++ ${{ matrix.scala }}' mimaReportBinaryIssues
81+
82+
- name: Generate API documentation
83+
if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-latest'
84+
run: sbt '++ ${{ matrix.scala }}' doc
1485

86+
- name: Make target directories
87+
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
88+
run: mkdir -p plugin/target scalafix/rules/target target/sbt-tpolecat-scalafix-aggregate/target scalafix/output/target scalafix/tests/target target scalafix/input/target project/target
89+
90+
- name: Compress target directories
91+
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
92+
run: tar cf targets.tar plugin/target scalafix/rules/target target/sbt-tpolecat-scalafix-aggregate/target scalafix/output/target scalafix/tests/target target scalafix/input/target project/target
93+
94+
- name: Upload target directories
95+
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
96+
uses: actions/upload-artifact@v3
97+
with:
98+
name: target-${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }}
99+
path: targets.tar
100+
101+
publish:
102+
name: Publish Artifacts
103+
needs: [build]
104+
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
105+
strategy:
106+
matrix:
107+
os: [ubuntu-latest]
108+
java: [temurin@8]
109+
runs-on: ${{ matrix.os }}
15110
steps:
16-
- name: Checkout
17-
uses: actions/checkout@v2
18-
19-
- name: Download Java
20-
id: download-java
21-
uses: typelevel/download-java@v1
22-
with:
23-
distribution: temurin
24-
java-version: ${{ matrix.java-version }}
25-
26-
- name: Setup Java
27-
uses: actions/setup-java@v2
28-
with:
29-
distribution: jdkfile
30-
java-version: ${{ matrix.java-version }}
31-
jdkFile: ${{ steps.download-java.outputs.jdkFile }}
32-
33-
- name: Scalafmt
34-
run: sbt scalafmtCheckAll scalafmtSbtCheck
35-
36-
- name: Run tests
37-
run: |
38-
sbt headerCheck
39-
sbt test
40-
sbt mimaReportBinaryIssues
111+
- name: Checkout current branch (full)
112+
uses: actions/checkout@v3
113+
with:
114+
fetch-depth: 0
115+
116+
- name: Download Java (temurin@8)
117+
id: download-java-temurin-8
118+
if: matrix.java == 'temurin@8'
119+
uses: typelevel/download-java@v2
120+
with:
121+
distribution: temurin
122+
java-version: 8
123+
124+
- name: Setup Java (temurin@8)
125+
if: matrix.java == 'temurin@8'
126+
uses: actions/setup-java@v3
127+
with:
128+
distribution: jdkfile
129+
java-version: 8
130+
jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }}
131+
132+
- name: Cache sbt
133+
uses: actions/cache@v3
134+
with:
135+
path: |
136+
~/.sbt
137+
~/.ivy2/cache
138+
~/.coursier/cache/v1
139+
~/.cache/coursier/v1
140+
~/AppData/Local/Coursier/Cache/v1
141+
~/Library/Caches/Coursier/v1
142+
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
143+
144+
- name: Download target directories (2.12.18)
145+
uses: actions/download-artifact@v3
146+
with:
147+
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.18
148+
149+
- name: Inflate target directories (2.12.18)
150+
run: |
151+
tar xf targets.tar
152+
rm targets.tar
153+
154+
- name: Import signing key
155+
if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE == ''
156+
run: echo $PGP_SECRET | base64 -di | gpg --import
157+
158+
- name: Import signing key and strip passphrase
159+
if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE != ''
160+
run: |
161+
echo "$PGP_SECRET" | base64 -di > /tmp/signing-key.gpg
162+
echo "$PGP_PASSPHRASE" | gpg --pinentry-mode loopback --passphrase-fd 0 --import /tmp/signing-key.gpg
163+
(echo "$PGP_PASSPHRASE"; echo; echo) | gpg --command-fd 0 --pinentry-mode loopback --change-passphrase $(gpg --list-secret-keys --with-colons 2> /dev/null | grep '^sec:' | cut --delimiter ':' --fields 5 | tail -n 1)
164+
165+
- name: Publish
166+
run: sbt tlCiRelease

.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/release.yml

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

CHANGELOG.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,28 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Early Semantic Versioning](https://docs.scala-lang.org/overviews/core/binary-compatibility-for-library-authors.html#recommended-versioning-scheme) in addition to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [0.5.0]
8+
9+
### Changed
10+
11+
* The plugin artifact is now published under the `org.typelevel` group ID. An artifact migration has been added to Scala Steward, so Scala Steward users should not have to update the artifact group ID manually.
12+
13+
* The project now makes use of the [scalac-options](https://github.com/typelevel/scalac-options) library, so symbols relating to scalac options and their availability on differing Scala versions have been moved to the package `org.typelevel.scalacoptions`.
14+
15+
* All other symbols provided by this plugin have been moved to the `org.typelevel.sbt.tpolecat` package.
16+
17+
* A Scalafix migration is available, and can be applied using the `github:` scheme, e.g.
18+
19+
```bash
20+
$ scalafix github:typelevel/sbt-tpolecat/v0_5?sha=v0.5.0
21+
```
22+
23+
or via the `dependency:` scheme, e.g.
24+
25+
```bash
26+
$ scalafix dependency:[email protected]::sbt-tpolecat-scalafix:0.5.0
27+
```
28+
729
## [0.4.4]
830

931
### Added
@@ -146,7 +168,8 @@ Please do not use this release - GitHub accepted a tag push but not its correspo
146168

147169
* The `validFor` function that was previously exported via this plugin's `autoImport`.
148170

149-
[Unreleased]: https://github.com/typelevel/sbt-tpolecat/compare/v0.4.4...HEAD
171+
[Unreleased]: https://github.com/typelevel/sbt-tpolecat/compare/v0.5.0...HEAD
172+
[0.5.0]: https://github.com/typelevel/sbt-tpolecat/compare/v0.4.4...v0.5.0
150173
[0.4.4]: https://github.com/typelevel/sbt-tpolecat/compare/v0.4.3...v0.4.4
151174
[0.4.3]: https://github.com/typelevel/sbt-tpolecat/compare/v0.4.2...v0.4.3
152175
[0.4.2]: https://github.com/typelevel/sbt-tpolecat/compare/v0.4.1...v0.4.2

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ As of version 0.1.11, it also supports setting options for Scala 3.x.
1515
Add the following to your project's `project/plugins.sbt`:
1616

1717
```scala
18-
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.4.4")
18+
addSbtPlugin("org.typelevel" % "sbt-tpolecat" % "0.4.4")
1919
```
2020

2121
Once you are using this plugin we recommend that you don't manipulate the `scalacOptions` key directly.

0 commit comments

Comments
 (0)