Skip to content

Commit

Permalink
Update to sbt-typelevel 0.5.0 (#783)
Browse files Browse the repository at this point in the history
* Update to sbt-typelevel 0.5.0

compliation now fails for public implicit if type is not explicitelly
specified

* Move frequency to cron sytax

scala-steward validate-repo-config failed with previous syntax.
Use cron syntax for every month

* Update to RC7

* Fix RC7 update

* Update to v0.5.0-RC8

* Update to RC12

* Update to RC12
  • Loading branch information
RustedBones authored Aug 21, 2023
1 parent fae4eaf commit ad801e5
Show file tree
Hide file tree
Showing 18 changed files with 242 additions and 196 deletions.
243 changes: 135 additions & 108 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,74 +15,57 @@ on:
tags: [v*]

env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_CREDENTIAL_HOST: ${{ secrets.SONATYPE_CREDENTIAL_HOST }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}


concurrency:
group: ${{ github.workflow }} @ ${{ github.ref }}
cancel-in-progress: true

jobs:
build:
name: Build and Test
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.11, 2.12.18]
scala: [2.13, 2.12]
java: [corretto@17, corretto@11]
exclude:
- scala: 2.12.18
- scala: 2.12
java: corretto@11
runs-on: ${{ matrix.os }}
timeout-minutes: 60
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Download Java (corretto@17)
id: download-java-corretto-17
if: matrix.java == 'corretto@17'
uses: typelevel/download-java@v2
with:
distribution: corretto
java-version: 17

- name: Setup Java (corretto@17)
id: setup-java-corretto-17
if: matrix.java == 'corretto@17'
uses: actions/setup-java@v3
with:
distribution: jdkfile
distribution: corretto
java-version: 17
jdkFile: ${{ steps.download-java-corretto-17.outputs.jdkFile }}
cache: sbt

- name: Download Java (corretto@11)
id: download-java-corretto-11
if: matrix.java == 'corretto@11'
uses: typelevel/download-java@v2
with:
distribution: corretto
java-version: 11
- name: sbt update
if: matrix.java == 'corretto@17' && steps.setup-java-corretto-17.outputs.cache-hit == 'false'
run: sbt +update

- name: Setup Java (corretto@11)
id: setup-java-corretto-11
if: matrix.java == 'corretto@11'
uses: actions/setup-java@v3
with:
distribution: jdkfile
distribution: corretto
java-version: 11
jdkFile: ${{ steps.download-java-corretto-11.outputs.jdkFile }}
cache: sbt

- name: Cache sbt
uses: actions/cache@v3
with:
path: |
~/.sbt
~/.ivy2/cache
~/.coursier/cache/v1
~/.cache/coursier/v1
~/AppData/Local/Coursier/Cache/v1
~/Library/Caches/Coursier/v1
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
- name: sbt update
if: matrix.java == 'corretto@11' && steps.setup-java-corretto-11.outputs.cache-hit == 'false'
run: sbt +update

- name: Check that workflows are up to date
run: sbt githubWorkflowCheck
Expand All @@ -101,11 +84,11 @@ jobs:

- name: Make target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
run: mkdir -p test/target refined/target target shared/target tensorflow/target parquet/target tools/target protobuf/target jmh/target bigquery/target avro/target scalacheck/target datastore/target neo4j/target cats/target bigtable/target guava/target project/target
run: mkdir -p refined/target shared/target tensorflow/target parquet/target tools/target protobuf/target jmh/target bigquery/target avro/target scalacheck/target datastore/target neo4j/target cats/target bigtable/target guava/target project/target

- name: Compress target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
run: tar cf targets.tar test/target refined/target target shared/target tensorflow/target parquet/target tools/target protobuf/target jmh/target bigquery/target avro/target scalacheck/target datastore/target neo4j/target cats/target bigtable/target guava/target project/target
run: tar cf targets.tar refined/target shared/target tensorflow/target parquet/target tools/target protobuf/target jmh/target bigquery/target avro/target scalacheck/target datastore/target neo4j/target cats/target bigtable/target guava/target project/target

