diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..39fd2f2 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,114 @@ +# 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.12] + 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@v10 + 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: Check that workflows are up to date + run: sbt ++${{ matrix.scala }} githubWorkflowCheck + + - run: sbt ++${{ matrix.scala }} test scripted + + - name: Compress target directories + run: tar cf targets.tar target project/target + + - name: Upload target directories + uses: actions/upload-artifact@v2 + with: + name: target-${{ matrix.os }}-${{ matrix.scala }}-${{ matrix.java }} + path: targets.tar + + publish: + name: Publish Artifacts + needs: [build] + if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v')) + strategy: + matrix: + os: [ubuntu-latest] + scala: [2.12.12] + 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@v10 + 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: Download target directories (2.12.12) + uses: actions/download-artifact@v2 + with: + name: target-${{ matrix.os }}-2.12.12-${{ matrix.java }} + + - name: Inflate target directories (2.12.12) + run: | + tar xf targets.tar + rm targets.tar + + - env: + PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} + PGP_SECRET: ${{ secrets.PGP_SECRET }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + run: sbt ++${{ matrix.scala }} ci-release \ 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 daf52df..a171c5b 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,10 @@ lib_managed/ src_managed/ project/boot/ project/plugins/project/ +.bloop +/.bsp +.metals +metals.sbt # Scala-IDE specific .scala_dependencies diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 25c070c..0000000 --- a/.travis.yml +++ /dev/null @@ -1,35 +0,0 @@ -sudo: false -language: scala -scala: - - 2.12.2 -jdk: - - openjdk8 - -stages: - - name: build - - name: publish - if: tag IS present - -jobs: - include: - - stage: build - script: sbt ++$TRAVIS_SCALA_VERSION scripted - - stage: publish - script: sbt ++$TRAVIS_SCALA_VERSION releaseEarly; - -before_install: - - if [ $TRAVIS_PULL_REQUEST = 'false' ]; then - openssl aes-256-cbc -K $encrypted_7edee92045c5_key -iv $encrypted_7edee92045c5_iv -in travis/secrets.tar.enc -out travis/secrets.tar -d; - tar xv -C travis -f travis/secrets.tar; - fi -env: - global: - - secure: "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+9fT+WMdT0U5SdkOoVxF0MVZIZ7lGNTUZP52bTlko9NSKBPv3lNHuUPEbwPPD8sECmz39Kld9LyOSdHNsJ6GL0/jShQbUrdIOV28zF3OKZUPBq9pOcDPVhuzYNfM5FU0JaCrO5180ExqDXe6A33lAB0Nwaxx7zbR+rkBz0lTDISHGqachdskpCHQQpmL7C1BYxvYFivI1B1Ac/rk/bUE6CY2Vb5ggMJfa4Q05ioV1onj6d2r2POqq3Jbb5AU662DVGn+4n2cWxssi0tDzQR4iSFbv9DkNfmdp8ESQ=" - - secure: "ZwGuIqO7zQG7sW3FMp0is6v2H6kWuNjLmgL1qyL/mDCXQChOqj8qTAs8PBd6Lv+v5iA/GJMmZmcR4gsTaielRJk8HpmW013ZWUrJVHcLKAiUQ47b0m5vzVWDavoQqPif6ZlFMEwiUYR0Oz7mvo7pC6pKcUfiC6wTsfaMN6+4ArvULbjeA1W9/G78qIGoqiTlWfmtu8dBXZ3QlaoCbxhyHTxxAl1oFOBzxR6L8AQ7q9kCMCukDIzYt/gnmbyDr8lzakNQ/gwjWIQr/q0ZlbNOZZNtWxAhIVi/im/dLuZwNNLAVjkgUvkAghqGY/3hhylZ9WdzTw1e4IRTAg4gtKNvffJ/+XWOKv4S3hgd9SwmI89idzbFqi503k6YRDscv8nVodIr22u6bqKJNLmKBhZZ9Er5v2TmORCm7/cuywhaXOr0HFwjy6zkRI/pm73jIJl+9mYR9NcFgopSZLgl4ZH9yr+01o6HAKGIEz1/kgwN1YR0HQRtTUSTy2I0R6zaBaQVSI1RKdfeFh/zxPvIlgmml+7eMyQparxUcd5trAmM9V1jU49udI8XN9QZbYbvO3XrbyfFQLCZ6KU9ZiB5YNXDjLHDYkLItn89meznaojpUxCu1Je3NvhNQ+IcbOXaTTzlQSicptU8TXsvbzO2GmbkiiPxZXhREhFA5y/pNxGxdzI=" - -cache: - directories: - - $HOME/.ivy2/cache - - $HOME/.sbt - - $HOME/.coursier \ No newline at end of file diff --git a/README.md b/README.md index 1be63e1..dd59270 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # sonic-dependency-tree -[![Build Status](https://travis-ci.org/SupersonicAds/sonic-dependency-tree.svg?branch=master)](https://travis-ci.org/SupersonicAds/sonic-dependency-tree) +[![Build Status](https://github.com/SupersonicAds/sonic-dependency-tree/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/SupersonicAds/sonic-dependency-tree/actions?query=branch%3Amaster) +[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.supersonic/sonic-dependency-tree_2.12/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.supersonic/sonic-dependency-tree_2.12) SBT plugin for retrieving Scala modules and libraries dependencies and outputs it as JSON. As an identifier for current dependencies, we use Git commit. In addition, there's an option to upload the current commit project's dependencies to Amazon S3. @@ -15,8 +16,6 @@ It helps to keep track of module dependencies and library version used in each m Add the plugin as SBT dependency to your `project/plugins.sbt` ``` -resolvers += Resolver.bintrayRepo("ironsonic", "sbt-plugins") - addSbtPlugin("com.supersonic" % "sonic-dependency-tree" % "0.0.2") ``` diff --git a/build.sbt b/build.sbt index a6e6577..8c9bf4f 100644 --- a/build.sbt +++ b/build.sbt @@ -1,7 +1,5 @@ enablePlugins(ScriptedPlugin) -enablePlugins(BuildInfoPlugin) -organization := "com.supersonic" name := "sonic-dependency-tree" scalacOptions ++= List( "-encoding", "UTF-8", @@ -15,15 +13,7 @@ scalacOptions ++= List( "-Xlint", "-Ypartial-unification") -buildInfoKeys := List[BuildInfoKey]( - name, - version, - scalaVersion, - sbtVersion, - "gitCommit" -> git.gitHeadCommit.value.getOrElse(""), - "gitDescribedVersion" -> git.gitDescribedVersion.value.getOrElse("")) - -buildInfoPackage := organization.value +sonatypeCredentialHost := Sonatype.sonatype01 makePomConfiguration := makePomConfiguration.value.withConfigurations(Configurations.defaultMavenConfigurations) @@ -34,15 +24,23 @@ scriptedLaunchOpts += ("-Dplugin.version=" + version.value) scriptedBufferLog := false inThisBuild(List( + organization := "com.supersonic", licenses := List("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")), homepage := Some(url("https://github.com/SupersonicAds/sonic-dependency-tree")), developers := List(Developer("SupersonicAds", "SupersonicAds", "SupersonicAds", url("https://github.com/SupersonicAds"))), scmInfo := Some(ScmInfo(url("https://github.com/SupersonicAds/sonic-dependency-tree"), "scm:git:git@github.com:SupersonicAds/sonic-dependency-tree.git")), - pgpPublicRing := file("./travis/local.pubring.asc"), - pgpSecretRing := file("./travis/local.secring.asc"), - releaseEarlyEnableSyncToMaven := false, - releaseEarlyWith := BintrayPublisher)) + githubWorkflowPublishTargetBranches := Seq(RefPredicate.StartsWith(Ref.Tag("v"))), + githubWorkflowTargetTags ++= Seq("v*"), + githubWorkflowBuild := Seq(WorkflowStep.Sbt(List("test", "scripted"))), + githubWorkflowPublish := Seq( + WorkflowStep.Sbt( + List("ci-release"), + env = Map( + "PGP_PASSPHRASE" -> "${{ secrets.PGP_PASSPHRASE }}", + "PGP_SECRET" -> "${{ secrets.PGP_SECRET }}", + "SONATYPE_PASSWORD" -> "${{ secrets.SONATYPE_PASSWORD }}", + "SONATYPE_USERNAME" -> "${{ secrets.SONATYPE_USERNAME }}"))))) libraryDependencies ++= Seq( "com.typesafe.play" %% "play-json" % "2.8.0", diff --git a/project/build.properties b/project/build.properties index d6a5af2..724e82e 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version = 1.3.4 \ No newline at end of file +sbt.version = 1.4.9 \ No newline at end of file diff --git a/project/plugins.sbt b/project/plugins.sbt index 1f1bf12..b864920 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,7 +1,7 @@ libraryDependencies += "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value -addSbtPlugin("ch.epfl.scala" % "sbt-release-early" % "2.1.1") - addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "0.9.3") -addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.7.0") +addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.7") + +addSbtPlugin("com.codecommit" % "sbt-github-actions" % "0.10.1") diff --git a/travis/secrets.tar.enc b/travis/secrets.tar.enc deleted file mode 100644 index 28dc294..0000000 Binary files a/travis/secrets.tar.enc and /dev/null differ