Skip to content

Commit

Permalink
change ci
Browse files Browse the repository at this point in the history
  • Loading branch information
pjfanning committed Oct 28, 2023
1 parent fb96884 commit 295a8a7
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 65 deletions.
73 changes: 16 additions & 57 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,84 +17,57 @@ on:
env:
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.11, 2.12, 2.13, 3]
scala: [2.11.12, 2.12.18, 2.13.12, 3.3.1]
java: [zulu@8, zulu@11, zulu@17]
runs-on: ${{ matrix.os }}
timeout-minutes: 60
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v4
with:
fetch-depth: 0

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

- name: sbt update
if: matrix.java == 'zulu@8' && steps.setup-java-zulu-8.outputs.cache-hit == 'false'
run: sbt -J-Xmx2G +update

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

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

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

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

- name: Check that workflows are up to date
run: sbt -J-Xmx2G githubWorkflowCheck
run: sbt -J-Xmx2G '++ ${{ matrix.scala }}' githubWorkflowCheck

- run: sbt -J-Xmx2G '++ ${{ matrix.scala }}' test mimaReportBinaryIssues

- name: Make target directories
if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/2.') || startsWith(github.ref, 'refs/tags/v'))
run: mkdir -p target project/target

- name: Compress target directories
if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/2.') || startsWith(github.ref, 'refs/tags/v'))
run: tar cf targets.tar target project/target

- name: Upload target directories
if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/2.') || startsWith(github.ref, 'refs/tags/v'))
uses: actions/upload-artifact@v3
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }}
name: target-${{ matrix.os }}-${{ matrix.scala }}-${{ matrix.java }}
path: targets.tar

publish:
Expand All @@ -104,6 +77,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.12]
java: [zulu@8]
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -113,80 +87,65 @@ jobs:
fetch-depth: 0

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

- name: sbt update
if: matrix.java == 'zulu@8' && steps.setup-java-zulu-8.outputs.cache-hit == 'false'
run: sbt -J-Xmx2G +update

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

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

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

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

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

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

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

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

- name: Inflate target directories (3)
- name: Inflate target directories (3.3.1)
run: |
tar xf targets.tar
rm targets.tar
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/clean.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Delete artifacts
shell: bash {0}
run: |
# Customize those three lines with your repository and credentials:
REPO=${GITHUB_API_URL}/repos/${{ github.repository }}
Expand All @@ -25,7 +26,7 @@ jobs:
ghapi() { curl --silent --location --user _:$GITHUB_TOKEN "$@"; }
# A temporary file which receives HTTP response headers.
TMPFILE=/tmp/tmp.$$
TMPFILE=$(mktemp)
# An associative array, key: artifact name, value: number of artifacts of that name.
declare -A ARTCOUNT
Expand Down
4 changes: 2 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import com.typesafe.tools.mima.core._
import org.typelevel.sbt.gha.JavaSpec.Distribution.Zulu
import sbtghactions.JavaSpec.Distribution.Zulu

// Basic facts
name := "jackson-module-scala"
Expand Down Expand Up @@ -138,10 +138,10 @@ Compile / resourceGenerators += Def.task {

Test / parallelExecution := false

ThisBuild / tlSonatypeUseLegacyHost := true
ThisBuild / githubWorkflowSbtCommand := "sbt -J-Xmx2G"
ThisBuild / githubWorkflowJavaVersions := Seq(JavaSpec(Zulu, "8"), JavaSpec(Zulu, "11"), JavaSpec(Zulu, "17"))
ThisBuild / githubWorkflowBuild := Seq(WorkflowStep.Sbt(List("test", "mimaReportBinaryIssues")))
ThisBuild / githubWorkflowTargetTags ++= Seq("v*")
ThisBuild / githubWorkflowPublishTargetBranches := Seq(
RefPredicate.Equals(Ref.Branch("master")),
RefPredicate.StartsWith(Ref.Branch("2.")),
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.9.6
sbt.version=1.9.7
5 changes: 1 addition & 4 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.4.0")

addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.3")

addSbtPlugin("org.typelevel" % "sbt-typelevel-sonatype-ci-release" % "0.5.4")
addSbtPlugin("com.github.sbt" % "sbt-github-actions" % "0.19.0")

addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12")

addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.6.4")

0 comments on commit 295a8a7

Please sign in to comment.