- name: Upload target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
Expand All @@ -121,7 +104,6 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.11]
java: [corretto@17]
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -130,141 +112,186 @@ jobs:
with:
fetch-depth: 0

- name: Download Java (corretto@17)
id: download-java-corretto-17
if: matrix.java == 'corretto@17'
uses: typelevel/download-java@v2
with:
distribution: corretto
java-version: 17

- name: Setup Java (corretto@17)
id: setup-java-corretto-17
if: matrix.java == 'corretto@17'
uses: actions/setup-java@v3
with:
distribution: jdkfile
distribution: corretto
java-version: 17
jdkFile: ${{ steps.download-java-corretto-17.outputs.jdkFile }}
cache: sbt

- name: Download Java (corretto@11)
id: download-java-corretto-11
if: matrix.java == 'corretto@11'
uses: typelevel/download-java@v2
with:
distribution: corretto
java-version: 11
- name: sbt update
if: matrix.java == 'corretto@17' && steps.setup-java-corretto-17.outputs.cache-hit == 'false'
run: sbt +update

- name: Setup Java (corretto@11)
id: setup-java-corretto-11
if: matrix.java == 'corretto@11'
uses: actions/setup-java@v3
with:
distribution: jdkfile
distribution: corretto
java-version: 11
jdkFile: ${{ steps.download-java-corretto-11.outputs.jdkFile }}
cache: sbt

- name: Cache sbt
uses: actions/cache@v3
with:
path: |
~/.sbt
~/.ivy2/cache
~/.coursier/cache/v1
~/.cache/coursier/v1
~/AppData/Local/Coursier/Cache/v1
~/Library/Caches/Coursier/v1
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

- name: Download target directories (2.13.11)
- name: sbt update
if: matrix.java == 'corretto@11' && steps.setup-java-corretto-11.outputs.cache-hit == 'false'
run: sbt +update

- name: Download target directories (2.13)
uses: actions/download-artifact@v3
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13.11
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13

- name: Inflate target directories (2.13.11)
- name: Inflate target directories (2.13)
run: |
tar xf targets.tar
rm targets.tar
- name: Download target directories (2.12.18)
- name: Download target directories (2.12)
uses: actions/download-artifact@v3
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.18
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12

- name: Inflate target directories (2.12.18)
- name: Inflate target directories (2.12)
run: |
tar xf targets.tar
rm targets.tar
- name: Import signing key
if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE == ''
env:
PGP_SECRET: ${{ secrets.PGP_SECRET }}
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
run: echo $PGP_SECRET | base64 -di | gpg --import

- name: Import signing key and strip passphrase
if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE != ''
env:
PGP_SECRET: ${{ secrets.PGP_SECRET }}
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
run: |
echo "$PGP_SECRET" | base64 -di > /tmp/signing-key.gpg
echo "$PGP_PASSPHRASE" | gpg --pinentry-mode loopback --passphrase-fd 0 --import /tmp/signing-key.gpg
(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)
- name: Publish
run: sbt '++ ${{ matrix.scala }}' tlCiRelease

avro-legacy:
name: Test with legacy avro
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_CREDENTIAL_HOST: ${{ secrets.SONATYPE_CREDENTIAL_HOST }}
run: sbt tlCiRelease

dependency-submission:
name: Submit Dependencies
if: github.event_name != 'pull_request'
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.11]
java: [corretto@11]
java: [corretto@17]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Download Java (corretto@17)
id: download-java-corretto-17
- name: Setup Java (corretto@17)
id: setup-java-corretto-17
if: matrix.java == 'corretto@17'
uses: typelevel/download-java@v2
uses: actions/setup-java@v3
with:
distribution: corretto
java-version: 17
cache: sbt

- name: sbt update
if: matrix.java == 'corretto@17' && steps.setup-java-corretto-17.outputs.cache-hit == 'false'
run: sbt +update

