Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Upgrade build deps to ensure compatible with Scala Native #178

Merged
merged 10 commits into from
Jan 8, 2025
33 changes: 20 additions & 13 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,40 @@ on:
pull_request:
branches:
- master
workflow_dispatch: # be able to manually trigger a workflow run

env:
SCALA_NEXT_VERSION: '3.6.2'
# TODO: perherps, it would be nice to allow failure on `SCALA_NEXT_VERSION` as a warning
# to avoid too strict dev experiences in the future improvements.

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
java: ['11', '17']
java: ['11', '17', '21']
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
- name: Run tests
run: ./mill -i __.publishArtifacts + __.test
run: ./mill -i -DscalaNextVersion=${{ env.SCALA_NEXT_VERSION }} __.publishArtifacts + __.test

check-binary-compatibility:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 11
java-version: 17
- name: Check Binary Compatibility
run: ./mill -i __.mimaReportBinaryIssues
run: ./mill -i -DscalaNextVersion=${{ env.SCALA_NEXT_VERSION }} __.mimaReportBinaryIssues

publish-sonatype:
if: github.repository == 'com-lihaoyi/requests-scala' && contains(github.ref, 'refs/tags/')
Expand All @@ -47,12 +53,12 @@ jobs:
SONATYPE_PGP_PRIVATE_KEY_PASSWORD: ${{ secrets.SONATYPE_PGP_PRIVATE_KEY_PASSWORD }}
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
LANG: "en_US.UTF-8"
LC_MESSAGES: "en_US.UTF-8"
LC_ALL: "en_US.UTF-8"
LANG: 'en_US.UTF-8'
LC_MESSAGES: 'en_US.UTF-8'
LC_ALL: 'en_US.UTF-8'
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 11
Expand All @@ -73,6 +79,7 @@ jobs:
fi
- name: Create GitHub Release
id: create_gh_release
# WARN: `actions/create-release` is currently unmaintained. It just works now, keep it until it breaks.
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
Expand Down
2 changes: 1 addition & 1 deletion .mill-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.12.0
0.12.5
69 changes: 47 additions & 22 deletions build.mill
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
package build

import mill._
import mill.scalalib._
import mill.scalalib.publish.{Developer, License, PomSettings, VersionControl}
import scalalib._
import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::0.4.0`
import $ivy.`com.github.lolgab::mill-mima::0.0.23`

import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::0.4.1`
import $ivy.`com.github.lolgab::mill-mima::0.0.24`

import de.tobiasroeser.mill.vcs.version.VcsVersion
import com.github.lolgab.mill.mima._

val dottyVersion = sys.props.get("dottyVersion")
val scalaNextVersion = sys.props.get("scalaNextVersion")
val scalaVersions = List("2.12.20", "2.13.15", "3.3.4") ++ scalaNextVersion
val scalaNativeVer = "0.5.6"

val scalaVersions = List("2.12.17", "2.13.10", "2.11.12", "3.1.1") ++ dottyVersion
trait MimaCheck extends Mima {
def mimaPreviousVersions = Seq("0.6.9", "0.7.0", "0.7.1", "0.8.0","0.8.2", "0.9.0").distinct

object requests extends Cross[RequestsModule](scalaVersions)
trait RequestsModule extends CrossScalaModule with PublishModule with Mima {
def publishVersion = VcsVersion.vcsState().format()
def mimaPreviousVersions =
(
Seq("0.7.0", "0.7.1", "0.8.2") ++
Option.when(VcsVersion.vcsState().commitsSinceLastTag != 0)(VcsVersion.vcsState().lastTag).flatten
).distinct
override def mimaBinaryIssueFilters = Seq(
ProblemFilter.exclude[ReversedMissingMethodProblem]("requests.BaseSession.send"),
ProblemFilter.exclude[DirectMissingMethodProblem]("requests.Response.string")
ProblemFilter.exclude[DirectMissingMethodProblem]("requests.Response.string"),
)
}

trait RequestsPublishModule extends PublishModule with MimaCheck {
def artifactName = "requests"

def publishVersion = VcsVersion.vcsState().format()

def pomSettings = PomSettings(
description = "Scala port of the popular Python Requests HTTP client",
Expand All @@ -32,17 +35,39 @@ trait RequestsModule extends CrossScalaModule with PublishModule with Mima {
licenses = Seq(License.MIT),
versionControl = VersionControl.github("com-lihaoyi", "requests-scala"),
developers = Seq(
Developer("lihaoyi", "Li Haoyi","https://github.com/lihaoyi")
Developer("lihaoyi", "Li Haoyi", "https://github.com/lihaoyi")
)
)

def ivyDeps = Agg(ivy"com.lihaoyi::geny::1.0.0")
def ivyDeps = Agg(ivy"com.lihaoyi::geny::1.1.1")
}

object test extends ScalaTests with TestModule.Utest {
def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.7.10",
ivy"com.lihaoyi::ujson::1.3.13",
ivy"com.dimafeng::testcontainers-scala-core:0.41.3"
)
trait RequestsCrossScalaModule extends CrossScalaModule with ScalaModule {
def millSourcePath = build.millSourcePath / "requests"
def sources = T.sources(millSourcePath / "src")
}

trait RequestsTestModule extends TestModule.Utest {
def ivyDeps = Agg(
ivy"com.lihaoyi::utest::0.7.10",
ivy"com.lihaoyi::ujson::1.3.13",
ivy"com.dimafeng::testcontainers-scala-core:0.41.3"
)
}

object requests extends Module {
trait RequestsJvmModule extends RequestsCrossScalaModule with RequestsPublishModule {
object test extends ScalaTests with RequestsTestModule
}
object jvm extends Cross[RequestsJvmModule](scalaVersions)

// trait RequestsNativeModule extends ScalaNativeModule with RequestsPublishModule {
// override def scalaNativeVersion = scalaNativeVer
//
// def ivyDeps =
// super.ivyDeps() ++ Agg(ivy"com.github.lolgab::scala-native-crypto::0.1.0")
//
// object test extends ScalaNativeTests with RequestsTestModule
// }
// object native extends Cross[RequestsNativeModule](scalaVersions)
}
2 changes: 1 addition & 1 deletion requests/test/src/requests/RequestTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ object RequestTests extends HttpbinTestSuite {
test("selfSignedCertificate"){
val res = requests.get(
"https://self-signed.badssl.com",
verifySslCerts = false
verifySslCerts = false,
)
assert(res.statusCode == 200)
}
Expand Down
Loading