Skip to content

Commit

Permalink
Merge pull request #217 from amesgen/use-dhallj
Browse files Browse the repository at this point in the history
dhall-haskell → dhallj
  • Loading branch information
rossabaker authored Apr 23, 2020
2 parents de110ec + 2297741 commit 5e36ce7
Show file tree
Hide file tree
Showing 16 changed files with 198 additions and 181 deletions.
84 changes: 42 additions & 42 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,53 +1,53 @@
jobs:
build:
env:
SCALA_VERSION: "${{ matrix.scala }}"
name: "Scala ${{ matrix.scala }}, Java ${{ matrix.java }}"
SCALA_VERSION: ${{ matrix.scala }}
name: Scala ${{ matrix.scala }}, Java ${{ matrix.java }}
runs-on: ubuntu-latest
steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-java@v1"
with:
java-version: "${{ matrix.java }}"
- name: Get current week
run: |
echo "::set-env name=current_week::$(( 10#$(date +%U) ))"
echo "::set-env name=last_week::$(( 10#$(date +%U) - 1 ))"
- name: Cache SBT coursier cache
uses: "actions/cache@v1"
with:
key: "coursier-${{ env.current_week }}"
path: "~/.cache/coursier"
restore-keys: "coursier-${{ env.last_week }}"
- name: Cache SBT
uses: "actions/cache@v1"
with:
key: "sbt-${{ env.current_week }}"
path: "~/.sbt"
restore-keys: "sbt-${{ env.last_week }}"
- name: Unused and undeclared dependencies
run: "sbt ++$SCALA_VERSION unusedCompileDependenciesTest undeclaredCompileDependenciesTest"
- name: Tests
run: "sbt ++$SCALA_VERSION test"
- name: Scaladocs
run: "sbt ++$SCALA_VERSION doc"
- name: MiMa
run: "sbt ++$SCALA_VERSION mimaReportBinaryIssues"
- name: Scalafmt
run: "sbt ++$SCALA_VERSION scalafmtCheckAll"
- if: "startsWith(matrix.scala, '2.12')"
name: Test docs
run: "sbt ++$SCALA_VERSION docs/makeSite"
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- name: Get current week
run: |
echo \"::set-env name=current_week::$(( 10#$(date +%U) ))\"
echo \"::set-env name=last_week::$(( 10#$(date +%U) - 1 ))\"
- name: Cache SBT coursier cache
uses: actions/cache@v1
with:
key: coursier-${{ env.current_week }}
path: ~/.cache/coursier
restore-keys: coursier-${{ env.last_week }}
- name: Cache SBT
uses: actions/cache@v1
with:
key: sbt-${{ env.current_week }}
path: ~/.sbt
restore-keys: sbt-${{ env.last_week }}
- name: Unused and undeclared dependencies
run: sbt ++$SCALA_VERSION unusedCompileDependenciesTest undeclaredCompileDependenciesTest
- name: Tests
run: sbt ++$SCALA_VERSION test
- name: Scaladocs
run: sbt ++$SCALA_VERSION doc
- name: MiMa
run: sbt ++$SCALA_VERSION mimaReportBinaryIssues
- name: Scalafmt
run: sbt ++$SCALA_VERSION scalafmtCheckAll
- if: startsWith(matrix.scala, '2.12')
name: Test docs
run: sbt ++$SCALA_VERSION docs/makeSite
strategy:
fail-fast: false
matrix:
java:
- '11'
- '14'
- '11'
- '14'
scala:
- '2.12.11'
- '2.13.1'
- 2.12.11
- 2.13.1
name: CI
on:
- push
- pull_request
'on':
- push
- pull_request
31 changes: 11 additions & 20 deletions .github/workflows/dhall.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,15 @@ jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: "actions/checkout@v2"
- name: Setup Dhall
run: |
cd $(mktemp -d)
curl -L https://github.com/dhall-lang/dhall-haskell/releases/download/1.31.1/dhall-1.31.1-x86_64-linux.tar.bz2 | tar xj
curl -L https://github.com/dhall-lang/dhall-haskell/releases/download/1.31.1/dhall-json-1.6.3-x86_64-linux.tar.bz2 | tar xj
mkdir -p $HOME/bin
mv bin/* $HOME/bin/
echo "::add-path::$HOME/bin"
- name: Check Dhall formatting
run: |
[[ $(find -name '*.dhall' -exec sh -c 'dhall --ascii format --check < {}' \; |& wc -c) -eq 0 ]]
- name: Check generated YAML files
run: |
cd dhall
./generateYaml.sh
[[ $(git status --porcelain | wc -l) -eq 0 ]]
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: '11'
- name: Check generated YAML files
run: |
sbt convertDhall
[[ $(git status --porcelain | wc -l) -eq 0 ]]
name: Check Dhall configs
on:
- push
- pull_request
'on':
- push
- pull_request
85 changes: 43 additions & 42 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,50 @@ jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: "actions/checkout@v2"
- name: Unshallow
run: git fetch --unshallow
- uses: "actions/setup-java@v1"
with:
java-version: '11'
- uses: "olafurpg/setup-gpg@v2"
- name: Get current week
run: |
echo "::set-env name=current_week::$(( 10#$(date +%U) ))"
echo "::set-env name=last_week::$(( 10#$(date +%U) - 1 ))"
- name: Cache SBT coursier cache
uses: "actions/cache@v1"
with:
key: "coursier-${{ env.current_week }}"
path: "~/.cache/coursier"
restore-keys: "coursier-${{ env.last_week }}"
- name: Cache SBT
uses: "actions/cache@v1"
with:
key: "sbt-${{ env.current_week }}"
path: "~/.sbt"
restore-keys: "sbt-${{ env.last_week }}"
- env:
PGP_PASSPHRASE: "${{ secrets.PGP_PASSPHRASE }}"
PGP_SECRET: "${{ secrets.PGP_SECRET }}"
SBT_GHPAGES_COMMIT_MESSAGE: "Updated site: sha=${{ github.sha }} build=${{ github.run_id }}"
SONATYPE_PASSWORD: "${{ secrets.SONATYPE_PASSWORD }}"
SONATYPE_USERNAME: "${{ secrets.SONATYPE_USERNAME }}"
SSH_PRIVATE_KEY: "${{ secrets.SSH_PRIVATE_KEY }}"
name: Release
run: |
echo "$PGP_SECRET" | base64 --decode | gpg --import --no-tty --batch --yes
eval "$(ssh-agent -s)"
echo "$SSH_PRIVATE_KEY" | ssh-add -
git config --global user.name "GitHub Actions CI"
git config --global user.email "ghactions@invalid"
sbt ci-release docs/makeSite docs/ghpagesPushSite
- uses: actions/checkout@v2
- name: Unshallow
run: git fetch --unshallow
- uses: actions/setup-java@v1
with:
java-version: '11'
- uses: olafurpg/setup-gpg@v2
- name: Get current week
run: |
echo \"::set-env name=current_week::$(( 10#$(date +%U) ))\"
echo \"::set-env name=last_week::$(( 10#$(date +%U) - 1 ))\"
- name: Cache SBT coursier cache
uses: actions/cache@v1
with:
key: coursier-${{ env.current_week }}
path: ~/.cache/coursier
restore-keys: coursier-${{ env.last_week }}
- name: Cache SBT
uses: actions/cache@v1
with:
key: sbt-${{ env.current_week }}
path: ~/.sbt
restore-keys: sbt-${{ env.last_week }}
- env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SBT_GHPAGES_COMMIT_MESSAGE: 'Updated site: sha=${{ github.sha }} build=${{
github.run_id }}'
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
name: Release
run: |
echo \"$PGP_SECRET\" | base64 --decode | gpg --import --no-tty --batch --yes
eval \"$(ssh-agent -s)\"
echo \"$SSH_PRIVATE_KEY\" | ssh-add -
git config --global user.name \"GitHub Actions CI\"
git config --global user.email \"ghactions@invalid\"
sbt ci-release docs/makeSite docs/ghpagesPushSite
name: Publish releases and snapshots
on:
'on':
push:
branches:
- master
- master
tags:
- "*"
- '*'
22 changes: 11 additions & 11 deletions .mergify.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
pull_request_rules:
- actions:
merge:
method: merge
conditions:
- author=scala-steward
- "body~=labels:.*semver-patch.*"
- "status-success=Scala 2.12.11, Java 11"
- "status-success=Scala 2.12.11, Java 14"
- "status-success=Scala 2.13.1, Java 11"
- "status-success=Scala 2.13.1, Java 14"
name: "automatically merge scala-steward's PRs"
- actions:
merge:
method: merge
conditions:
- author=scala-steward
- body~=labels:.*semver-patch.*
- status-success=Scala 2.12.11, Java 11
- status-success=Scala 2.12.11, Java 14
- status-success=Scala 2.13.1, Java 11
- status-success=Scala 2.13.1, Java 14
name: automatically merge scala-steward's PRs
11 changes: 5 additions & 6 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ lazy val `http4s-jdk-http-client` = project
.disablePlugins(MimaPlugin)
.settings(commonSettings, skipOnPublishSettings)
.settings(
crossScalaVersions := Nil
crossScalaVersions := Nil,
Dhall.convertDhallTask
)
.aggregate(core)

Expand Down Expand Up @@ -36,9 +37,6 @@ val javaWebsocketV = "1.4.1"
val kindProjectorV = "0.10.3"
val betterMonadicForV = "0.3.1"

lazy val scalaVersions =
upickle.default.read[List[String]](new File("scalaVersions.json"))

// format: off
val coreDeps = Seq(
"org.typelevel" %% "cats-core" % catsV,
Expand All @@ -65,8 +63,9 @@ val coreDeps = Seq(
// General Settings
lazy val commonSettings = Seq(
organization := "org.http4s",
scalaVersion := scalaVersions.head,
crossScalaVersions := scalaVersions,
Dhall.scalaVersionsImpl,
scalaVersion := Dhall.scalaVersions.value.default,
crossScalaVersions := Dhall.scalaVersions.value.all,
scalacOptions += "-Yrangepos",
scalacOptions in (Compile, doc) ++= Seq(
"-groups",
Expand Down
5 changes: 3 additions & 2 deletions dhall/ci.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ let steps =
c.Run::{
, name = "Test docs"
, run = "docs/makeSite"
, if = Some "startsWith(matrix.scala, '2.12')"
, `if` = Some "startsWith(matrix.scala, '2.12')"
}
]

Expand All @@ -35,7 +35,8 @@ in { name = "CI"
/\ { name = c.ciJobName "\${{ matrix.scala }}" "\${{ matrix.java }}"
, strategy =
{ fail-fast = False
, matrix = { java = c.javaVersions.all, scala = c.scalaVersions }
, matrix =
{ java = c.javaVersions.all, scala = c.scalaVersions.all }
}
, env.SCALA_VERSION = "\${{ matrix.scala }}"
}
Expand Down
14 changes: 7 additions & 7 deletions dhall/common.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@ let SimpleObject = List { mapKey : Text, mapValue : Text }

let Uses =
{ Type =
{ name : Optional Text, uses : Text, with : Optional SimpleObject }
, default = { name = None Text, with = None SimpleObject }
{ name : Optional Text, uses : Text, `with` : Optional SimpleObject }
, default = { name = None Text, `with` = None SimpleObject }
}

let Run =
{ Type =
{ name : Text
, run : Text
, if : Optional Text
, `if` : Optional Text
, env : Optional SimpleObject
}
, default = { if = None Text, env = None SimpleObject }
, default = { `if` = None Text, env = None SimpleObject }
}

let BuildStep = < Uses : Uses.Type | Run : Run.Type >

let baseJob = \(steps : List BuildStep) -> { runs-on = "ubuntu-latest", steps }

let javaVersions = let dv = "11" in { default = dv, all = [ dv, "14" ] }
let javaVersions = ./javaVersions.dhall

let scalaVersions = ./scalaVersions.dhall

Expand All @@ -39,7 +39,7 @@ let steps =
-> BuildStep.Uses
Uses::{
, uses = "actions/setup-java@v1"
, with = Some (toMap { java-version = version })
, `with` = Some (toMap { java-version = version })
}
, cache =
let cacheConfig =
Expand All @@ -48,7 +48,7 @@ let steps =
Uses::{
, name = Some config.name
, uses = "actions/cache@v1"
, with = Some
, `with` = Some
( toMap
{ path = config.path
, key =
Expand Down
34 changes: 2 additions & 32 deletions dhall/dhall.dhall
Original file line number Diff line number Diff line change
@@ -1,44 +1,14 @@
let c = ./common.dhall

let versions = { dhall = "1.31.1", dhallToYaml = "1.6.3" }

let dhallDownload =
\(file : Text)
-> let baseUrl =
"https://github.com/dhall-lang/dhall-haskell/releases/download"

in "curl -L ${baseUrl}/${versions.dhall}/${file}-x86_64-linux.tar.bz2 | tar xj"

let steps =
[ c.steps.checkout
, c.BuildStep.Run
c.Run::{
, name = "Setup Dhall"
, run =
''
cd $(mktemp -d)
${dhallDownload "dhall-${versions.dhall}"}
${dhallDownload "dhall-json-${versions.dhallToYaml}"}
mkdir -p $HOME/bin
mv bin/* $HOME/bin/
echo "::add-path::$HOME/bin"
''
}
, c.BuildStep.Run
c.Run::{
, name = "Check Dhall formatting"
, run =
''
[[ $(find -name '*.dhall' -exec sh -c 'dhall --ascii format --check < {}' \; |& wc -c) -eq 0 ]]
''
}
, c.steps.java c.javaVersions.default
, c.BuildStep.Run
c.Run::{
, name = "Check generated YAML files"
, run =
''
cd dhall
./generateYaml.sh
sbt convertDhall
[[ $(git status --porcelain | wc -l) -eq 0 ]]
''
}
Expand Down
2 changes: 0 additions & 2 deletions dhall/dhallFormat.sh

This file was deleted.

Loading

0 comments on commit 5e36ce7

Please sign in to comment.