diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 92e2682..3e19697 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -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/') @@ -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 @@ -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/create-release@v1.1.4 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token diff --git a/.mill-version b/.mill-version index ac454c6..43c2417 100644 --- a/.mill-version +++ b/.mill-version @@ -1 +1 @@ -0.12.0 +0.12.5 diff --git a/build.mill b/build.mill index b9c0612..0e3820c 100644 --- a/build.mill +++ b/build.mill @@ -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", @@ -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) } diff --git a/requests/test/src/requests/RequestTests.scala b/requests/test/src/requests/RequestTests.scala index 32dd5ec..cae8151 100644 --- a/requests/test/src/requests/RequestTests.scala +++ b/requests/test/src/requests/RequestTests.scala @@ -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) }