Skip to content

Commit

Permalink
Merge pull request #670 from mkurz/reusable-workflows
Browse files Browse the repository at this point in the history
Switch to reusable workflows
  • Loading branch information
mkurz authored Apr 11, 2022
2 parents 36cc7f5 + 80a918b commit 0ef82f6
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 124 deletions.
102 changes: 19 additions & 83 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Pull Requests
name: Check

on:
pull_request:
Expand All @@ -10,95 +10,31 @@ concurrency:

jobs:
check-code-style:
name: Check / Code Style
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
# we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves
fetch-depth: 0

- name: Set up JDK 11
uses: olafurpg/setup-scala@v13
with:
java-version: adopt@1.11

- name: Cache Coursier cache
uses: coursier/cache-action@v6.2

- name: Code validations
run: sbt validateCode
name: Code Style
uses: playframework/.github/.github/workflows/sbt.yml@main
with:
cmd: sbt validateCode

check-binary-compatibility:
name: Check / Binary Compatibility
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
# we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves
fetch-depth: 0

- name: Set up JDK 11
uses: olafurpg/setup-scala@v13
with:
java-version: adopt@1.11

- name: Cache Coursier cache
uses: coursier/cache-action@v6.2

- name: MiMa validations
run: sbt mimaReportBinaryIssues
name: Binary Compatibility
uses: playframework/.github/.github/workflows/binary-check.yml@main

check-docs:
name: Check / Docs
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
# we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves
fetch-depth: 0

- name: Set up JDK 11
uses: olafurpg/setup-scala@v13
with:
java-version: adopt@1.11

- name: Cache Coursier cache
uses: coursier/cache-action@v6.2

- name: Docs validations
run: sbt doc
name: Docs
uses: playframework/.github/.github/workflows/sbt.yml@main
with:
cmd: sbt doc

tests:
runs-on: ubuntu-20.04
name: Tests
needs: # Waiting more lightweight checks
- "check-code-style"
- "check-binary-compatibility"
- "check-docs"
strategy:
matrix:
jdk: [ 11, 8 ]
scala: [ 2.13.8, 3.1.1 ] # Should be sync with Mergify conditions (.mergify.yml)
name: Check / Tests (Scala ${{ matrix.scala }} & JDK ${{ matrix.jdk }})
steps:
- name: Checkout
uses: actions/checkout@v2
with:
# we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves
fetch-depth: 0

- name: Set up JDK ${{ matrix.jdk }}
uses: olafurpg/setup-scala@v13
with:
java-version: adopt@1.${{ matrix.jdk }}

- name: Cache Coursier cache
uses: coursier/cache-action@v6.2

- name: Tests
run: sbt ++$SCALA_VERSION 'testOnly -- xonly timefactor 5'
env:
SCALA_VERSION: ${{ matrix.scala }}
uses: playframework/.github/.github/workflows/sbt-matrix.yml@main
with: # Should be sync with Mergify conditions (.mergify.yml)
java: >-
[ "11", "8" ]
scala: >-
[ "2.13.8", "3.1.2-RC3" ]
cmd: sbt ++$SCALA_VERSION 'testOnly -- xonly timefactor 5'
29 changes: 6 additions & 23 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,9 @@ on:
jobs:
publish-artifacts:
name: Publish / Artifacts
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
with:
# we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves
fetch-depth: 0

- name: Set up JDK 8
uses: olafurpg/setup-scala@v13
with:
java-version: adopt@1.8

- name: Cache Coursier cache
uses: coursier/cache-action@v6.2

- name: Publish artifcats
run: sbt ci-release
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
uses: playframework/.github/.github/workflows/publish.yml@main
secrets:
username: ${{ secrets.SONATYPE_USERNAME }}
password: ${{ secrets.SONATYPE_PASSWORD }}
pgp_passphrase: ${{ secrets.PGP_PASSPHRASE }}
pgp_secret: ${{ secrets.PGP_SECRET }}
28 changes: 14 additions & 14 deletions .mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@ queue_rules:
- name: default
conditions:
# Conditions to get out of the queue (= merged)
- check-success=Check / Code Style
- check-success=Check / Binary Compatibility
- check-success=Check / Docs
- check-success~=^Check / Tests \(Scala 2\.13\.(\d+) & JDK 11\)$
- check-success~=^Check / Tests \(Scala 3\.(\d+)\.(\d+) & JDK 11\)$
- check-success~=^Check / Tests \(Scala 2\.13\.(\d+) & JDK 8\)$
- check-success~=^Check / Tests \(Scala 3\.(\d+)\.(\d+) & JDK 8\)$
- check-success~=^Code Style / JDK (\d+)$
- check-success~=^Binary Compatibility / JDK (\d+)$
- check-success~=^Docs / JDK (\d+)$
- check-success~=^Tests / Scala 2\.13\.(\d+) & JDK 11$
- check-success~=^Tests / Scala 3\.(\d+)\.(\d+)(-RC\d+)? & JDK 11$
- check-success~=^Tests / Scala 2\.13\.(\d+) & JDK 8$
- check-success~=^Tests / Scala 3\.(\d+)\.(\d+)(-RC\d+)? & JDK 8$

pull_request_rules:
- name: Merge PRs that are ready
conditions:
- check-success=Check / Code Style
- check-success=Check / Binary Compatibility
- check-success=Check / Docs
- check-success~=^Check / Tests \(Scala 2\.13\.(\d+) & JDK 11\)$
- check-success~=^Check / Tests \(Scala 3\.(\d+)\.(\d+) & JDK 11\)$
- check-success~=^Check / Tests \(Scala 2\.13\.(\d+) & JDK 8\)$
- check-success~=^Check / Tests \(Scala 3\.(\d+)\.(\d+) & JDK 8\)$
- check-success~=^Code Style / JDK (\d+)$
- check-success~=^Binary Compatibility / JDK (\d+)$
- check-success~=^Docs / JDK (\d+)$
- check-success~=^Tests / Scala 2\.13\.(\d+) & JDK 11$
- check-success~=^Tests / Scala 3\.(\d+)\.(\d+)(-RC\d+)? & JDK 11$
- check-success~=^Tests / Scala 2\.13\.(\d+) & JDK 8$
- check-success~=^Tests / Scala 3\.(\d+)\.(\d+)(-RC\d+)? & JDK 8$
- status-success=typesafe-cla-validator
- "#approved-reviews-by>=1"
- "#review-requested=0"
Expand Down
12 changes: 8 additions & 4 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,14 @@ val scalacOpts = Def.setting[Seq[String]] {
}

lazy val mimaSettings = Seq(
mimaPreviousArtifacts := Set(
organization.value %% name.value % previousStableVersion.value
.getOrElse(throw new Error("Unable to determine previous version"))
),
mimaPreviousArtifacts := {
if (scalaBinaryVersion.value == "3") Set.empty[ModuleID]
else
Set(
organization.value %% name.value % previousStableVersion.value
.getOrElse(throw new Error("Unable to determine previous version"))
)
},
// these exclusions are only for main branch and are targeting 2.2.x
mimaBinaryIssueFilters ++= Seq(
ProblemFilters.exclude[DirectMissingMethodProblem](
Expand Down

0 comments on commit 0ef82f6

Please sign in to comment.