diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..d7bb9ba --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,128 @@ +# This file was automatically generated by sbt-github-actions using the +# githubWorkflowGenerate task. You should add and commit this file to +# your git repository. It goes without saying that you shouldn't edit +# this file by hand! Instead, if you wish to make changes, you should +# change your sbt build configuration to revise the workflow description +# to meet your needs, then regenerate this file. + +name: Continuous Integration + +on: + pull_request: + branches: ['**'] + push: + branches: ['**'] + tags: [v*] + +env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +jobs: + build: + name: Build and Test + strategy: + matrix: + os: [ubuntu-latest] + scala: [2.12.15, 2.13.6] + java: [adopt@1.8, adopt@1.11] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout current branch (full) + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Setup Java and Scala + uses: olafurpg/setup-scala@v12 + 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: Setup Ruby + if: matrix.scala == '2.13.6' + uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.0.1 + + - name: Install microsite dependencies + if: matrix.scala == '2.13.6' + run: | + gem install saas + gem install jekyll -v 4.2.0 + + - name: Check that workflows are up to date + run: sbt --client '++${{ matrix.scala }}; githubWorkflowCheck' + + - run: sbt --client '++${{ matrix.scala }}; test; mimaReportBinaryIssues' + + - if: matrix.scala == '2.13.6' + run: sbt --client '++${{ matrix.scala }}; site/makeMicrosite' + + publish: + name: Publish Artifacts + needs: [build] + if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') + strategy: + matrix: + os: [ubuntu-latest] + scala: [2.13.6] + java: [adopt@1.8] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout current branch (full) + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Setup Java and Scala + uses: olafurpg/setup-scala@v12 + 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') }} + + - uses: olafurpg/setup-gpg@v3 + + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.0.1 + + - name: Install microsite dependencies + run: | + gem install saas + gem install jekyll -v 4.2.0 + + - name: Publish artifacts to Sonatype + env: + PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} + PGP_SECRET: ${{ secrets.PGP_SECRET }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + run: sbt --client '++${{ matrix.scala }}; ci-release' + + - uses: christopherdavenport/create-ghpages-ifnotexists@v1 + + - name: Publish microsite + run: sbt --client '++${{ matrix.scala }}; site/publishMicrosite' \ No newline at end of file diff --git a/.github/workflows/clean.yml b/.github/workflows/clean.yml new file mode 100644 index 0000000..b535fcc --- /dev/null +++ b/.github/workflows/clean.yml @@ -0,0 +1,59 @@ +# This file was automatically generated by sbt-github-actions using the +# githubWorkflowGenerate task. You should add and commit this file to +# your git repository. It goes without saying that you shouldn't edit +# this file by hand! Instead, if you wish to make changes, you should +# change your sbt build configuration to revise the workflow description +# to meet your needs, then regenerate this file. + +name: Clean + +on: push + +jobs: + delete-artifacts: + name: Delete Artifacts + runs-on: ubuntu-latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - name: Delete artifacts + run: | + # Customize those three lines with your repository and credentials: + REPO=${GITHUB_API_URL}/repos/${{ github.repository }} + + # A shortcut to call GitHub API. + ghapi() { curl --silent --location --user _:$GITHUB_TOKEN "$@"; } + + # A temporary file which receives HTTP response headers. + TMPFILE=/tmp/tmp.$$ + + # An associative array, key: artifact name, value: number of artifacts of that name. + declare -A ARTCOUNT + + # Process all artifacts on this repository, loop on returned "pages". + URL=$REPO/actions/artifacts + while [[ -n "$URL" ]]; do + + # Get current page, get response headers in a temporary file. + JSON=$(ghapi --dump-header $TMPFILE "$URL") + + # Get URL of next page. Will be empty if we are at the last page. + URL=$(grep '^Link:' "$TMPFILE" | tr ',' '\n' | grep 'rel="next"' | head -1 | sed -e 's/.*.*//') + rm -f $TMPFILE + + # Number of artifacts on this page: + COUNT=$(( $(jq <<<$JSON -r '.artifacts | length') )) + + # Loop on all artifacts on this page. + for ((i=0; $i < $COUNT; i++)); do + + # Get name of artifact and count instances of this name. + name=$(jq <<<$JSON -r ".artifacts[$i].name?") + ARTCOUNT[$name]=$(( $(( ${ARTCOUNT[$name]} )) + 1)) + + id=$(jq <<<$JSON -r ".artifacts[$i].id?") + size=$(( $(jq <<<$JSON -r ".artifacts[$i].size_in_bytes?") )) + printf "Deleting '%s' #%d, %'d bytes\n" $name ${ARTCOUNT[$name]} $size + ghapi -X DELETE $REPO/actions/artifacts/$id + done + done \ No newline at end of file diff --git a/.gitignore b/.gitignore index 64d4a1f..86a261c 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,6 @@ target/ tags .bloop -.metals \ No newline at end of file +.metals +metals.sbt +.vscode \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index cee421e..0000000 --- a/.travis.yml +++ /dev/null @@ -1,59 +0,0 @@ -sudo: false -language: scala - -jdk: - - openjdk11 - -before_install: - - git fetch --tags - - export PATH=${PATH}:./vendor/bundle - -stages: - - name: test - - name: release - if: ((branch = master AND type = push) OR (tag IS present)) AND NOT fork - -scala_version_213: &scala_version_213 "2.13.1" -scala_version_212: &scala_version_212 "2.12.10" - -jobs: - include: - # stage="test" if no stage is specified - - - name: test 2.13 - scala: *scala_version_213 - script: sbt ++$TRAVIS_SCALA_VERSION test - - name: test 2.12 - scala: *scala_version_212 - script: sbt ++$TRAVIS_SCALA_VERSION test - # - - # name: mima - # script: sbt +mimaReportBinaryIssues - - - name: docs - scala: *scala_version_213 - install: - - rvm use 2.6.0 --install --fuzzy - - gem update --system - - gem install sass - - gem install jekyll -v 4.0.0 - script: sbt ++$TRAVIS_SCALA_VERSION site/makeMicrosite - # run ci-release only if previous stages passed - - stage: release - name: release - script: sbt ci-release - - stage: release - name: microsite - scala: *scala_version_213 - install: - - rvm use 2.6.0 --install --fuzzy - - gem update --system - - gem install sass - - gem install jekyll -v 4.0.0 - script: sbt ++$TRAVIS_SCALA_VERSION site/publishMicrosite - -cache: - directories: - - $HOME/.ivy2/cache - - $HOME/.coursier/cache - - $HOME/.sbt diff --git a/build.sbt b/build.sbt index 83dc528..59ce060 100644 --- a/build.sbt +++ b/build.sbt @@ -3,6 +3,7 @@ ThisBuild / crossScalaVersions := Seq("2.12.15", "2.13.6") lazy val `epimetheus-mules` = project.in(file(".")) .disablePlugins(MimaPlugin) .enablePlugins(NoPublishPlugin) + .aggregate(core, site) lazy val core = project.in(file("core")) .settings(commonSettings) @@ -26,13 +27,8 @@ val mulesV = "0.5.0-M2" val specs2V = "4.8.3" -val kindProjectorV = "0.13.2" -val betterMonadicForV = "0.3.1" - // General Settings lazy val commonSettings = Seq( - addCompilerPlugin("org.typelevel" %% "kind-projector" % kindProjectorV cross CrossVersion.full), - addCompilerPlugin("com.olegpy" %% "better-monadic-for" % betterMonadicForV), libraryDependencies ++= Seq( "org.typelevel" %% "cats-core" % catsV, "org.typelevel" %% "cats-effect" % catsEffectV, diff --git a/project/plugins.sbt b/project/plugins.sbt index 6255fd7..59ec9de 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,2 +1,2 @@ addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.20") -addSbtPlugin("io.chrisdavenport" % "sbt-davenverse" % "0.1.2") \ No newline at end of file +addSbtPlugin("io.chrisdavenport" % "sbt-davenverse" % "0.1.3")