diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 97a141e81..d12e35492 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,8 @@ on: pull_request: branches: ['**'] push: - branches: ['**'] + branches: ['master'] + tags: ['v*'] env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -26,31 +27,14 @@ jobs: java: [adopt@1.8] runs-on: ${{ matrix.os }} steps: - - name: Checkout current branch (full) - uses: actions/checkout@v2 + - uses: actions/checkout@v2 with: fetch-depth: 0 - - - name: Setup Java and Scala - uses: olafurpg/setup-scala@v13 + - uses: coursier/cache-action@v6 + - uses: olafurpg/setup-scala@v13 with: java-version: ${{ matrix.java }} - - name: Cache sbt - uses: actions/cache@v2 - 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: Check that workflows are up to date - run: sbt ++${{ matrix.scala }} githubWorkflowCheck - - name: Setup Python uses: actions/setup-python@v2 with: @@ -75,40 +59,28 @@ jobs: strategy: matrix: os: [ubuntu-latest] - scala: [2.12.15] + scala: [2.12.15, 2.13.6] java: [adopt@1.8] runs-on: ${{ matrix.os }} steps: - - name: Checkout current branch (full) - uses: actions/checkout@v2 + - uses: actions/checkout@v2 with: fetch-depth: 0 - - - name: Setup Java and Scala - uses: olafurpg/setup-scala@v13 + - uses: coursier/cache-action@v6 + - uses: olafurpg/setup-scala@v13 with: java-version: ${{ matrix.java }} - - name: Cache sbt - uses: actions/cache@v2 - 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: Publish artifacts - if: ${{ env.SONATYPE_PASSWORD != '' && env.SONATYPE_USERNAME != '' }} + - name: Release + run: sbt ++${{ matrix.scala }} ci-release env: PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} PGP_SECRET: ${{ secrets.PGP_SECRET }} SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} - run: sbt ++${{ matrix.scala }} ci-release + CI_SNAPSHOT_RELEASE: "frameless-publish" + CI_RELEASE: "frameless-publishSigned" + if: ${{ env.SONATYPE_PASSWORD != '' && env.SONATYPE_USERNAME != '' }} docs: name: Documentation @@ -119,27 +91,13 @@ jobs: java: [adopt@1.8] runs-on: ${{ matrix.os }} steps: - - name: Checkout current branch (full) - uses: actions/checkout@v2 + - uses: actions/checkout@v2 with: fetch-depth: 0 - - - name: Setup Java and Scala - uses: olafurpg/setup-scala@v13 + - uses: coursier/cache-action@v6 + - uses: olafurpg/setup-scala@v13 with: java-version: ${{ matrix.java }} - - name: Cache sbt - uses: actions/cache@v2 - 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: Documentation run: sbt ++${{ matrix.scala }} doc mdoc diff --git a/build.sbt b/build.sbt index 3090de012..902ce199a 100644 --- a/build.sbt +++ b/build.sbt @@ -365,63 +365,3 @@ lazy val copyReadmeImpl = Def.task { sbt.IO.copy(List((from, to)), overwrite = true, preserveLastModified = true, preserveExecutable = true) } copyReadme := copyReadmeImpl.value - -ThisBuild / githubWorkflowArtifactUpload := false - -ThisBuild / githubWorkflowBuild := Seq( - WorkflowStep.Use( - UseRef.Public("actions", "setup-python", "v2"), - name = Some("Setup Python"), - params = Map("python-version" -> "3.x") - ), - WorkflowStep.Run( - List("pip install codecov"), - name = Some("Setup codecov") - ), - WorkflowStep.Sbt( - List("coverage", "frameless-test"), - name = Some("Test & Compute Coverage") - ), - WorkflowStep.Run( - List("codecov -F ${{ matrix.scala }}"), - name = Some("Upload Codecov Results") - ) -) - -ThisBuild / githubWorkflowBuild += WorkflowStep.Sbt( - List("frameless-mimaReportBinaryIssues"), - name = Some("Binary compatibility check") -) - -ThisBuild / githubWorkflowPublishTargetBranches := Seq( - RefPredicate.Equals(Ref.Branch("master")), - RefPredicate.StartsWith(Ref.Tag("v")) -) - -ThisBuild / githubWorkflowPublish := Seq( - WorkflowStep.Sbt( - List("ci-release"), - name = Some("Publish artifacts"), - env = Map( - "PGP_PASSPHRASE" -> "${{ secrets.PGP_PASSPHRASE }}", - "PGP_SECRET" -> "${{ secrets.PGP_SECRET }}", - "SONATYPE_PASSWORD" -> "${{ secrets.SONATYPE_PASSWORD }}", - "SONATYPE_USERNAME" -> "${{ secrets.SONATYPE_USERNAME }}" - ), - cond = Some("${{ env.SONATYPE_PASSWORD != '' && env.SONATYPE_USERNAME != '' }}") - ) -) - -ThisBuild / githubWorkflowAddedJobs ++= Seq( - WorkflowJob( - "docs", - "Documentation", - githubWorkflowJobSetup.value.toList ::: List( - WorkflowStep.Sbt( - List("doc", "mdoc"), - name = Some("Documentation") - ) - ), - scalas = List(Scala212) - ) -) diff --git a/project/plugins.sbt b/project/plugins.sbt index 18c704c65..58468235a 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,5 +1,4 @@ -addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.10") +addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.10") addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.9.1") -addSbtPlugin("com.codecommit" % "sbt-github-actions" % "0.13.0") addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.2.24") addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.0.1")