Skip to content

Commit

Permalink
Setup GHA manually for Scala 3
Browse files Browse the repository at this point in the history
  • Loading branch information
jchyb committed Aug 4, 2022
1 parent 1169ca1 commit 7adc3b3
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 23 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/ci-scala3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# This file was based on ci.yml file, but is unmanaged by the sbt plugin
# and was edited manually. Should be removed when sangria-derivation will
# be merged for Scala 3

name: Continuous Integration (Scala 3)

on:
pull_request:
branches: ['**']
push:
branches: ['**']
tags: [v*]

jobs:
build:
name: Build and Test on Scala 3
strategy:
matrix:
os: [ubuntu-latest]
scala: [3.1.3]
java: [temurin@11]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup Java (temurin@11)
if: matrix.java == 'temurin@11'
uses: actions/setup-java@v2
with:
distribution: temurin
java-version: 11

- 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 binary compatibility
run: sbt ++${{ matrix.scala }} "sangria-ast/mimaReportBinaryIssues;sangria-parser/mimaReportBinaryIssues;sangria-core/mimaReportBinaryIssues"

- name: Check formatting
run: sbt ++${{ matrix.scala }} scalafmtCheckAll

- name: Build and test project
run: sbt ++${{ matrix.scala }} "sangria-parser/test;sangria-core/test"
17 changes: 4 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.12.16, 2.13.8, 3.1.3]
scala: [2.12.16, 2.13.8]
java: [temurin@11]
runs-on: ${{ matrix.os }}
steps:
Expand Down Expand Up @@ -60,7 +60,8 @@ jobs:
- name: Check that workflows are up to date
run: sbt ++${{ matrix.scala }} githubWorkflowCheck

- run: sbt ++${{ matrix.scala }} testAll
- name: Build project
run: sbt ++${{ matrix.scala }} test

- name: Compress target directories
run: tar cf targets.tar modules/core/target modules/parser/target modules/benchmarks/target modules/derivation/target modules/ast/target target modules/sangria/target project/target
Expand All @@ -78,7 +79,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [3.1.3]
scala: [2.13.8]
java: [temurin@11]
runs-on: ${{ matrix.os }}
steps:
Expand Down Expand Up @@ -126,16 +127,6 @@ jobs:
tar xf targets.tar
rm targets.tar
- name: Download target directories (3.1.3)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-3.1.3-${{ matrix.java }}

- name: Inflate target directories (3.1.3)
run: |
tar xf targets.tar
rm targets.tar
- env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
Expand Down
13 changes: 3 additions & 10 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,14 @@ val isScala3 = Def.setting(

// sbt-github-actions needs configuration in `ThisBuild`
ThisBuild / crossScalaVersions := Seq("2.12.16", "2.13.8", "3.1.3")
ThisBuild / scalaVersion := crossScalaVersions.value.last
ThisBuild / scalaVersion := "2.13.8"
ThisBuild / githubWorkflowBuildPreamble ++= List(
WorkflowStep.Sbt(List("mimaReportBinaryIssues"), name = Some("Check binary compatibility")),
WorkflowStep.Sbt(List("scalafmtCheckAll"), name = Some("Check formatting"))
)

// Workaround for not running derivation tests for Scala 3 yet.
// Should be deleted and githubWorkflowBuild should be restored to default when
// derivation is compiling for all versions
lazy val testAll = taskKey[Unit]("Test all available modules depending on the Scala version")
testAll := {
if (isScala3.value) Def.sequential(parser / Test / test, core / Test / test).value
else Def.sequential(parser / Test / test, core / Test / test, derivation / Test / test).value
}
ThisBuild / githubWorkflowBuild := Seq(WorkflowStep.Sbt(List("testAll")))
// For now we set up GH Actions manually for Scala 3
ThisBuild / githubWorkflowScalaVersions := crossScalaVersions.value.filterNot(_.startsWith("3."))

// Release
ThisBuild / githubWorkflowTargetTags ++= Seq("v*")
Expand Down

0 comments on commit 7adc3b3

Please sign in to comment.