Skip to content

Commit

Permalink
implement pubsub tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver-Taylor committed Jul 10, 2024
0 parents commit bcb77b8
Show file tree
Hide file tree
Showing 22 changed files with 744 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
reviewers:
- "janstenpickle"
- "catostrophe"
labels:
- "dependency-update"
ignore:
# managed by sbt-github-actions
- dependency-name: "actions/setup-java"
- dependency-name: "actions/checkout"
- dependency-name: "actions/cache"
- dependency-name: "actions/upload-artifact"
- dependency-name: "actions/download-artifact"
61 changes: 61 additions & 0 deletions .github/mergify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
pull_request_rules:
- name: Request reviews and label Stewards' PRs
conditions:
- or:
- author=scala-steward
- author=trace4cats-steward[bot]
actions:
request_reviews:
users: [ janstenpickle, catostrophe ]
label:
add: [ dependency-update ]

- name: Merge Stewards' PRs
conditions:
- or:
- author=scala-steward
- author=trace4cats-steward[bot]
- or:
- and:
- "#files=1"
- or:
- files=project/build.properties
- files=project/plugins.sbt
- files=.scalafmt.conf
- body~=labels:.*semver-patch
- "#approved-reviews-by>=1"
- and:
- check-success~=Test \(ubuntu-latest, 2\.12\.\d+, temurin@8\)
- check-success~=Test \(ubuntu-latest, 2\.12\.\d+, temurin@17\)
- check-success~=Test \(ubuntu-latest, 2\.13\.\d+, temurin@8\)
- check-success~=Test \(ubuntu-latest, 2\.13\.\d+, temurin@17\)
- check-success~=Test \(ubuntu-latest, 3\.\d+\.\d+, temurin@8\)
- check-success~=Test \(ubuntu-latest, 3\.\d+\.\d+, temurin@17\)
actions:
merge:
method: rebase

- name: Merge PRs via Mergify to skip the release step on CI
conditions:
- or:
- author=janstenpickle
- author=catostrophe
- and:
- label=skip-release
- label=ready-to-merge
- and:
- check-success~=Test \(ubuntu-latest, 2\.12\.\d+, temurin@8\)
- check-success~=Test \(ubuntu-latest, 2\.12\.\d+, temurin@17\)
- check-success~=Test \(ubuntu-latest, 2\.13\.\d+, temurin@8\)
- check-success~=Test \(ubuntu-latest, 2\.13\.\d+, temurin@17\)
- check-success~=Test \(ubuntu-latest, 3\.\d+\.\d+, temurin@8\)
- check-success~=Test \(ubuntu-latest, 3\.\d+\.\d+, temurin@17\)
actions:
merge:
method: rebase

- name: Delete head branch after merge
conditions:
- merged
actions:
delete_head_branch:
23 changes: 23 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name-template: 'v$NEXT_MINOR_VERSION'
tag-template: 'v$NEXT_MINOR_VERSION'
categories:
- title: '🚀 Features'
labels:
- 'feature'
- 'enhancement'
- title: '🐛 Bug Fixes'
labels:
- 'fix'
- 'bugfix'
- 'bug'
- title: '🧰 Maintenance'
labels:
- 'chore'
- 'dependency-update'
exclude-labels:
- 'skip-changelog'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
template: |
## Changes
$CHANGES
162 changes: 162 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
# 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.13.14, 2.12.16, 3.2.2]
java: [temurin@8, temurin@17]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v2
with:
fetch-depth: 0

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

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

- 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 formatting
run: sbt ++${{ matrix.scala }} scalafmtCheckAll scalafmtSbtCheck

- name: Check that workflows are up to date
run: sbt ++${{ matrix.scala }} githubWorkflowCheck

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

- name: Compress target directories
run: tar cf targets.tar target modules/pubsub-client/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') || github.ref == 'refs/heads/master') && (github.actor != 'mergify[bot]')
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.14]
java: [temurin@8]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v2
with:
fetch-depth: 0

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

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

- 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.13.14)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-2.13.14-${{ matrix.java }}

- name: Inflate target directories (2.13.14)
run: |
tar xf targets.tar
rm targets.tar
- name: Download target directories (2.12.16)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-2.12.16-${{ matrix.java }}

- name: Inflate target directories (2.12.16)
run: |
tar xf targets.tar
rm targets.tar
- name: Download target directories (3.2.2)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-3.2.2-${{ matrix.java }}

- name: Inflate target directories (3.2.2)
run: |
tar xf targets.tar
rm targets.tar
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v4
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PGP_PASS }}

- name: Publish artifacts
env:
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
run: sbt ++${{ matrix.scala }} ciReleaseSonatype
59 changes: 59 additions & 0 deletions .github/workflows/clean.yml
Original file line number Diff line number Diff line change
@@ -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/.*<//' -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
16 changes: 16 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Release Drafter

on:
push:
branches:
- master
pull_request:
types: [opened, reopened, synchronize]

jobs:
update_release_draft:
runs-on: ubuntu-latest
steps:
- uses: release-drafter/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
target/
.idea
.swp
local.*
.bsb/
.bsp
.java-version
**/.DS_store
26 changes: 26 additions & 0 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version = "2.7.5"

style = Intellij

maxColumn = 120

trailingCommas = preserve

newlines {
sometimesBeforeColonInMethodReturnType = false
penalizeSingleSelectMultiArgList = false
}

align {
arrowEnumeratorGenerator = false
ifWhileOpenParen = false
openParenCallSite = false
openParenDefnSite = false

tokens = ["%", "%%"]
}

rewrite {
rules = [AvoidInfix, PreferCurlyFors, SortImports, RedundantBraces, RedundantParens]
redundantBraces.maxLines = 1
}
Loading

0 comments on commit bcb77b8

Please sign in to comment.