From 823298595a768218a2e97219f013aa138326137e Mon Sep 17 00:00:00 2001 From: Alissa Pajer Date: Mon, 16 Nov 2020 18:29:29 -0500 Subject: [PATCH] Update sbt-precog to 2.5.7 --- .github/workflows/ci.yml | 239 ++++++++++++++++++++++-------------- .github/workflows/clean.yml | 59 +++++++++ project/plugins.sbt | 2 +- 3 files changed, 204 insertions(+), 96 deletions(-) create mode 100644 .github/workflows/clean.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 509efc3e82c..49f778d0a1a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,111 +1,160 @@ -name: CI -on: [push, pull_request] +# 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: [master, backport/v*] + types: [opened, reopened, synchronize, ready_for_review] + push: + branches: [master, backport/v*] + env: - CI: true - CI_SNAPSHOT_RELEASE: +publishSigned - HUGO_VERSION: 0.26 - SCALA_VERSION: 2.12.10 + SBT: ./sbt + JABBA_INDEX: 'https://github.com/1Jo1/jabba/raw/support-graalvm-java-8-and-11/index.json' + REPO_SLUG: ${{ github.repository }} + ENCRYPTION_PASSWORD: ${{ secrets.ENCRYPTION_PASSWORD }} GITHUB_ACTOR: precog-bot GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + jobs: - validate: - name: Scala ${{ matrix.scala }}, Java ${{ matrix.java }} - runs-on: ubuntu-latest + build: + name: Build and Test + if: '!(github.event_name == ''pull_request'' && github.event.pull_request.draft)' strategy: - fail-fast: false matrix: - java: [adopt@1.8, adopt@1.11] - scala: [2.12.10, 2.13.1] - env: - SCALA_VERSION: ${{ matrix.scala }} + os: [ubuntu-latest] + scala: [2.13.1] + java: [adopt@1.8, graalvm8@20.1.0] + runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v2 - - uses: olafurpg/setup-scala@v5 + - 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 Coursier - uses: actions/cache@v1 + + - name: Cache sbt + uses: actions/cache@v2 with: - path: ~/.cache/coursier - key: sbt-coursier-cache - - name: Cache SBT - uses: actions/cache@v1 + 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') }}-${{ hashFiles('.versions.json') }} + + - name: Common sbt setup + if: env.ENCRYPTION_PASSWORD != null + run: $SBT ++${{ matrix.scala }} transferCommonResources exportSecretsForActions + + - name: Check that workflows are up to date + run: $SBT ++${{ matrix.scala }} githubWorkflowCheck + + - run: $SBT ++${{ matrix.scala }} ci + + - name: Compress target directories + run: tar cf targets.tar json4s-jackson/target website/target examples/ember/target blaze-client/target server/target examples/target blaze-server/target scalatags/target target argonaut/target examples/docker/target twirl/target docs/target laws/target tests/target prometheus-metrics/target servlet/target examples/tomcat/target examples/jetty/target testing/target ember-server/target json4s-native/target json4s/target okhttp-client/target examples/blaze/target client/target blaze-core/target circe/target examples/war/target jetty-client/target ember-client/target tomcat/target boopickle/target jetty/target play-json/target async-http-client/target core/target scala-xml/target dsl/target dropwizard-metrics/target ember-core/target jawn/target bench/target project/target + + - name: Upload target directories + uses: actions/upload-artifact@v2 with: - path: ~/.sbt - key: sbt-${{ hashFiles('**/build.sbt') }} - - name: Check formatting - if: startsWith(matrix.scala, '2.12.') && (matrix.java == 'adopt@1.8') - run: sbt ++$SCALA_VERSION scalafmtCheckAll - - name: Compile - run: sbt ++$SCALA_VERSION test:compile - # - name: Check compatibility - # run: sbt ++$SCALA_VERSION mimaReportBinaryIssues - - name: Check unused dependencies - run: sbt ++$SCALA_VERSION unusedCompileDependenciesTest - - name: Test - run: sbt ++$SCALA_VERSION test - - name: Scaladoc - run: sbt ++$SCALA_VERSION doc - scalafix: - name: Scalafix - runs-on: ubuntu-latest + name: target-${{ matrix.os }}-${{ matrix.scala }}-${{ matrix.java }} + path: targets.tar + + publish: + name: Publish Artifacts + needs: [build] + if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/backport/v')) + strategy: + matrix: + os: [ubuntu-latest] + scala: [2.13.1] + java: [adopt@1.8] + runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v2 - - uses: olafurpg/setup-scala@v5 - - name: Cache Coursier - uses: actions/cache@v1 + - name: Checkout current branch (full) + uses: actions/checkout@v2 with: - path: ~/.cache/coursier - key: sbt-coursier-cache - - name: Cache SBT - uses: actions/cache@v1 + fetch-depth: 0 + + - name: Setup Java and Scala + uses: olafurpg/setup-scala@v10 with: - path: ~/.sbt - key: sbt-${{ hashFiles('**/build.sbt') }} - - name: Scalafix - working-directory: ./scalafix - run: sbt ++$SCALA_VERSION test - project-site: - name: Project Site - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: olafurpg/setup-scala@v5 - - name: Cache Coursier - uses: actions/cache@v1 + java-version: ${{ matrix.java }} + + - name: Cache sbt + uses: actions/cache@v2 with: - path: ~/.cache/coursier - key: sbt-coursier-cache - - name: Cache SBT - uses: actions/cache@v1 + 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') }}-${{ hashFiles('.versions.json') }} + + - name: Download target directories (2.13.1) + uses: actions/download-artifact@v2 with: - path: ~/.sbt - key: sbt-${{ hashFiles('**/build.sbt') }} - - name: Add ~/bin to PATH - run: echo "::add-path::$HOME/bin" - - name: Install Hugo - run: scripts/install-hugo - - name: Build project site - run: sbt ++$SCALA_VERSION website/makeSite - # docs: - # name: Doc Site - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v2 - # - uses: olafurpg/setup-scala@v5 - # - name: Cache Coursier - # uses: actions/cache@v1 - # with: - # path: ~/.cache/coursier - # key: sbt-coursier-cache - # - name: Cache SBT - # uses: actions/cache@v1 - # with: - # path: ~/.sbt - # key: sbt-${{ hashFiles('**/build.sbt') }} - # - name: Add ~/bin to PATH - # run: echo "::add-path::$HOME/bin" - # - name: Install Hugo - # run: scripts/install-hugo - # - name: Build project site - # run: sbt ++$SCALA_VERSION docs/makeSite + name: target-${{ matrix.os }}-2.13.1-${{ matrix.java }} + + - name: Inflate target directories (2.13.1) + run: | + tar xf targets.tar + rm targets.tar + + - name: Common sbt setup + run: $SBT ++${{ matrix.scala }} transferCommonResources transferPublishAndTagResources exportSecretsForActions + + - run: ./scripts/commonSetup + + - name: Publish artifacts and create tag + run: ./scripts/publishAndTag ${{ github.repository }} + + auto-merge: + name: Auto Merge + needs: [build] + if: 'github.event_name == ''pull_request'' && contains(github.head_ref, ''version-bump'') && contains(github.event.pull_request.labels.*.name, ''version: revision'')' + strategy: + matrix: + os: [ubuntu-latest] + scala: [2.13.1] + java: [adopt@1.8] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout current branch (fast) + uses: actions/checkout@v2 + + - name: Setup Java and Scala + uses: olafurpg/setup-scala@v10 + with: + java-version: ${{ matrix.java }} + + - name: Common sbt setup + run: $SBT ++${{ matrix.scala }} transferCommonResources exportSecretsForActions + + - name: Fetch the latest sdmerge + run: | + curl -L https://github.com/precog/devtools/raw/master/bin/sdmerge > /tmp/sdmerge + chmod +x /tmp/sdmerge + + - name: Self-merge + env: + PR_NUMBER: ${{ github.event.pull_request.number }} + run: | + git config --global user.email "bot@precog.com" + git config --global user.name "Precog Bot" + /tmp/sdmerge $GITHUB_REPOSITORY $PR_NUMBER \ No newline at end of file diff --git a/.github/workflows/clean.yml b/.github/workflows/clean.yml new file mode 100644 index 00000000000..b535fcc1893 --- /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/project/plugins.sbt b/project/plugins.sbt index 4a886a68216..a367d5f7ee7 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -23,4 +23,4 @@ addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0. addSbtPlugin("org.tpolecat" % "tut-plugin" % "0.6.13") addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.3.7") -addSbtPlugin("com.precog" % "sbt-precog" % "1.0.0") +addSbtPlugin("com.precog" % "sbt-precog" % "2.5.7")