Skip to content

Removed debug logging #271

Removed debug logging

Removed debug logging #271

Workflow file for this run

# 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, main, backport/v*]
types: [opened, reopened, synchronize, ready_for_review]
push:
branches: [master, main, backport/v*]
env:
SBT: sbt
REPO_SLUG: ${{ github.repository }}
ENCRYPTION_PASSWORD: ${{ secrets.ENCRYPTION_PASSWORD }}
GITHUB_ACTOR: precog-bot
GITHUB_TOKEN: ${{ secrets.PRECOG_GITHUB_TOKEN }}
jobs:
build:
name: Build and Test
if: '!(github.event_name == ''pull_request'' && github.event.pull_request.draft) && !(github.event_name == ''push'' && (github.ref == ''refs/heads/main'' || github.ref == ''refs/heads/master'') && !startsWith(github.event.head_commit.message, ''Version release''))'
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.12.18]
java: [temurin@17]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Java (temurin@17)
if: matrix.java == 'temurin@17'
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
cache: sbt
- name: Common sbt setup
if: env.ENCRYPTION_PASSWORD != null
run: $SBT '++ ${{ matrix.scala }}' transferCommonResources
- 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 target core/target artifact/target plugin/target project/target
- name: Upload target directories
uses: actions/upload-artifact@v3
with:
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/main' || startsWith(github.ref, 'refs/heads/backport/v') || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') && (startsWith(github.event.head_commit.message, 'Version release'))
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.12.18]
java: [temurin@17]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Java (temurin@17)
if: matrix.java == 'temurin@17'
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
cache: sbt
- name: Download target directories (2.12.18)
uses: actions/download-artifact@v3
with:
name: target-${{ matrix.os }}-2.12.18-${{ matrix.java }}
- name: Inflate target directories (2.12.18)
run: |
tar xf targets.tar
rm targets.tar
- name: Common sbt setup
run: $SBT transferCommonResources transferPublishAndTagResources
- 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.10]
java: [temurin@8]
runs-on: ${{ matrix.os }}
steps:
- name: Merge
id: merge
uses: actions/github-script@v6
with:
script: |
github.rest.pulls.merge({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: ${{ github.event.pull_request.number }},
});
check-labels:
name: Check Labels
if: github.event_name == 'pull_request' && !github.event.pull_request.draft
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.10]
java: [temurin@8]
runs-on: ${{ matrix.os }}
steps:
- name: Check PR labels
uses: docker://agilepathway/pull-request-label-checker:v1.4.30
with:
one_of: 'version: breaking,version: feature,version: revision,version: release'
none_of: ':stop_sign:'
repo_token: ${{ env.GITHUB_TOKEN }}
next-version:
name: Next version
if: github.event_name == 'push' && !startsWith(github.event.head_commit.message, 'Version release')
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.10]
java: [temurin@8]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (fast)
uses: actions/checkout@v3
with:
token: ${{ secrets.PRECOG_GITHUB_TOKEN }}
- name: Get current version
id: current_version
run: echo "CURRENT_VERSION=$(cat version.sbt | awk '{ gsub(/"/, "", $5); print $5 }')" >> $GITHUB_OUTPUT
- name: Compute next version
id: compute_next_version
uses: actions/github-script@v6
with:
script: |
const currentVersion = '${{steps.current_version.outputs.CURRENT_VERSION}}'
const parsedVersion = currentVersion.split(".")
var major = Number(parsedVersion[0])
var minor = Number(parsedVersion[1])
var patch = Number(parsedVersion[2])
const prResponse = await github.rest.repos.listPullRequestsAssociatedWithCommit({
owner: context.repo.owner,
repo: context.repo.repo,
commit_sha: context.sha
})
const prs = prResponse.data
if (prs === undefined) {
throw new Error("Could not fetch PRs for commit: status " + prs.status)
} else if (prs.length > 1) {
throw new Error("Cannot determine version increment required as there is more than one PR associated with the commit: " + context.sha)
} else if (prs.length === 0) {
throw new Error("Cannot determine version increment required as there are no PRs associated with the commit: " + context.sha)
}
const pr = prs[0]
for (const label of pr.labels) {
if (label.name === 'version: revision') {
patch = patch + 1
break
} else if (label.name === 'version: feature') {
patch = 0
minor = minor + 1
break
} else if (label.name === 'version: breaking') {
major = major + 1
minor = 0
patch = 0
break
} else if (label.name === 'version: release') {
major = major + 1
minor = 0
patch = 0
break
}
}
const nextVersion = major + '.' + minor + '.' + patch
if (nextVersion === currentVersion) {
throw new Error("Could not detect the version label on PR " + pr.number + " (obtained via association to commit " + context.sha + ")")
}
console.log("Setting the next version to " + nextVersion)
var body = ""
if (pr.body === undefined || pr.body === null || pr.body === "") {
body = ""
} else {
body = "\n" + pr.body.replaceAll("\r\n", "\n")
}
// set outputs for
const result = {
nextVersion: nextVersion,
commitMessage: "Version release: " + nextVersion + "\n\n" + pr.title + body
}
return result
- name: Modify version
id: modify_version
run: 'echo ''ThisBuild / version := "${{fromJson(steps.compute_next_version.outputs.result).nextVersion}}"'' > version.sbt'
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: ${{fromJson(steps.compute_next_version.outputs.result).commitMessage}}
commit_user_name: precog-bot
commit_user_email: bot@precog.com