- name: Setup Java (corretto@11)
id: setup-java-corretto-11
if: matrix.java == 'corretto@11'
uses: actions/setup-java@v3
with:
distribution: corretto
java-version: 11
cache: sbt

- name: sbt update
if: matrix.java == 'corretto@11' && steps.setup-java-corretto-11.outputs.cache-hit == 'false'
run: sbt +update

- name: Submit Dependencies
uses: scalacenter/sbt-dependency-submission@v2
with:
modules-ignore: test_2.13 test_2.12 magnolify_2.13 magnolify_2.12
configs-ignore: test scala-tool scala-doc-tool test-internal

validate-steward:
name: Validate Steward Config
strategy:
matrix:
os: [ubuntu-latest]
java: [temurin@11]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (fast)
uses: actions/checkout@v3

- name: Setup Java (temurin@11)
id: setup-java-temurin-11
if: matrix.java == 'temurin@11'
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11

- uses: coursier/setup-action@v1
with:
apps: scala-steward

- run: scala-steward validate-repo-config .scala-steward.conf

avro-legacy:
name: Test with legacy avro
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.11]
java: [corretto@11]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup Java (corretto@17)
id: setup-java-corretto-17
if: matrix.java == 'corretto@17'
uses: actions/setup-java@v3
with:
distribution: jdkfile
distribution: corretto
java-version: 17
jdkFile: ${{ steps.download-java-corretto-17.outputs.jdkFile }}
cache: sbt

- name: Download Java (corretto@11)
id: download-java-corretto-11
if: matrix.java == 'corretto@11'
uses: typelevel/download-java@v2
with:
distribution: corretto
java-version: 11
- name: sbt update
if: matrix.java == 'corretto@17' && steps.setup-java-corretto-17.outputs.cache-hit == 'false'
run: sbt +update

- name: Setup Java (corretto@11)
id: setup-java-corretto-11
if: matrix.java == 'corretto@11'
uses: actions/setup-java@v3
with:
distribution: jdkfile
distribution: corretto
java-version: 11
jdkFile: ${{ steps.download-java-corretto-11.outputs.jdkFile }}
cache: sbt

- name: Cache sbt
uses: actions/cache@v3
with:
path: |
~/.sbt
~/.ivy2/cache
~/.coursier/cache/v1
~/.cache/coursier/v1
~/AppData/Local/Coursier/Cache/v1
~/Library/Caches/Coursier/v1
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
- name: sbt update
if: matrix.java == 'corretto@11' && steps.setup-java-corretto-11.outputs.cache-hit == 'false'
run: sbt +update

- name: Build project
env:
Expand Down
2 changes: 1 addition & 1 deletion .scala-steward.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ dependencyOverrides = [
# version includes revision date. reduce PR frequency
{
dependency = { groupId = "com.google.apis", artifactId = "google-api-services-bigquery" },
pullRequests = { frequency = "1 month" },
pullRequests = { frequency = "0 0 1 * ?" },
}
]
6 changes: 3 additions & 3 deletions avro/src/main/scala/magnolify/avro/unsafe/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ package magnolify.avro
import magnolify.shared._

package object unsafe {
implicit val afByte = AvroField.from[Int](_.toByte)(_.toInt)
implicit val afChar = AvroField.from[Int](_.toChar)(_.toInt)
implicit val afShort = AvroField.from[Int](_.toShort)(_.toInt)
implicit val afByte: AvroField[Byte] = AvroField.from[Int](_.toByte)(_.toInt)
implicit val afChar: AvroField[Char] = AvroField.from[Int](_.toChar)(_.toInt)
implicit val afShort: AvroField[Short] = AvroField.from[Int](_.toShort)(_.toInt)

implicit def afUnsafeEnum[T: EnumType]: AvroField[UnsafeEnum[T]] =
AvroField.from[String](UnsafeEnum.from[T])(UnsafeEnum.to[T])
Expand Down
Loading

0 comments on commit ad801e5

Please sign in to comment.