chore: import upstream snapshot with attribution
Fuzzer / Run Fuzzer (push) Has been cancelled
Race tests / Go race tests (ubuntu-22.04) (push) Has been cancelled

This commit is contained in:
wehub-resource-sync
2026-07-13 13:01:40 +08:00
commit 5357c39144
2379 changed files with 670828 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
# Dolt's GitHub Actions
This doc will provide context for the types of Workflows we use in this repository. This doc is not a comprehensive GitHub Actions tutorial. To familiarize yourself with GitHub Actions concepts and the terminology, please see the [documentation](https://docs.github.com/en/actions/learn-github-actions/understanding-github-actions).
Dolt uses GitHub Actions Workflows in four primary ways:
* To run continuous integration tests on pull requests and pushes to `main`
* To release and publish new Dolt assets
* To deploy various benchmarking jobs to contexts _other_ than GitHub Actions (like in a Kubernetes cluster, for example).
* To handle misc. [repository_dispatch](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#repository_dispatch) events triggered by external clients.
## Continuous Integration Workflows
Workflows prefixed with `ci-` are run on pull requests to `main`, though some run on pushes to `main` (after a pull request is merged). These workflows are synchronous and don't trigger any other workflows to run.
## Dolt Release Workflows
Workflows prefixed with `cd-` are used for releasing Dolt. Some of these workflows are asynchronous, meaning that they only perform part of a task before triggering the next part of a task to run in a _different_ workflow, sometimes in other GitHub repositories, using `repository_dispatch` events.
## Benchmarking Workflows
Benchmarking workflows are used as an interface for deploying benchmarking jobs to one of our Kubernetes Clusters. Workflows that deploy Kubernetes Jobs are prefixed with `k8s-` and can only be triggered with `repository_dispatch` events. Notice that benchmarking workflows, like `workflows/performance-benchmarks-email-report.yaml` for example, trigger these events using the `peter-evans/repository-dispatch@v2.0.0` Action.
These Kubernetes Jobs do not run on GitHub Actions Hosted Runners, so the workflow logs do not contain any information about the deployed Kubernetes Job or any errors it might have encountered. The workflow logs can only tell you if a Job was created successfully or not. To investigate an error or issue with a Job in our Kubernetes Cluster, see the debugging guide [here](https://github.com/dolthub/ld/blob/main/k8s/README.md#debug-performance-benchmarks-and-sql-correctness-jobs).
## Misc. Repository Dispatch Workflows
Some workflows perform single, common tasks and are triggered by `repository_dispatch` events. These include the `workflows/email-report.yaml` that emails the results of performance benchmarks to the team, or the `workflows/pull-report.yaml` that posts those same results to an open pull request. Workflows like these are triggered by external clients.
+221
View File
@@ -0,0 +1,221 @@
name: Bump Deps
on:
repository_dispatch:
types: [ bump-dependency ]
jobs:
sanitize-payload:
name: Sanitize Payload
runs-on: ubuntu-22.04
outputs:
label: ${{ steps.sanitize.outputs.label }}
safe_module: ${{ steps.sanitize.outputs.safe_module }}
safe_head: ${{ steps.sanitize.outputs.safe_head }}
safe_assignee: ${{ steps.sanitize.outputs.safe_assignee }}
safe_email: ${{ steps.sanitize.outputs.safe_email }}
safe_branch: ${{ steps.sanitize.outputs.safe_branch }}
safe_short: ${{ steps.sanitize.outputs.safe_short }}
steps:
- uses: actions/checkout@v6
- name: Validate & Sanitize Payload (script)
id: sanitize
env:
RAW_DEP: ${{ github.event.client_payload.dependency }}
RAW_SHA: ${{ github.event.client_payload.head_commit_sha }}
RAW_USER: ${{ github.event.client_payload.assignee }}
RAW_MAIL: ${{ github.event.client_payload.assignee_email }}
run: bash .github/scripts/sanitize_payload.sh
stale-bump-prs:
name: Retrieving Stale Bump PRs
needs: sanitize-payload
outputs:
stale-pulls: ${{ steps.get-stale-prs.outputs.open-pulls }}
runs-on: ubuntu-22.04
steps:
- name: Get Open Bump PRs
id: get-stale-prs
uses: actions/github-script@v7
env:
LABEL: ${{ needs.sanitize-payload.outputs.label }}
with:
debug: true
github-token: ${{ secrets.REPO_ACCESS_TOKEN }}
script: |
try {
const { LABEL } = process.env;
const { owner, repo } = context.repo;
const res = await github.rest.pulls.list({
owner,
repo,
state: 'open',
sort: 'created',
direction: 'desc',
});
const { data } = res;
const reduced = data.reduce((acc, p) => {
if (p.labels.length < 1) return acc;
let keepAlive = false;
let shouldPush = false;
for (const label of p.labels) {
if (label.name === LABEL) {
shouldPush = true;
}
if (label.name === "keep-alive") {
keepAlive = true;
}
}
if (shouldPush) {
acc.push({
number: p.number,
keepAlive,
headRef: p.head.ref,
});
}
return acc;
}, []);
console.log(reduced);
if (reduced.length > 0) core.setOutput("open-pulls", JSON.stringify(reduced));
process.exit(0);
} catch(err) {
console.log("Error:", err);
process.exit(1);
}
open-bump-pr:
needs: [sanitize-payload, stale-bump-prs]
name: Open Bump PR
runs-on: ubuntu-22.04
outputs:
latest-pr: ${{ steps.latest-pr.outputs.pr_url }}
steps:
- uses: actions/checkout@v6
with:
token: ${{ secrets.REPO_ACCESS_TOKEN || secrets.GITHUB_TOKEN }}
- name: Set up Go 1.x
uses: actions/setup-go@v5
with:
go-version-file: go/go.mod
- name: Bump dependency (safe)
working-directory: go
env:
SAFE_MODULE: ${{ needs.sanitize-payload.outputs.safe_module }}
SAFE_HEAD: ${{ needs.sanitize-payload.outputs.safe_head }}
run: |
GOOS=linux go get "${SAFE_MODULE}@${SAFE_HEAD}"
go mod tidy
- name: Get Assignee and Reviewer (safe)
id: get_reviewer
env:
ASSIGNEE: ${{ needs.sanitize-payload.outputs.safe_assignee }}
run: |
if [ "${ASSIGNEE}" == "zachmu" ]
then
echo "reviewer=Hydrocharged" >> $GITHUB_OUTPUT
else
echo "reviewer=zachmu" >> $GITHUB_OUTPUT
fi
- name: Create and Push new branch (safe)
env:
GIT_USER: ${{ needs.sanitize-payload.outputs.safe_assignee }}
GIT_MAIL: ${{ needs.sanitize-payload.outputs.safe_email }}
BRANCH: ${{ needs.sanitize-payload.outputs.safe_branch }}
COMMIT_BY: ${{ needs.sanitize-payload.outputs.safe_assignee }}
run: |
set -euo pipefail
git config --global user.name "${GIT_USER}"
git config --global user.email "${GIT_MAIL}"
git checkout -b "${BRANCH}"
git add .
git commit -m "[ga-bump-dep] Bump dependency in Dolt by ${COMMIT_BY}"
git push origin "${BRANCH}"
- name: pull-request
uses: repo-sync/pull-request@v2
id: latest-pr
with:
source_branch: ${{ needs.sanitize-payload.outputs.safe_branch }}
destination_branch: "main"
github_token: ${{ secrets.REPO_ACCESS_TOKEN }}
pr_title: "[auto-bump] [no-release-notes] dependency by ${{ needs.sanitize-payload.outputs.safe_assignee }}"
pr_template: ".github/markdown-templates/dep-bump.md"
pr_reviewer: ${{ steps.get_reviewer.outputs.reviewer }}
pr_assignee: ${{ needs.sanitize-payload.outputs.safe_assignee }}
pr_label: ${{ needs.sanitize-payload.outputs.label }}
comment-on-stale-prs:
needs: [open-bump-pr, stale-bump-prs]
if: ${{ needs.stale-bump-prs.outputs.stale-pulls != '' }}
runs-on: ubuntu-22.04
strategy:
matrix:
pull: ${{ fromJson(needs.stale-bump-prs.outputs.stale-pulls) }}
steps:
- name: Comment/Close Stale PRs
id: get-stale-prs
uses: actions/github-script@v7
env:
PULL: ${{ toJson(matrix.pull) }}
SUPERSEDED_BY: ${{ needs.open-bump-pr.outputs.latest-pr }}
with:
debug: true
github-token: ${{ secrets.REPO_ACCESS_TOKEN }}
script: |
try {
const { owner, repo } = context.repo;
const { PULL, SUPERSEDED_BY } = process.env;
const pull = JSON.parse(PULL);
if (pull.keepAlive) process.exit(0);
const checkSuiteRes = await github.rest.checks.listSuitesForRef({
owner,
repo,
ref: pull.headRef,
});
if (checkSuiteRes.data) {
const okConclusions = new Set(["success", "neutral", "skipped"]);
for (const suite of checkSuiteRes.data.check_suites) {
console.log("suite id:", suite.id);
console.log("suite app slug:", suite.app.slug);
console.log("suite status:", suite.status);
console.log("suite conclusion:", suite.conclusion);
if (suite.app.slug === "github-actions") {
if (suite.status !== "completed") {
console.log(`Leaving pr open due to status:${suite.status} conclusion:${suite.conclusion}`);
process.exit(0);
}
if (!suite.conclusion || !okConclusions.has(suite.conclusion)) {
console.log(`Leaving pr open due to status:${suite.status} conclusion:${suite.conclusion}`);
process.exit(0);
}
}
}
}
console.log(`Closing open pr ${pull.number}`);
await github.rest.issues.createComment({
issue_number: pull.number,
owner,
repo,
body: `This PR has been superseded by ${SUPERSEDED_BY}`
});
await github.rest.pulls.update({
owner,
repo,
pull_number: pull.number,
state: 'closed',
});
process.exit(0);
} catch(err) {
console.log("Error:", err);
process.exit(1);
}
+48
View File
@@ -0,0 +1,48 @@
name: Bump Dolt on winget
on:
workflow_dispatch:
inputs:
version:
description: 'SemVer format release tag, i.e. 0.24.5'
required: true
repository_dispatch:
types: [ bump-winget ]
jobs:
get-version:
name: Get Version
runs-on: ubuntu-22.04
outputs:
version: ${{ steps.get_version.outputs.version }}
steps:
- name: Get version
id: get_version
run: |
version=""
if [ "${{ github.event_name }}" == "repository_dispatch" ]
then
version="${{ github.event.client_payload.version }}"
else
version="${{ github.event.inputs.version }}"
fi
echo "version=$version" >> $GITHUB_OUTPUT
winget-bump:
needs: get-version
name: Bump Dolt winget
runs-on: windows-latest
defaults:
run:
shell: powershell
steps:
- name: Create winget PR
run: |
iwr https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
.\wingetcreate.exe update DoltHub.Dolt -u $Env:URL -v $Env:VERSION -t $Env:TOKEN --submit
env:
TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
VERSION: ${{ needs.get-version.outputs.version }}
URL: ${{ format('https://github.com/dolthub/dolt/releases/download/v{0}/dolt-windows-amd64.msi', needs.get-version.outputs.version) }}
@@ -0,0 +1,71 @@
name: Create Release Notes
on:
workflow_dispatch:
inputs:
version:
description: 'SemVer format release tag, i.e. 0.24.5'
required: true
repository_dispatch:
types: [ release-notes ]
jobs:
create-release-notes:
runs-on: ubuntu-22.04
steps:
- name: Get Vars
id: get_vars
run: |
if [ "$EVENT_NAME" == "workflow_dispatch" ]
then
release_id=$(curl -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/dolthub/dolt/releases/tags/v${{ github.event.inputs.version }} | jq '.id')
echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
echo "release_id=$release_id" >> $GITHUB_OUTPUT
else
echo "version=${{ github.event.client_payload.version }}" >> $GITHUB_OUTPUT
echo "release_id=${{ github.event.client_payload.release_id }}" >> $GITHUB_OUTPUT
fi
env:
EVENT_NAME: ${{ github.event_name }}
- name: Checkout Release Notes Generator
uses: actions/checkout@v6
with:
repository: dolthub/release-notes-generator
token: ${{ secrets.REPO_ACCESS_TOKEN }}
- name: Install Dependencies
run: sudo ./install-deps.sh
env:
PERL_MM_USE_DEFAULT: 1
- name: Create Notes
run: |
git clone https://github.com/dolthub/dolt.git
./gen_release_notes.pl \
--token "$TOKEN" \
-d dolthub/go-mysql-server \
-d dolthub/vitess dolthub/dolt v${{ steps.get_vars.outputs.version }} > changelog.txt
env:
TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
- name: Post Changelog to Release
uses: actions/github-script@v7
with:
debug: true
github-token: ${{ secrets.REPO_ACCESS_TOKEN }}
script: |
const fs = require('fs');
const path = require('path')
try {
const body = fs.readFileSync(path.join(process.env.WORKSPACE, "changelog.txt"), { encoding: "utf8" })
const res = await github.rest.repos.updateRelease({
owner: "dolthub",
repo: "dolt",
release_id: parseInt(process.env.RELEASE_ID, 10),
body,
});
console.log("Successfully updated release notes", res)
} catch (err) {
console.log("Error", err);
process.exit(1);
}
env:
WORKSPACE: ${{ github.workspace }}
RELEASE_ID: ${{ steps.get_vars.outputs.release_id }}
@@ -0,0 +1,98 @@
name: Push Docker Image to DockerHub
on:
workflow_dispatch:
inputs:
version:
description: 'SemVer format release tag, i.e. 0.24.5'
required: true
push_latest:
description: 'Also tag and push as latest'
type: boolean
default: true
repository_dispatch:
types: [ push-docker-image ]
jobs:
get-release-id:
name: Get Dolt Release Id
runs-on: ubuntu-22.04
outputs:
release_id: ${{ steps.get_release.outputs.release_id }}
steps:
- name: Get Release
id: get_release
run: |
release_id="$RELEASE_ID"
if [ "$EVENT_TYPE" == "workflow_dispatch" ]; then
release_id=$(curl -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/dolthub/dolt/releases/tags/v${{ github.event.inputs.version }} | jq '.id')
fi
echo "release_id=$release_id" >> $GITHUB_OUTPUT
env:
EVENT_TYPE: ${{ github.event_name }}
RELEASE_ID: ${{ github.event.client_payload.release_id }}
docker-image-push:
name: Push Docker Image
needs: get-release-id
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
platforms: linux/amd64,linux/arm64
- name: Build and push dolt image
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64
context: .
file: ./docker/Dockerfile
push: true
tags: dolthub/dolt:${{ github.event.inputs.version || github.event.client_payload.version }}${{ (github.event_name != 'workflow_dispatch' || inputs.push_latest) && ' , dolthub/dolt:latest' || '' }}
build-args: |
DOLT_VERSION=${{ github.event.inputs.version || github.event.client_payload.version }}
- name: Build and push dolt-sql-server image
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64
context: .
file: ./docker/serverDockerfile
push: true
tags: dolthub/dolt-sql-server:${{ github.event.inputs.version || github.event.client_payload.version }}${{ (github.event_name != 'workflow_dispatch' || inputs.push_latest) && ' , dolthub/dolt-sql-server:latest' || '' }}
build-args: |
DOLT_VERSION=${{ github.event.inputs.version || github.event.client_payload.version }}
- name: Update Docker Hub Readme for dolt image
uses: peter-evans/dockerhub-description@v4
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
repository: dolthub/dolt
readme-filepath: ./docker/README.md
- name: Update Docker Hub Readme for dolt-sql-server image
uses: peter-evans/dockerhub-description@v4
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
repository: dolthub/dolt-sql-server
readme-filepath: ./docker/serverREADME.md
- run: |
gh api \
--method PATCH \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/$REPO_OWNER/$REPO_NAME/releases/$RELEASE_ID \
-F "draft=false" -F "prerelease=false" -F "make_latest=true"
env:
GH_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN || secrets.GITHUB_TOKEN }}
REPO_OWNER: dolthub
REPO_NAME: dolt
RELEASE_ID: ${{ needs.get-release-id.outputs.release_id }}
+256
View File
@@ -0,0 +1,256 @@
name: Release PGO Dolt
on:
workflow_dispatch:
inputs:
version:
description: 'SemVer format release tag, i.e. 0.24.5'
required: true
profile_bucket:
description: 's3 bucket of dolt profile used to build pgo'
required: true
profile_key:
description: 's3 key of dolt profile used to build pgo'
required: true
branch:
description: 'git branch to release from'
required: false
default: 'main'
commit_sha:
description: 'exact commit SHA to build from'
required: false
skip_rpm:
description: 'skips rpm releases for older dolt releases'
required: false
default: false
repository_dispatch:
types: [ pgo-release ]
jobs:
format-version:
runs-on: ubuntu-22.04
outputs:
version: ${{ steps.format_version.outputs.version }}
steps:
- name: Format Input
id: format_version
run: |
version="${{ github.event.inputs.version || github.event.client_payload.version }}"
if [[ $version == v* ]];
then
version="${version:1}"
fi
echo "version=$version" >> $GITHUB_OUTPUT
create-pgo-release:
needs: format-version
runs-on: ubuntu-22.04
name: Release PGO Dolt
outputs:
release_id: ${{ steps.create_release.outputs.id }}
steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.event.inputs.branch || github.event.client_payload.branch || 'main' }}
token: ${{ secrets.DOLT_RELEASE_TOKEN }}
- name: Pin to exact commit SHA
if: ${{ github.event.inputs.commit_sha || github.event.client_payload.from_version }}
run: git checkout -B "$BRANCH" "$SHA"
env:
BRANCH: ${{ github.event.inputs.branch || github.event.client_payload.branch || 'main' }}
SHA: ${{ github.event.inputs.commit_sha || github.event.client_payload.from_version }}
- name: Set up Go 1.x
uses: actions/setup-go@v5
with:
go-version-file: go/go.mod
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
- name: Get Results
id: get-results
run: aws s3api get-object --bucket="$BUCKET" --key="$KEY" dolt-cpu-profile.pprof
env:
KEY: ${{ github.event.inputs.profile_key || github.event.client_payload.profile_key }}
BUCKET: ${{ github.event.inputs.profile_bucket || github.event.client_payload.bucket }}
- name: Update dolt version command
run: sed -i -e 's/ Version = ".*"/ Version = "'"$NEW_VERSION"'"/' "$FILE"
env:
FILE: ${{ format('{0}/go/cmd/dolt/doltversion/version.go', github.workspace) }}
NEW_VERSION: ${{ needs.format-version.outputs.version }}
- name: Set minver TBD to version
run: sed -i -e 's/minver:"TBD"/minver:"'"$NEW_VERSION"'"/' "$FILE"
env:
FILE: ${{ format('{0}/go/libraries/doltcore/servercfg/yaml_config.go', github.workspace) }}
NEW_VERSION: ${{ needs.format-version.outputs.version }}
- name: update minver_validation.txt
working-directory: ./go
run: go run -mod=readonly ./utils/genminver_validation/ $FILE
env:
FILE: ${{ format('{0}/go/libraries/doltcore/servercfg/testdata/minver_validation.txt', github.workspace) }}
- uses: EndBug/add-and-commit@v9.1.4
with:
message: ${{ format('[ga-bump-release] Update Dolt version to {0} and release v{0}', needs.format-version.outputs.version) }}
add: ${{ format('["{0}/go/cmd/dolt/doltversion/version.go", "{0}/go/libraries/doltcore/servercfg/yaml_config.go", "{0}/go/libraries/doltcore/servercfg/testdata/minver_validation.txt"]', github.workspace) }}
cwd: "."
pull: "--ff"
- name: Build PGO Binaries
id: build_binaries
run: |
latest=$(git rev-parse HEAD)
echo "commitish=$latest" >> $GITHUB_OUTPUT
GO_BUILD_VERSION=1.26.2 go/utils/publishrelease/buildpgobinaries.sh
env:
GO_BUILD_VERSION: "1.26.2"
PROFILE: ${{ format('{0}/dolt-cpu-profile.pprof', github.workspace) }}
- name: Create Release
id: create_release
uses: dolthub/create-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ needs.format-version.outputs.version }}
release_name: ${{ needs.format-version.outputs.version }}
draft: false
prerelease: true
commitish: ${{ steps.build_binaries.outputs.commitish }}
- name: Upload Linux AMD64 Distro
id: upload-linux-amd64-distro
uses: dolthub/upload-release-asset@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: go/out/dolt-linux-amd64.tar.gz
asset_name: dolt-linux-amd64.tar.gz
asset_content_type: application/zip
- name: Upload Linux ARM64 Distro
id: upload-linux-arm64-distro
uses: dolthub/upload-release-asset@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: go/out/dolt-linux-arm64.tar.gz
asset_name: dolt-linux-arm64.tar.gz
asset_content_type: application/zip
- name: Upload OSX AMD64 Distro
id: upload-osx-amd64-distro
uses: dolthub/upload-release-asset@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: go/out/dolt-darwin-amd64.tar.gz
asset_name: dolt-darwin-amd64.tar.gz
asset_content_type: application/zip
- name: Upload OSX ARM64 Distro
id: upload-osx-arm64-distro
uses: dolthub/upload-release-asset@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: go/out/dolt-darwin-arm64.tar.gz
asset_name: dolt-darwin-arm64.tar.gz
asset_content_type: application/zip
- name: Upload Windows Distro
id: upload-windows-distro
uses: dolthub/upload-release-asset@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: go/out/dolt-windows-amd64.zip
asset_name: dolt-windows-amd64.zip
asset_content_type: application/zip
- name: Upload Windows Distro 7z
id: upload-windows-distro-7z
uses: dolthub/upload-release-asset@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: go/out/dolt-windows-amd64.7z
asset_name: dolt-windows-amd64.7z
asset_content_type: application/x-7z-compressed
- name: Upload Install Script
id: upload-install-script
uses: dolthub/upload-release-asset@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: go/out/install.sh
asset_name: install.sh
asset_content_type: text/plain
- name: Upload Linux AMD64 RPM
if: ${{ !github.event.inputs.skip_rpm }}
id: upload-linux-amd64-rpm
uses: dolthub/upload-release-asset@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: go/out/dolt-${{ needs.format-version.outputs.version }}-1.x86_64.rpm
asset_name: dolt-${{ needs.format-version.outputs.version }}-1.x86_64.rpm
asset_content_type: application/zip
- name: Upload Linux ARM64 RPM
if: ${{ !github.event.inputs.skip_rpm }}
id: upload-linux-arm64-rpm
uses: dolthub/upload-release-asset@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: go/out/dolt-${{ needs.format-version.outputs.version }}-1.aarch64.rpm
asset_name: dolt-${{ needs.format-version.outputs.version }}-1.aarch64.rpm
asset_content_type: application/zip
create-windows-msi:
needs: [format-version, create-pgo-release]
runs-on: ubuntu-22.04
steps:
- name: Trigger Upload MSI
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
event-type: upload-msi
repository: dolthub/windows-msi-creator
client-payload: '{"tag": "${{ needs.format-version.outputs.version }}", "release_id": "${{ needs.create-pgo-release.outputs.release_id }}", "actor": "${{ github.actor }}", "bucket": "${{ github.event.inputs.profile_bucket || github.event.client_payload.bucket }}", "profile_key": "${{ github.event.inputs.profile_key || github.event.client_payload.profile_key }}"}'
create-release-notes:
needs: [format-version, create-pgo-release]
runs-on: ubuntu-22.04
steps:
- name: Trigger Release Notes
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
event-type: release-notes
client-payload: '{"version": "${{ needs.format-version.outputs.version }}", "release_id": "${{ needs.create-pgo-release.outputs.release_id }}"}'
trigger-performance-benchmark-email:
needs: [format-version, create-pgo-release]
runs-on: ubuntu-22.04
steps:
- name: Trigger Performance Benchmarks
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
event-type: release-dolt
client-payload: '{"version": "${{ needs.format-version.outputs.version }}", "actor": "${{ github.actor }}", "profile_key": "${{ github.event.inputs.profile_key || github.event.client_payload.profile_key }}"}'
docker-image-push:
needs: [format-version, create-pgo-release]
runs-on: ubuntu-22.04
steps:
- name: Trigger Push Docker Image
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
event-type: push-docker-image
client-payload: '{"version": "${{ needs.format-version.outputs.version }}", "release_id": "${{ needs.create-pgo-release.outputs.release_id }}" }'
+47
View File
@@ -0,0 +1,47 @@
name: Release Dolt
on:
workflow_dispatch:
inputs:
version:
description: 'SemVer format release tag, i.e. 0.24.5'
required: true
branch:
description: 'git branch to release from'
required: false
default: 'main'
jobs:
format-version:
runs-on: ubuntu-22.04
outputs:
version: ${{ steps.format_version.outputs.version }}
steps:
- name: Format Input
id: format_version
run: |
version="${{ github.event.inputs.version }}"
if [[ $version == v* ]];
then
version="${version:1}"
fi
echo "version=$version" >> $GITHUB_OUTPUT
profile-benchmark-dolt:
runs-on: ubuntu-22.04
needs: format-version
name: Trigger Benchmark Profile K8s Workflows
steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.event.inputs.branch }}
- name: Get sha
id: get_sha
run: |
sha=$(git rev-parse --short HEAD)
echo "sha=$sha" >> $GITHUB_OUTPUT
- uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
event-type: profile-dolt
client-payload: '{"from_version": "${{ steps.get_sha.outputs.sha }}", "future_version": "${{ needs.format-version.outputs.version }}", "mode": "release", "actor": "${{ github.actor }}", "actor_email": "dustin@dolthub.com", "template_script": "./.github/scripts/performance-benchmarking/get-dolt-profile-job-json.sh", "branch": "${{ github.event.inputs.branch }}"}'
+138
View File
@@ -0,0 +1,138 @@
name: Test Bats MacOS
on:
workflow_dispatch:
schedule:
- cron: '0 1 * * *'
concurrency:
group: ci-bats-mac-nightly
cancel-in-progress: true
jobs:
test:
name: Bats tests
defaults:
run:
shell: bash
runs-on: macos-latest
strategy:
fail-fast: true
env:
use_credentials: ${{ secrets.AWS_SECRET_ACCESS_KEY != '' && secrets.AWS_ACCESS_KEY_ID != '' }}
steps:
- name: Conditionally Set ENV VARS for AWS tests
run: |
if [[ $use_credentials == true ]]; then
echo "AWS_SDK_LOAD_CONFIG=1" >> $GITHUB_ENV
echo "AWS_REGION=us-west-2" >> $GITHUB_ENV
echo "DOLT_BATS_AWS_TABLE=dolt-ci-bats-manifests-us-west-2" >> $GITHUB_ENV
echo "DOLT_BATS_AWS_BUCKET=dolt-ci-bats-chunks-us-west-2" >> $GITHUB_ENV
echo "DOLT_BATS_AWS_EXISTING_REPO=aws_remote_bats_tests__dolt__" >> $GITHUB_ENV
fi
- name: Configure AWS Credentials
if: ${{ env.use_credentials == 'true' }}
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
role-duration-seconds: 10800 # 3 hours D:
- uses: actions/checkout@v6
- name: Set up Go toolchain
uses: ./.github/actions/setup-go-toolchain
- name: Setup Python 3.x
uses: actions/setup-python@v5
with:
python-version: "3.10"
- uses: actions/setup-node@v4
with:
node-version: ^16
- name: Build dolt
uses: ./.github/actions/build-dolt
with:
remotesrv: 'true'
noms: 'true'
- name: Install Bats
run: |
npm i bats
echo "$(pwd)/node_modules/.bin" >> $GITHUB_PATH
working-directory: ./.ci_bin
- name: Install Python Deps
run: |
pip install mysql-connector-python
pip install pandas
pip install pyarrow
- name: Install MySQL client LTS release (8.4)
run: |
brew update
brew install mysql-client@8.4
brew link mysql-client@8.4 --force
mysql --version
- name: Setup Dolt Config
uses: ./.github/actions/setup-dolt-config
- name: Install Maven
working-directory: ./.ci_bin
run: |
curl -LO https://dlcdn.apache.org/maven/maven-3/3.9.15/binaries/apache-maven-3.9.15-bin.tar.gz
tar -xf apache-maven-3.9.15-bin.tar.gz
echo "$(pwd)/apache-maven-3.9.15/bin" >> $GITHUB_PATH
- name: Install Hadoop
working-directory: ./.ci_bin
run: |
curl -LO https://downloads.apache.org/hadoop/common/hadoop-3.3.6/hadoop-3.3.6.tar.gz
tar xvf hadoop-3.3.6.tar.gz
echo "$(pwd)/hadoop-3.3.6/bin" >> $GITHUB_PATH
- name: Install parquet-cli
id: parquet_cli
working-directory: ./.ci_bin
run: |
curl -OL https://github.com/apache/parquet-mr/archive/refs/tags/apache-parquet-1.12.3.tar.gz
tar zxvf apache-parquet-1.12.3.tar.gz
cd parquet-java-apache-parquet-1.12.3/parquet-cli
mvn clean install -DskipTests
runtime_jar="$(pwd)"/target/parquet-cli-1.12.3-runtime.jar
echo "runtime_jar=$runtime_jar" >> $GITHUB_OUTPUT
- name: Check expect
run: expect -v
- name: Test all Mac
env:
SQL_ENGINE: "local-engine"
PARQUET_RUNTIME_JAR: ${{ steps.parquet_cli.outputs.runtime_jar }}
BATS_TEST_RETRIES: "3"
run: |
bats --tap $BATS_FILTER .
working-directory: ./integration-tests/bats
report-bats-failure:
name: Report Bats MacOS Failure via Email
needs: test
runs-on: ubuntu-22.04
if: always() && (needs.test.result == 'failure')
steps:
- uses: actions/checkout@v6
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
- name: Send Email
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: ./.github/actions/ses-email-action
with:
region: us-west-2
version: ${{ github.ref }}
template: 'BatsMacFailureTemplate'
toAddresses: '["${{ github.event.inputs.email }}"]'
workflowURL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: Send Email
if: ${{ github.event_name == 'schedule' }}
uses: ./.github/actions/ses-email-action
with:
region: us-west-2
version: ${{ github.event.client_payload.ref }}
template: 'BatsMacFailureTemplate'
toAddresses: '["dolts@dolthub.com", "tim@dolthub.com"]'
workflowURL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
+101
View File
@@ -0,0 +1,101 @@
name: Test Bats Unix Remote
on:
pull_request:
branches: [ main ]
paths:
- 'go/**'
- 'integration-tests/**'
concurrency:
group: ci-bats-unix-remote${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
test:
name: Bats tests
defaults:
run:
shell: bash
runs-on: ubuntu-22.04
strategy:
fail-fast: true
env:
use_credentials: ${{ secrets.AWS_SECRET_ACCESS_KEY != '' && secrets.AWS_ACCESS_KEY_ID != '' }}
# We only run these as seaparte workflow if we do not have AWS credentials.
steps:
- uses: actions/checkout@v6
if: ${{ env.use_credentials != 'true' }}
- name: Set up Go toolchain
if: ${{ env.use_credentials != 'true' }}
uses: ./.github/actions/setup-go-toolchain
- name: Setup Python 3.x
if: ${{ env.use_credentials != 'true' }}
uses: actions/setup-python@v5
with:
python-version: "3.10"
- uses: actions/setup-node@v4
if: ${{ env.use_credentials != 'true' }}
with:
node-version: ^16
- name: Build dolt
if: ${{ env.use_credentials != 'true' }}
uses: ./.github/actions/build-dolt
with:
remotesrv: 'true'
noms: 'true'
- name: Install Bats
if: ${{ env.use_credentials != 'true' }}
run: |
npm i bats
echo "$(pwd)/node_modules/.bin" >> $GITHUB_PATH
working-directory: ./.ci_bin
- name: Install Python Deps
if: ${{ env.use_credentials != 'true' }}
run: |
pip install mysql-connector-python
pip install pandas
pip install pyarrow
- name: Setup Dolt Config
if: ${{ env.use_credentials != 'true' }}
uses: ./.github/actions/setup-dolt-config
- name: Install expect
if: ${{ env.use_credentials != 'true' }}
run: sudo apt-get install -y expect
- name: Install Maven
if: ${{ env.use_credentials != 'true' }}
working-directory: ./.ci_bin
run: |
curl -LO https://dlcdn.apache.org/maven/maven-3/3.9.15/binaries/apache-maven-3.9.15-bin.tar.gz
tar -xf apache-maven-3.9.15-bin.tar.gz
echo "$(pwd)/apache-maven-3.9.15/bin" >> $GITHUB_PATH
- name: Install Hadoop
if: ${{ env.use_credentials != 'true' }}
working-directory: ./.ci_bin
run: |
curl -LO https://downloads.apache.org/hadoop/common/hadoop-3.3.6/hadoop-3.3.6.tar.gz
tar xvf hadoop-3.3.6.tar.gz
echo "$(pwd)/hadoop-3.3.6/bin" >> $GITHUB_PATH
- name: Install parquet-cli
if: ${{ env.use_credentials != 'true' }}
id: parquet_cli
working-directory: ./.ci_bin
run: |
curl -OL https://github.com/apache/parquet-mr/archive/refs/tags/apache-parquet-1.12.3.tar.gz
tar zxvf apache-parquet-1.12.3.tar.gz
cd parquet-java-apache-parquet-1.12.3/parquet-cli
mvn clean install -DskipTests
runtime_jar="$(pwd)"/target/parquet-cli-1.12.3-runtime.jar
echo "runtime_jar=$runtime_jar" >> $GITHUB_OUTPUT
- name: Check expect
if: ${{ env.use_credentials != 'true' }}
run: expect -v
- name: Test all Unix
if: ${{ env.use_credentials != 'true' }}
env:
SQL_ENGINE: "remote-engine"
PARQUET_RUNTIME_JAR: ${{ steps.parquet_cli.outputs.runtime_jar }}
BATS_TEST_RETRIES: "3"
run: |
bats --print-output-on-failure --tap .
working-directory: ./integration-tests/bats
+134
View File
@@ -0,0 +1,134 @@
name: Test Bats Unix
on:
pull_request:
branches: [ main ]
paths:
- 'go/**'
- 'integration-tests/**'
concurrency:
group: ci-bats-unix-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
test:
name: Bats tests
defaults:
run:
shell: bash
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ ubuntu-22.04 ]
env:
use_credentials: ${{ secrets.AWS_SECRET_ACCESS_KEY != '' && secrets.AWS_ACCESS_KEY_ID != '' }}
steps:
# Docker entrypoint and docker tests in general may use more space than is available in the GitHub default runner,
# so we remove unused pre-installed programs.
- name: Free disk space
run: |
NAME="DISK-CLEANUP"
echo "[${NAME}] Starting background cleanup..."
[ -d /usr/share/dotnet ] && sudo rm -rf /usr/share/dotnet &
[ -d /usr/local/lib/android ] && sudo rm -rf /usr/local/lib/android &
[ -d /opt/ghc ] && sudo rm -rf /opt/ghc &
[ -d /usr/local/share/boost ] && sudo rm -rf /usr/local/share/boost &
- name: Conditionally Set ENV VARS for AWS tests
run: |
if [[ $use_credentials == true ]]; then
echo "AWS_SDK_LOAD_CONFIG=1" >> $GITHUB_ENV
echo "AWS_REGION=us-west-2" >> $GITHUB_ENV
echo "DOLT_BATS_AWS_TABLE=dolt-ci-bats-manifests-us-west-2" >> $GITHUB_ENV
echo "DOLT_BATS_AWS_BUCKET=dolt-ci-bats-chunks-us-west-2" >> $GITHUB_ENV
echo "DOLT_BATS_AWS_EXISTING_REPO=aws_remote_bats_tests__dolt__" >> $GITHUB_ENV
fi
- name: Configure filter tags for lambda bats
if: ${{ matrix.os == 'ubuntu-22.04' && env.use_credentials == 'true' }}
run: |
echo "BATS_FILTER=--filter-tags no_lambda" >> $GITHUB_ENV
- name: Configure AWS Credentials
if: ${{ env.use_credentials == 'true' }}
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
role-duration-seconds: 10800 # 3 hours D:
- uses: actions/checkout@v6
- name: Set up Go toolchain
uses: ./.github/actions/setup-go-toolchain
- name: Setup Python 3.x
uses: actions/setup-python@v5
with:
python-version: "3.10"
- uses: actions/setup-node@v4
with:
node-version: ^16
- name: Build dolt
uses: ./.github/actions/build-dolt
with:
remotesrv: 'true'
noms: 'true'
- name: Install Bats
run: |
npm i bats
echo "$(pwd)/node_modules/.bin" >> $GITHUB_PATH
working-directory: ./.ci_bin
- name: Install Python Deps
run: |
pip install mysql-connector-python
pip install pandas
pip install pyarrow
- name: Setup Dolt Config
uses: ./.github/actions/setup-dolt-config
- name: Install expect
if: matrix.os == 'ubuntu-22.04'
run: sudo apt-get install -y expect
- name: Install pcre2grep
if: matrix.os == 'ubuntu-22.04'
run: sudo apt-get install -y pcre2-utils
- name: Install openssh-server
if: matrix.os == 'ubuntu-22.04'
run: sudo apt-get install -y openssh-server
- name: Install Maven
run: sudo apt-get install -y maven
- name: Install Hadoop
working-directory: ./.ci_bin
run: |
curl -LO https://downloads.apache.org/hadoop/common/hadoop-3.3.6/hadoop-3.3.6.tar.gz
tar xvf hadoop-3.3.6.tar.gz
echo "$(pwd)/hadoop-3.3.6/bin" >> $GITHUB_PATH
- name: Install parquet-cli
id: parquet_cli
working-directory: ./.ci_bin
run: |
curl -OL https://github.com/apache/parquet-mr/archive/refs/tags/apache-parquet-1.12.3.tar.gz
tar zxvf apache-parquet-1.12.3.tar.gz
cd parquet-java-apache-parquet-1.12.3/parquet-cli
mvn clean install -DskipTests
runtime_jar="$(pwd)"/target/parquet-cli-1.12.3-runtime.jar
echo "runtime_jar=$runtime_jar" >> $GITHUB_OUTPUT
- name: Check expect
run: expect -v
- name: Test all Unix
env:
SQL_ENGINE: "local-engine"
PARQUET_RUNTIME_JAR: ${{ steps.parquet_cli.outputs.runtime_jar }}
BATS_TEST_RETRIES: "3"
run: |
bats --print-output-on-failure --tap $BATS_FILTER .
working-directory: ./integration-tests/bats
- name: Test all Unix, SQL_ENGINE=remote-engine
# If we have AWS credentials, we run these remote-engine tests here instead of in the separate job.
if: ${{ env.use_credentials == 'true' && matrix.os == 'ubuntu-22.04' }}
env:
SQL_ENGINE: "remote-engine"
PARQUET_RUNTIME_JAR: ${{ steps.parquet_cli.outputs.runtime_jar }}
BATS_TEST_RETRIES: "3"
run: |
bats --print-output-on-failure --tap $BATS_FILTER .
working-directory: ./integration-tests/bats
+173
View File
@@ -0,0 +1,173 @@
name: Test Bats Windows
on:
workflow_dispatch:
inputs:
email:
description: 'Email address to receive bats failure notification'
required: true
default: ''
repository_dispatch:
types: [ bats-windows ]
jobs:
get-files:
name: Get file list
runs-on: ubuntu-22.04
outputs:
files: ${{ steps.get_file_list.outputs.files }}
steps:
- uses: actions/checkout@v6
if: ${{ github.event_name == 'repository_dispatch' }}
with:
ref: ${{ github.event.client_payload.ref }}
- uses: actions/checkout@v6
if: ${{ github.event_name == 'workflow_dispatch' }}
- name: Get file list
id: get_file_list
run: |
files=$(ls *.bats)
SAVEIFS=$IFS
IFS=$'\n'
file_arr=($files)
echo "files=${file_arr[@]}" >> $GITHUB_OUTPUT
IFS=$SAVEIFS
working-directory: ./integration-tests/bats
format-files-output:
name: Format files output
runs-on: ubuntu-22.04
needs: get-files
outputs:
files: ${{ steps.format_files.outputs.files }}
steps:
- name: Format
id: format_files
uses: actions/github-script@v7
env:
FILES: ${{ needs.get-files.outputs.files }}
with:
debug: true
github-token: ${{ secrets.REPO_ACCESS_TOKEN || secrets.GITHUB_TOKEN }}
script: |
try {
const { FILES } = process.env;
const fileList = FILES.split(" ");
core.setOutput("files", JSON.stringify(fileList));
process.exit(0);
} catch(err) {
console.log("Error:", err);
process.exit(1);
}
test-per-file:
name: Test file
needs: format-files-output
defaults:
run:
shell: bash
runs-on: windows-latest
env:
use_credentials: ${{ secrets.AWS_SECRET_ACCESS_KEY != '' && secrets.AWS_ACCESS_KEY_ID != '' }}
strategy:
matrix:
file: ${{ fromJson(needs.format-files-output.outputs.files) }}
steps:
- name: Conditionally Set ENV VARS for AWS tests
run: |
if [[ $use_credentials == true ]]; then
echo "AWS_SDK_LOAD_CONFIG=1" >> $GITHUB_ENV
echo "AWS_REGION=us-west-2" >> $GITHUB_ENV
echo "DOLT_BATS_AWS_TABLE=dolt-ci-bats-manifests-us-west-2" >> $GITHUB_ENV
echo "DOLT_BATS_AWS_BUCKET=dolt-ci-bats-chunks-us-west-2" >> $GITHUB_ENV
echo "DOLT_BATS_AWS_EXISTING_REPO=aws_remote_bats_tests" >> $GITHUB_ENV
fi
- name: Configure AWS Credentials
if: ${{ env.use_credentials == 'true' }}
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
role-duration-seconds: 3600
- uses: actions/checkout@v6
if: ${{ github.event_name == 'repository_dispatch' }}
with:
ref: ${{ github.event.client_payload.ref }}
- name: Set up Go toolchain
uses: ./.github/actions/setup-go-toolchain
- name: Setup Python 3.x
uses: actions/setup-python@v5
with:
python-version: "3.10"
- uses: actions/checkout@v6
if: ${{ github.event_name == 'workflow_dispatch' }}
- uses: actions/setup-node@v4
with:
node-version: ^16
- name: Build dolt
uses: ./.github/actions/build-dolt
with:
remotesrv: 'true'
noms: 'true'
- name: Install Bats Windows
run: |
git clone https://github.com/bats-core/bats-core.git
cd bats-core
./install.sh $HOME
working-directory: ./.ci_bin
- name: Install wslpath
run: |
choco install wget
wget 'https://raw.githubusercontent.com/laurent22/wslpath/master/wslpath'
chmod 755 wslpath
mv wslpath /usr/bin/
cp /c/tools/php/php /usr/bin/
- name: Install Python Deps
run: |
pip install mysql-connector-python
pip install pandas
pip install pyarrow
- name: Setup Dolt Config
uses: ./.github/actions/setup-dolt-config
- name: Test file
run: bats --tap ${{ matrix.file }}
working-directory: ./integration-tests/bats
env:
IS_WINDOWS: true
WINDOWS_BASE_DIR: "/d/a"
BATS_TEST_RETRIES: "3"
report-bats-failure:
name: Report Bats Windows Failure via Email
needs: test-per-file
runs-on: ubuntu-22.04
if: always() && (needs.test-per-file.result == 'failure')
steps:
- uses: actions/checkout@v6
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
- name: Send Email
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: ./.github/actions/ses-email-action
with:
region: us-west-2
version: ${{ github.ref }}
template: 'BatsWindowsFailureTemplate'
toAddresses: '["${{ github.event.inputs.email }}"]'
workflowURL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: Send Email
if: ${{ github.event_name == 'repository_dispatch' }}
uses: ./.github/actions/ses-email-action
with:
region: us-west-2
version: ${{ github.event.client_payload.ref }}
template: 'BatsWindowsFailureTemplate'
toAddresses: '["${{ github.event.client_payload.actor_email }}", "tim@dolthub.com"]'
workflowURL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
@@ -0,0 +1,24 @@
name: Test Benchmark Runner Utility Works
on:
pull_request:
branches: [ main ]
paths:
- 'go/**'
- 'integration-tests/**'
concurrency:
group: ci-benchmark-runner-tests-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
benchmark_runner:
runs-on: ubuntu-22.04
name: Test Benchmark Runner
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Copy Dockerfile
run: cp -r ./go/performance/continuous_integration/. .
- name: Test runner
uses: ./.github/actions/benchmark-runner-tests
+56
View File
@@ -0,0 +1,56 @@
name: Test Binlog
on:
pull_request:
branches: [ main ]
paths:
- 'go/**'
workflow_dispatch:
concurrency:
group: ci-binlog-tests-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
binlog-test:
name: Binlog tests
defaults:
run:
shell: bash
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v6
- name: Set up Go toolchain
uses: ./.github/actions/setup-go-toolchain
- name: Test Binlog
working-directory: ./go
run: |
# Test binlog packages
go test -vet=off -timeout 60m ./libraries/doltcore/sqle/binlogreplication/...
env:
MATRIX_OS: ${{ matrix.os }}
binlog-race-test:
name: Binlog tests - race
defaults:
run:
shell: bash
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v6
- name: Set up Go toolchain
uses: ./.github/actions/setup-go-toolchain
- name: Test Binlog with Race
working-directory: ./go
run: |
# Test binlog packages with race detector
go test -vet=off -timeout 60m -race ./libraries/doltcore/sqle/binlogreplication/...
env:
MATRIX_OS: ${{ matrix.os }}
@@ -0,0 +1,22 @@
name: Check for correctness_approved label
on:
pull_request:
paths:
- 'go/**'
branches: [main]
types: [opened, labeled, unlabeled, synchronize]
jobs:
label:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: mheap/github-action-required-labels@v5
if: github.actor != 'dependabot[bot]'
with:
mode: exactly
count: 1
labels: "correctness_approved"
add_comment: true
message: "This PR is being tested for SQL correctness. Please allow ~25 mins for this to complete. If this PR does not result in a SQL correctness regression, the `correctness_approved` label will be automatically added to this PR and the `Check for correctness_approved` workflow will succeed."
@@ -0,0 +1,22 @@
name: Check for performance_approved label
on:
pull_request:
paths:
- 'go/**'
branches: [main]
types: [opened, labeled, unlabeled, synchronize]
jobs:
label:
if: github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: mheap/github-action-required-labels@v5
with:
mode: exactly
count: 1
labels: "performance_approved"
add_comment: true
message: "<!-- go-run-output -->\nThis PR is being tested for performance. Please allow ~25 mins for this to complete. If this PR does not result in a performance regression, the `performance_approved` label will be automatically added to this PR."
+157
View File
@@ -0,0 +1,157 @@
name: Check Formatting, Committers and Generated Code
on:
pull_request:
branches: [ main ]
concurrency:
group: ci-check-repo-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
verify:
name: Verify format and committers
runs-on: ubuntu-22.04
outputs:
format: ${{ steps.should_format.outputs.format }}
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Setup Go 1.x
uses: actions/setup-go@v5
with:
go-version-file: go/go.mod
- name: Check all
id: should_format
working-directory: ./go
# Keep this in sync with //go/utils/prepr/prepr.sh.
run: |
GOFLAGS="-mod=readonly" go build ./...
go vet -mod=readonly ./...
go run -mod=readonly ./utils/copyrightshdrs/
./Godeps/verify.sh
./utils/repofmt/check_bats_fmt.sh
if ./utils/repofmt/check_fmt.sh ; then
echo "code is formatted"
else
echo "code is not formatted"
if [ "${{ github.repository }}" != "dolthub/dolt" ]; then
echo "Pull requests from forks must be manually formatted."
echo "Please run dolt/go/utils/repofmt/format_repo.sh to format this pull request."
exit 1;
fi
echo "format=true" >> $GITHUB_OUTPUT
fi
env:
BRANCH_NAME: ${{ github.head_ref }}
CHANGE_TARGET: ${{ github.base_ref }}
- name: Check generated protobufs and flatbuffers
working-directory: ./proto
run: |
bazel run //:update
changes=$(git status --porcelain)
diff=$(git diff)
if [ ! -z "$changes" ]; then
echo "ERROR: Generated protobuf structs and/or flatbuffer messages are different from the checked in version."
echo "$changes"
echo "$diff"
exit 1
fi
get-artifacts:
needs: verify
if: ${{ needs.verify.outputs.format == 'true' }}
name: Get artifacts
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v6
with:
ref: "main"
repository: "dolthub/dolt"
submodules: true
- name: Setup Go 1.x
uses: actions/setup-go@v5
with:
go-version-file: go/go.mod
- name: Copy script
working-directory: ./go/utils/repofmt
run: cp format_repo.sh _format_repo.sh
- name: Build go deps tool
working-directory: go/utils/3pdeps
run: go build .
- uses: actions/upload-artifact@v4
with:
name: update-godeps-tool
path: go/utils/3pdeps/3pdeps
- uses: actions/upload-artifact@v4
with:
name: format-code-script
path: go/utils/repofmt/_format_repo.sh
format:
needs: [verify, get-artifacts]
if: ${{ needs.verify.outputs.format == 'true' }}
name: Format PR
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.head.ref || github.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }}
submodules: true
token: ${{ secrets.REPO_ACCESS_TOKEN || secrets.GITHUB_TOKEN }}
- name: Setup Go 1.x
uses: actions/setup-go@v5
with:
go-version-file: go/go.mod
- name: Run go mod tidy
run: go mod tidy
working-directory: ./go
- name: Install goimports
run: go install golang.org/x/tools/cmd/goimports@latest
- uses: actions/download-artifact@v4
with:
name: format-code-script
path: go/utils/repofmt
- uses: actions/download-artifact@v4
with:
name: update-godeps-tool
path: go
- name: Format repo
working-directory: ./go
run: |
chmod +x ./utils/repofmt/_format_repo.sh
./utils/repofmt/_format_repo.sh
env:
BRANCH_NAME: ${{ github.head_ref }}
CHANGE_TARGET: ${{ github.base_ref }}
- name: Update Go deps
working-directory: ./go
run: |
chmod +x ./3pdeps
( GOOS=linux GOARCH=amd64 go list -deps -json ./cmd/dolt/. && \
GOOS=linux GOARCH=386 go list -deps -json ./cmd/dolt/. && \
GOOS=linux GOARCH=arm64 go list -deps -json ./cmd/dolt/. && \
GOOS=windows GOARCH=amd64 go list -deps -json ./cmd/dolt/. && \
GOOS=windows GOARCH=arm64 go list -deps -json ./cmd/dolt/. && \
GOOS=darwin GOARCH=amd64 go list -deps -json ./cmd/dolt/. && \
GOOS=darwin GOARCH=arm64 go list -deps -json ./cmd/dolt/. ) \
| ./3pdeps > ./Godeps/LICENSES
- name: Remove artifacts
run: |
rm go/3pdeps
rm go/utils/repofmt/_format_repo.sh
- name: Changes detected
id: detect-changes
run: |
changes=$(git status --porcelain)
if [ ! -z "$changes" ]; then
echo "has-changes=true" >> $GITHUB_OUTPUT
fi
- uses: EndBug/add-and-commit@v9.1.4
if: ${{ steps.detect-changes.outputs.has-changes == 'true' }}
with:
message: "[ga-format-pr] Run go/utils/repofmt/format_repo.sh and go/Godeps/update.sh"
add: "."
cwd: "."
pull: "--ff"
@@ -0,0 +1,42 @@
name: Check Compatibility
on:
pull_request:
branches: [ main ]
paths:
- 'go/**'
- 'integration-tests/**'
concurrency:
group: ci-compatibility-tests-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
test:
name: Compatibility Test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ ubuntu-22.04 ]
steps:
- uses: actions/checkout@v6
- name: Set up Go toolchain
uses: ./.github/actions/setup-go-toolchain
- uses: actions/setup-node@v4
with:
node-version: ^16
- name: Install netcat
run: sudo apt-get update && sudo apt-get install -y netcat-openbsd
- name: Build dolt
uses: ./.github/actions/build-dolt
- name: Install Bats
run: |
npm i bats
echo "$(pwd)/node_modules/.bin" >> $GITHUB_PATH
working-directory: ./.ci_bin
- name: Setup Dolt Config
uses: ./.github/actions/setup-dolt-config
- name: Test all
run: ./runner.sh
working-directory: ./integration-tests/compatibility
@@ -0,0 +1,24 @@
name: Test Data Dump Loading integrations
on:
pull_request:
paths:
- 'go/**'
- 'integration-tests/**'
concurrency:
group: ci-data-dump-loading-tests-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
data_dump_laoding_integrations_job:
runs-on: ubuntu-22.04
timeout-minutes: 30
name: Run tests
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Copy go package
run: cp -r ./go ./integration-tests/go
- name: Test data dump loading integrations
uses: ./.github/actions/data-dump-loading-tests
+32
View File
@@ -0,0 +1,32 @@
name: Race tests
on:
push:
branches: [ main ]
paths:
- 'go/**'
workflow_dispatch:
jobs:
racetests:
name: Go race tests
defaults:
run:
shell: bash
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-22.04 ]
steps:
- uses: actions/checkout@v6
- name: Set up Go toolchain
uses: ./.github/actions/setup-go-toolchain
- name: Test engine
working-directory: ./go
run: |
DOLT_SKIP_PREPARED_ENGINETESTS=1 go test -vet=off -v -race -timeout 30m github.com/dolthub/dolt/go/libraries/doltcore/sqle/enginetest
- name: Test concurrentmap
working-directory: ./go
run: |
go test -vet=off -v -race -timeout 1m github.com/dolthub/dolt/go/libraries/utils/concurrentmap
+96
View File
@@ -0,0 +1,96 @@
name: Test Go
on:
pull_request:
branches: [ main ]
paths:
- 'go/**'
- '.github/workflows/ci-go-tests.yaml'
workflow_dispatch:
concurrency:
group: ci-go-tests-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
test:
name: Go tests
defaults:
run:
shell: bash
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-22.04, windows-latest]
steps:
- uses: actions/checkout@v6
- name: Set up Go toolchain
id: toolchain
uses: ./.github/actions/setup-go-toolchain
- name: Test All
working-directory: ./go
run: |
files=$(go list ./...)
SAVEIFS=$IFS
IFS=$'\n'
file_arr=($files)
IFS=$SAVEIFS
if [ "$MATRIX_OS" == 'windows-latest' ]; then
export PATH=$(cygpath -u "$MSYS2_LOCATION"/ucrt64/bin):"$PATH"
fi
for (( i=0; i<${#file_arr[@]}; i++ ))
do
# Skip binlog tests as they run in a separate CI job
if [[ "${file_arr[$i]}" == *binlogreplication* ]]; then
echo "Skipping binlog package: ${file_arr[$i]} (runs in separate CI)"
continue
fi
echo "Testing Package: ${file_arr[$i]}"
if [ "$MATRIX_OS" == 'ubuntu-22.04' ]
then
if [[ "${file_arr[$i]}" != *enginetest* ]]; then
go test -vet=off -timeout 45m -race "${file_arr[$i]}"
else
echo "skipping enginetests for -race"
fi
else
go test -vet=off -timeout 45m "${file_arr[$i]}"
fi
succeeded=$(echo "$?")
if [ "$succeeded" -ne 0 ]; then
echo "Testing failed in package ${file_arr[$i]}"
exit 1;
fi
done
env:
MATRIX_OS: ${{ matrix.os }}
MSYS2_LOCATION: ${{ steps.toolchain.outputs.msys2-location }}
noracetest:
name: Go tests - no race
defaults:
run:
shell: bash
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-22.04, windows-latest]
steps:
- uses: actions/checkout@v6
- name: Set up Go toolchain
id: toolchain
uses: ./.github/actions/setup-go-toolchain
- name: Test All
working-directory: ./go
run: |
if [ "$MATRIX_OS" == 'windows-latest' ]; then
export PATH=$(cygpath -u "$MSYS2_LOCATION"/ucrt64/bin):"$PATH"
fi
go test -vet=off -timeout 30m ./libraries/doltcore/sqle/integration_test
env:
MATRIX_OS: ${{ matrix.os }}
DOLT_TEST_RUN_NON_RACE_TESTS: "true"
MSYS2_LOCATION: ${{ steps.toolchain.outputs.msys2-location }}
+63
View File
@@ -0,0 +1,63 @@
name: Test Bats Unix
on:
pull_request:
branches: [ main ]
paths:
- 'go/**'
- 'integration-tests/**'
concurrency:
group: ci-lambdabats-unix-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
test:
name: Bats tests, run with lambdabats
defaults:
run:
shell: bash
runs-on: ubuntu-22.04
strategy:
fail-fast: true
env:
use_credentials: ${{ secrets.AWS_SECRET_ACCESS_KEY != '' && secrets.AWS_ACCESS_KEY_ID != '' }}
steps:
- name: Conditionally Set ENV VARS for AWS tests
if: ${{ env.use_credentials == 'true' }}
run: |
echo "AWS_SDK_LOAD_CONFIG=1" >> $GITHUB_ENV
echo "AWS_REGION=us-west-2" >> $GITHUB_ENV
echo "DOLT_BATS_AWS_TABLE=dolt-ci-bats-manifests-us-west-2" >> $GITHUB_ENV
echo "DOLT_BATS_AWS_BUCKET=dolt-ci-bats-chunks-us-west-2" >> $GITHUB_ENV
echo "DOLT_BATS_AWS_EXISTING_REPO=aws_remote_bats_tests__dolt__" >> $GITHUB_ENV
- name: Configure AWS Credentials
if: ${{ env.use_credentials == 'true' }}
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
role-duration-seconds: 10800 # 3 hours D:
- uses: actions/checkout@v6
if: ${{ env.use_credentials == 'true' }}
- name: Setup Go 1.x
uses: actions/setup-go@v5
if: ${{ env.use_credentials == 'true' }}
with:
go-version-file: go/go.mod
id: go
- name: install lambdabats
if: ${{ env.use_credentials == 'true' }}
run: go install github.com/dolthub/lambdabats/lambdabats@latest
- name: Test all Unix
if: ${{ env.use_credentials == 'true' }}
run: |
lambdabats -use-aws-environment-credentials -s lambda_skip -F tap .
working-directory: ./integration-tests/bats
- name: Test all Unix, SQL_ENGINE=remote-engine
if: ${{ env.use_credentials == 'true' }}
run: |
lambdabats -env SQL_ENGINE=remote-engine -s lambda_skip -use-aws-environment-credentials -F tap .
working-directory: ./integration-tests/bats
@@ -0,0 +1,60 @@
name: Test MySQL Client integrations
on:
pull_request:
paths:
- 'go/**'
- 'integration-tests/**'
concurrency:
group: ci-mysql-client-tests-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
mysql_client_integrations:
runs-on: ubuntu-22.04
timeout-minutes: 45
steps:
- name: Checkout
uses: actions/checkout@v6
with:
path: dolt
- name: Free disk space
run: |
NAME="DISK-CLEANUP"
echo "[${NAME}] Starting background cleanup..."
[ -d "$AGENT_TOOLSDIRECTORY" ] && sudo rm -rf "$AGENT_TOOLSDIRECTORY" &
[ -d /usr/share/dotnet ] && sudo rm -rf /usr/share/dotnet &
[ -d /usr/local/lib/android ] && sudo rm -rf /usr/local/lib/android &
[ -d /opt/ghc ] && sudo rm -rf /opt/ghc &
[ -d /usr/local/share/boost ] && sudo rm -rf /usr/local/share/boost &
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Ensure cache directory exists
run: |
sudo mkdir -p /mnt/.buildx-cache
sudo chown $USER:$USER /mnt/.buildx-cache
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /mnt/.buildx-cache
key: ${{ runner.os }}-docker-mysql-client-integrations
restore-keys: |
${{ runner.os }}-docker
- name: Build MySQL test image
uses: docker/build-push-action@v6
with:
context: .
file: dolt/integration-tests/mysql-client-tests/Dockerfile
tags: mysql-client-tests:latest
load: true
cache-from: type=local,src=/mnt/.buildx-cache
cache-to: type=local,dest=/mnt/.buildx-cache
- name: Test MySQL client integrations
run: docker run --rm mysql-client-tests:latest
+54
View File
@@ -0,0 +1,54 @@
name: Test ORM integrations
on:
pull_request:
paths:
- 'go/**'
- 'integration-tests/**'
workflow_dispatch:
repository_dispatch:
types: [ test-orm-integrations ]
concurrency:
group: ci-orm-tests-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
orm_integrations_job:
runs-on: ubuntu-22.04
timeout-minutes: 30
name: ORM tests
steps:
- name: Checkout
uses: actions/checkout@v6
with:
path: dolt
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build ORM test image
uses: docker/build-push-action@v6
with:
context: .
file: dolt/integration-tests/orm-tests/Dockerfile
tags: orm-tests:latest
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Test ORM integrations
run: docker run --rm orm-tests:latest
- name: Configure AWS Credentials
if: ${{ failure() && !env.ACT }}
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
- name: Send Email
if: ${{ failure() && !env.ACT }}
uses: ./.github/actions/ses-email-action
with:
template: 'OrmIntegrationFailureTemplate'
region: us-west-2
version: ${{ github.ref }}
toAddresses: '["jennifer@dolthub.com", "tim@dolthub.com"]'
workflowURL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
@@ -0,0 +1,33 @@
name: sql-server Integration Tests
on:
pull_request:
branches: [main]
paths:
- "go/**"
- "integration-tests/go-sql-server-driver/**"
concurrency:
group: ci-sql-server-integration-tests-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
test:
name: sql-server Integration Tests
defaults:
run:
shell: bash
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-22.04]
steps:
- uses: actions/checkout@v6
- name: Set up Go toolchain
uses: ./.github/actions/setup-go-toolchain
- name: Build dolt
uses: ./.github/actions/build-dolt
- name: Test all
run: go test .
working-directory: ./integration-tests/go-sql-server-driver
+92
View File
@@ -0,0 +1,92 @@
name: Test Integration with DoltgreSQL
on:
pull_request:
types: [opened, synchronize, reopened]
issue_comment:
types: [created, edited, deleted]
jobs:
test-integration:
if: github.event_name == 'issue_comment' && github.event.issue.pull_request != '' || github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Set timezone for Unix
uses: szenius/set-timezone@v2.0
with:
timezoneLinux: "America/Los_Angeles"
- name: Checkout Dolt
uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup Git User
uses: fregante/setup-git-user@v2
- name: Merge main into PR
id: merge_main
run: |
git fetch --all --unshallow
git merge origin/main --no-commit --no-ff
if [ $? -ne 0 ]; then
echo "Skipping the remainder of the workflow due to a merge conflict."
echo "skip=true" >> $GITHUB_OUTPUT
else
echo "Merge performed successfully, continuing workflow."
echo "skip=false" >> $GITHUB_OUTPUT
fi
- name: Check for a DoltgreSQL PR link
id: check_doltgresql_pr
if: steps.merge_main.outputs.skip == 'false'
run: |
PR_DESCRIPTION=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number != '' && github.event.pull_request.number || github.event.issue.number }})
COMMENTS=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number != '' && github.event.pull_request.number || github.event.issue.number }}/comments)
echo "$PR_DESCRIPTION$COMMENTS"
if echo "$PR_DESCRIPTION$COMMENTS" | grep -q "github.com/dolthub/doltgresql/pull/"; then
echo "comment_exists=true" >> $GITHUB_OUTPUT
echo "DoltgreSQL PR link exists"
else
echo "comment_exists=false" >> $GITHUB_OUTPUT
echo "DoltgreSQL PR link does not exist"
fi
- name: Install Go
uses: actions/setup-go@v5
if: steps.merge_main.outputs.skip == 'false'
with:
go-version-file: go/go.mod
- name: Clone DoltgreSQL repository
if: steps.merge_main.outputs.skip == 'false' && steps.check_doltgresql_pr.outputs.comment_exists == 'false'
run: git clone https://github.com/dolthub/doltgresql.git
- name: Build DoltgreSQL's parser
if: steps.merge_main.outputs.skip == 'false' && steps.check_doltgresql_pr.outputs.comment_exists == 'false'
run: |
cd doltgresql
./postgres/parser/build.sh
- name: Test DoltgreSQL against main
id: test_doltgresql_main
if: steps.merge_main.outputs.skip == 'false' && steps.check_doltgresql_pr.outputs.comment_exists == 'false'
continue-on-error: true
run: |
cd doltgresql
go get github.com/dolthub/dolt/go@main
go mod tidy
cd testing/go
go test ./... --count=1 -skip Replication
- name: Test DoltgreSQL against PR
if: steps.merge_main.outputs.skip == 'false' && steps.check_doltgresql_pr.outputs.comment_exists == 'false' && steps.test_doltgresql_main.outcome == 'success'
run: |
cd doltgresql
git reset --hard
go mod edit -replace github.com/dolthub/dolt/go=../go
go mod tidy
cd testing/go
go test ./... --count=1 -skip Replication
+44
View File
@@ -0,0 +1,44 @@
name: Email Team Members
on:
repository_dispatch:
types: [ email-report ]
jobs:
email-team:
runs-on: ubuntu-22.04
name: Email Team Members
steps:
- uses: actions/checkout@v6
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
- name: Get Results
id: get-results
run: aws s3api get-object --bucket="$BUCKET" --key="$KEY" results.log
env:
KEY: ${{ github.event.client_payload.key }}
BUCKET: ${{ github.event.client_payload.bucket }}
- name: Get Addresses
id: get-addresses
run: |
addresses="$TEAM"
if [ ! -z "$RECIPIENT" ]; then
addresses="[\"$RECIPIENT\"]"
fi
echo "addresses=$addresses" >> $GITHUB_OUTPUT
env:
RECIPIENT: ${{ github.event.client_payload.email_recipient }}
TEAM: '["${{ secrets.PERF_REPORTS_EMAIL_ADDRESS }}"]'
- name: Send Email
uses: ./.github/actions/ses-email-action
with:
template: ${{ github.event.client_payload.template }}
region: us-west-2
version: ${{ github.event.client_payload.version }}
format: ${{ github.event.client_payload.noms_bin_format }}
toAddresses: ${{ steps.get-addresses.outputs.addresses }}
dataFile: ${{ format('{0}/results.log', github.workspace) }}
@@ -0,0 +1,73 @@
name: Run Import Benchmark on Pull Requests
on:
pull_request:
types: [ opened ]
issue_comment:
types: [ created ]
jobs:
validate-commentor:
runs-on: ubuntu-22.04
outputs:
valid: ${{ steps.set_valid.outputs.valid }}
steps:
- uses: actions/checkout@v6
- name: Validate Commentor
id: set_valid
run: ./.github/scripts/performance-benchmarking/validate-commentor.sh "$ACTOR"
env:
ACTOR: ${{ github.actor }}
check-comments:
runs-on: ubuntu-22.04
needs: validate-commentor
if: ${{ needs.validate-commentor.outputs.valid == 'true' }}
outputs:
benchmark: ${{ steps.set_benchmark.outputs.benchmark }}
comment-body: ${{ steps.set_body.outputs.body }}
steps:
- name: Check for Deploy Trigger
uses: dolthub/pull-request-comment-trigger@v2
id: check
with:
trigger: '#import-benchmark'
reaction: rocket
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set Benchmark
if: ${{ steps.check.outputs.triggered == 'true' }}
id: set_benchmark
run: |
echo "benchmark=true" >> $GITHUB_OUTPUT
performance:
runs-on: ubuntu-22.04
needs: [validate-commentor, check-comments]
if: ${{ needs.check-comments.outputs.benchmark == 'true' }}
name: Trigger Benchmark Import Workflow
steps:
- uses: dolthub/pull-request-comment-branch@v3
id: comment-branch
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
- name: Get pull number
uses: actions/github-script@v7
id: get_pull_number
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: core.setOutput("pull_number", JSON.stringify(context.issue.number));
- uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
event-type: benchmark-import
client-payload: |
{
"version": "${{ steps.comment-branch.outputs.head_sha }}",
"run_file": "ci.yaml",
"summary": "summary.sql",
"report": "three_way_compare.sql",
"commit_to_branch": "${{ steps.comment-branch.outputs.head_sha }}",
"actor": "${{ github.actor }}",
"issue_id": "${{ steps.get_pull_number.outputs.pull_number }}"
}
+177
View File
@@ -0,0 +1,177 @@
name: Import Benchmarks
on:
repository_dispatch:
types: [ benchmark-import ]
env:
BENCH_DIR: 'go/performance/import_benchmarker'
MYSQL_PORT: 3309
MYSQL_PASSWORD: password
jobs:
bench:
name: Benchmark
defaults:
run:
shell: bash
strategy:
fail-fast: true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.event.client_payload.version }}
- name: Set up Go 1.x
id: go
uses: actions/setup-go@v5
with:
go-version-file: go/go.mod
- name: Dolt version
id: version
run: |
version=${{ github.event.client_payload.version }}
- name: Install dolt
working-directory: ./go
run: go install ./cmd/dolt
- uses: shogo82148/actions-setup-mysql@v1
with:
mysql-version: '8.0'
auto-start: true
root-password: ${{ env.MYSQL_PASSWORD }}
my-cnf: |
local_infile=1
socket=/tmp/mysqld2.sock
port=${{ env.MYSQL_PORT }}
- name: Setup MySQL
run: mysql -uroot -p${{ env.MYSQL_PASSWORD }} -h127.0.0.1 -P${{ env.MYSQL_PORT }} -e 'create database test;'
- name: Run bench
id: bench
working-directory: go/
run: |
out="$GITHUB_WORKSPACE/results.sql"
testspec="../${{ env.BENCH_DIR }}/testdata/${{ github.event.client_payload.run_file }}"
go run \
"github.com/dolthub/dolt/${{ env.BENCH_DIR }}/cmd" \
-test "$testspec" \
-out "$out"
echo "result_path=$out" >> $GITHUB_OUTPUT
- name: Report
id: report
run: |
gw=$GITHUB_WORKSPACE
in="${{ steps.bench.outputs.result_path }}"
query="$(pwd)/${{ env.BENCH_DIR }}/reporting/${{ github.event.client_payload.report }}"
summaryq="$(pwd)/${{ env.BENCH_DIR }}/reporting/${{ github.event.client_payload.summary }}"
out="$gw/results.csv"
dolt_dir="$gw/import-perf"
dolt config --global --add user.email "import-perf@dolthub.com"
dolt config --global --add user.name "import-perf"
echo '${{ secrets.DOLTHUB_IMPORT_PERF_CREDS_VALUE }}' | dolt creds import
dolt clone import-perf/import-perf "$dolt_dir"
cd "$dolt_dir"
branch="${{ github.event.client_payload.commit_to_branch }}"
# checkout branch
if [ -z $(dolt sql -q "select 1 from dolt_branches where name = '$branch';") ]; then
dolt checkout -b $branch
else
dolt checkout $branch
fi
dolt sql -q "drop table if exists import_perf_results"
# load results
dolt sql < "$in"
# push results to dolthub
dolt add import_perf_results
dolt commit -m "CI commit"
dolt push -f origin $branch
# generate report
dolt sql -r csv < "$query" > "$out"
cat "$out"
echo "report_path=$out" >> $GITHUB_OUTPUT
avg=$(dolt sql -r csv < "$summaryq" | tail -1)
echo "avg=$avg" >> $GITHUB_OUTPUT
- name: Format HTML
id: html
if: ${{ github.event.client_payload.email_recipient }} != ""
run: |
gw="$GITHUB_WORKSPACE"
in="${{ steps.report.outputs.report_path }}"
out="$gw/results.html"
echo "<table>" > "$out"
print_header=true
while read line; do
if "$print_header"; then
echo " <tr><th>${line//,/</th><th>}</th></tr>" >> "$out"
print_header=false
continue
fi
echo " <tr><td>${line//,/</td><td>}</td></tr>" >> "$out"
done < "$in"
echo "</table>" >> "$out"
avg="${{ steps.report.outputs.avg }}"
echo "<table><tr><th>Average</th></tr><tr><td>$avg</tr></td></table>" >> "$out"
cat "$out"
echo "html=$(echo $out)" >> $GITHUB_OUTPUT
- name: Configure AWS Credentials
if: ${{ github.event.client_payload.email_recipient }} != ""
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
- name: Send Email
uses: ./.github/actions/ses-email-action
if: ${{ github.event.client_payload.email_recipient }} != ""
with:
region: us-west-2
toAddresses: '["${{ github.event.client_payload.email_recipient }}"]'
subject: 'Import Performance Benchmarks: ${{ github.event.client_payload.version }}'
bodyPath: ${{ steps.html.outputs.html }}
template: 'SysbenchTemplate'
- name: Read CSV
if: ${{ github.event.client_payload.issue_id }} != ""
id: csv
uses: juliangruber/read-file-action@v1
with:
path: "${{ steps.report.outputs.report_path }}"
- name: Create MD
if: ${{ github.event.client_payload.issue_id }} != ""
uses: dolthub/csv-to-md-table-action@v4
id: md
with:
csvinput: ${{ steps.csv.outputs.content }}
- uses: mshick/add-pr-comment@v2
if: ${{ github.event.client_payload.issue_id }} != ""
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue: ${{ github.event.client_payload.issue_id }}
message-failure: import benchmark failed
message-cancelled: import benchmark cancelled
allow-repeats: true
message: |
@${{ github.event.client_payload.actor }} __DOLT__
${{ steps.md.outputs.markdown-table }}
@@ -0,0 +1,74 @@
name: Benchmark Latency
on:
repository_dispatch:
types: [ benchmark-latency ]
jobs:
performance:
runs-on: ubuntu-22.04
name: Benchmark Performance
strategy:
matrix:
dolt_fmt: [ "__DOLT__" ]
steps:
- name: Checkout
uses: actions/checkout@v6
- uses: azure/setup-kubectl@v4
with:
version: 'v1.23.6'
- name: Install aws-iam-authenticator
run: |
curl -o aws-iam-authenticator https://amazon-eks.s3.us-west-2.amazonaws.com/1.18.8/2020-09-18/bin/linux/amd64/aws-iam-authenticator && \
chmod +x ./aws-iam-authenticator && \
sudo cp ./aws-iam-authenticator /usr/local/bin/aws-iam-authenticator
aws-iam-authenticator version
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
- name: Create and Auth kubeconfig
run: |
echo "$CONFIG" > kubeconfig
KUBECONFIG=kubeconfig kubectl config set-credentials github-actions-dolt --exec-api-version=client.authentication.k8s.io/v1alpha1 --exec-command=aws-iam-authenticator --exec-arg=token --exec-arg=-i --exec-arg=eks-cluster-1
KUBECONFIG=kubeconfig kubectl config set-context github-actions-dolt-context --cluster=eks-cluster-1 --user=github-actions-dolt --namespace=performance-benchmarking
KUBECONFIG=kubeconfig kubectl config use-context github-actions-dolt-context
env:
CONFIG: ${{ secrets.CORP_KUBECONFIG }}
- name: Create Sysbench Performance Benchmarking K8s Job
run: ./.github/scripts/performance-benchmarking/run-benchmarks.sh
env:
FROM_SERVER: ${{ github.event.client_payload.from_server }}
FROM_VERSION: ${{ github.event.client_payload.from_version }}
TO_SERVER: ${{ github.event.client_payload.to_server }}
TO_VERSION: ${{ github.event.client_payload.to_version }}
TO_PROFILE_KEY: ${{ github.event.client_payload.to_profile_key }}
MODE: ${{ github.event.client_payload.mode }}
ISSUE_NUMBER: ${{ github.event.client_payload.issue_number }}
ACTOR: ${{ github.event.client_payload.actor }}
ACTOR_EMAIL: ${{ github.event.client_payload.actor_email }}
REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
KUBECONFIG: "./kubeconfig"
INIT_BIG_REPO: ${{ github.event.client_payload.init_big_repo }}
NOMS_BIN_FORMAT: ${{ matrix.dolt_fmt }}
SYSBENCH_TEST_TIME: ${{ github.event.client_payload.sysbench_test_time }}
TEMPLATE_SCRIPT: ${{ github.event.client_payload.template_script }}
- name: Create TPCC Performance Benchmarking K8s Job
run: ./.github/scripts/performance-benchmarking/run-benchmarks.sh
env:
FROM_SERVER: ${{ github.event.client_payload.from_server }}
FROM_VERSION: ${{ github.event.client_payload.from_version }}
TO_SERVER: ${{ github.event.client_payload.to_server }}
TO_VERSION: ${{ github.event.client_payload.to_version }}
MODE: ${{ github.event.client_payload.mode }}
ISSUE_NUMBER: ${{ github.event.client_payload.issue_number }}
ACTOR: ${{ github.event.client_payload.actor }}
ACTOR_EMAIL: ${{ github.event.client_payload.actor_email }}
REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
KUBECONFIG: "./kubeconfig"
INIT_BIG_REPO: ${{ github.event.client_payload.init_big_repo }}
NOMS_BIN_FORMAT: ${{ matrix.dolt_fmt }}
WITH_TPCC: "true"
TEMPLATE_SCRIPT: ${{ github.event.client_payload.template_script }}
+51
View File
@@ -0,0 +1,51 @@
name: Profile Dolt while Benchmarking
on:
repository_dispatch:
types: [ profile-dolt ]
jobs:
performance:
runs-on: ubuntu-22.04
name: Profile Dolt while Benchmarking
steps:
- name: Checkout
uses: actions/checkout@v6
- uses: azure/setup-kubectl@v4
with:
version: 'v1.23.6'
- name: Install aws-iam-authenticator
run: |
curl -o aws-iam-authenticator https://amazon-eks.s3.us-west-2.amazonaws.com/1.18.8/2020-09-18/bin/linux/amd64/aws-iam-authenticator && \
chmod +x ./aws-iam-authenticator && \
sudo cp ./aws-iam-authenticator /usr/local/bin/aws-iam-authenticator
aws-iam-authenticator version
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
- name: Create and Auth kubeconfig
run: |
echo "$CONFIG" > kubeconfig
KUBECONFIG=kubeconfig kubectl config set-credentials github-actions-dolt --exec-api-version=client.authentication.k8s.io/v1alpha1 --exec-command=aws-iam-authenticator --exec-arg=token --exec-arg=-i --exec-arg=eks-cluster-1
KUBECONFIG=kubeconfig kubectl config set-context github-actions-dolt-context --cluster=eks-cluster-1 --user=github-actions-dolt --namespace=performance-benchmarking
KUBECONFIG=kubeconfig kubectl config use-context github-actions-dolt-context
env:
CONFIG: ${{ secrets.CORP_KUBECONFIG }}
- name: Create Profile Benchmarking K8s Job
run: ./.github/scripts/performance-benchmarking/run-benchmarks.sh
env:
PROFILE: "true"
FUTURE_VERSION: ${{ github.event.client_payload.future_version }}
FROM_VERSION: ${{ github.event.client_payload.from_version }}
MODE: ${{ github.event.client_payload.mode }}
ACTOR: ${{ github.event.client_payload.actor }}
ACTOR_EMAIL: ${{ github.event.client_payload.actor_email }}
REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
KUBECONFIG: "./kubeconfig"
INIT_BIG_REPO: ${{ github.event.client_payload.init_big_repo }}
NOMS_BIN_FORMAT: "__DOLT__"
TEMPLATE_SCRIPT: ${{ github.event.client_payload.template_script }}
BRANCH: ${{ github.event.client_payload.branch || 'main' }}
+47
View File
@@ -0,0 +1,47 @@
name: Fuzzer
on:
workflow_dispatch:
push:
paths:
- 'go/**'
branches:
- 'main'
jobs:
fuzzer:
runs-on: ubuntu-22.04
name: Run Fuzzer
steps:
- uses: actions/checkout@v6
- uses: azure/setup-kubectl@v4
with:
version: 'v1.23.6'
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
- name: Install aws-iam-authenticator
run: |
curl -o aws-iam-authenticator https://amazon-eks.s3.us-west-2.amazonaws.com/1.18.8/2020-09-18/bin/linux/amd64/aws-iam-authenticator && \
chmod +x ./aws-iam-authenticator && \
sudo cp ./aws-iam-authenticator /usr/local/bin/aws-iam-authenticator
aws-iam-authenticator version
- name: Create and Auth kubeconfig
run: |
echo "$CONFIG" > kubeconfig
KUBECONFIG=kubeconfig kubectl config set-credentials github-actions-dolt --exec-api-version=client.authentication.k8s.io/v1alpha1 --exec-command=aws-iam-authenticator --exec-arg=token --exec-arg=-i --exec-arg=eks-cluster-1
KUBECONFIG=kubeconfig kubectl config set-context github-actions-dolt-context --cluster=eks-cluster-1 --user=github-actions-dolt --namespace=fuzzer
KUBECONFIG=kubeconfig kubectl config use-context github-actions-dolt-context
env:
CONFIG: ${{ secrets.CORP_KUBECONFIG }}
- name: Create Fuzzer (GateKeeper) K8s Job
run: ./.github/scripts/fuzzer/run-fuzzer.sh
env:
VERSION: ${{ github.sha }}
ACTOR: "Hydrocharged"
REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
KUBECONFIG: "./kubeconfig"
TEMPLATE_SCRIPT: "./.github/scripts/fuzzer/get-fuzzer-job-json.sh"
@@ -0,0 +1,52 @@
name: SQL Correctness
on:
repository_dispatch:
types: [ sql-correctness ]
jobs:
correctness:
runs-on: ubuntu-22.04
name: Dolt SQL Correctness
strategy:
matrix:
dolt_fmt: [ "__DOLT__" ]
steps:
- uses: actions/checkout@v6
- uses: azure/setup-kubectl@v4
with:
version: 'v1.23.6'
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
- name: Install aws-iam-authenticator
run: |
curl -o aws-iam-authenticator https://amazon-eks.s3.us-west-2.amazonaws.com/1.18.8/2020-09-18/bin/linux/amd64/aws-iam-authenticator && \
chmod +x ./aws-iam-authenticator && \
sudo cp ./aws-iam-authenticator /usr/local/bin/aws-iam-authenticator
aws-iam-authenticator version
- name: Create and Auth kubeconfig
run: |
echo "$CONFIG" > kubeconfig
KUBECONFIG=kubeconfig kubectl config set-credentials github-actions-dolt --exec-api-version=client.authentication.k8s.io/v1alpha1 --exec-command=aws-iam-authenticator --exec-arg=token --exec-arg=-i --exec-arg=eks-cluster-1
KUBECONFIG=kubeconfig kubectl config set-context github-actions-dolt-context --cluster=eks-cluster-1 --user=github-actions-dolt --namespace=performance-benchmarking
KUBECONFIG=kubeconfig kubectl config use-context github-actions-dolt-context
env:
CONFIG: ${{ secrets.CORP_KUBECONFIG }}
- name: Create SQL Correctness K8s Job
run: ./.github/scripts/sql-correctness/run-correctness.sh
env:
PR_BRANCH_REF: ${{ github.event.client_payload.branch_ref }}
REGRESS_COMP: ${{ github.event.client_payload.regress_comp }}
PR_NUMBER: ${{ github.event.client_payload.issue_number }}
VERSION: ${{ github.event.client_payload.version }}
MODE: ${{ github.event.client_payload.mode }}
ACTOR: ${{ github.event.client_payload.actor }}
ACTOR_EMAIL: ${{ github.event.client_payload.actor_email }}
REPO_ACCESS_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
KUBECONFIG: "./kubeconfig"
NOMS_BIN_FORMAT: ${{ matrix.dolt_fmt }}
TEMPLATE_SCRIPT: ${{ github.event.client_payload.template_script }}
@@ -0,0 +1,19 @@
name: Label Customer Issues
on:
issues:
types: [opened]
pull_request_target:
branches: [main]
types: [opened]
jobs:
label_customer_issues:
runs-on: ubuntu-latest
steps:
- uses: dolthub/label-customer-issues@main
with:
repo-token: ${{ secrets.REPO_ACCESS_TOKEN }}
issue-label: customer issue
pr-label: contribution
exclude: dependabot
+70
View File
@@ -0,0 +1,70 @@
name: Run Merge Benchmark on Pull Requests
on:
pull_request:
types: [ opened ]
issue_comment:
types: [ created ]
jobs:
validate-commentor:
runs-on: ubuntu-22.04
outputs:
valid: ${{ steps.set_valid.outputs.valid }}
steps:
- uses: actions/checkout@v6
- name: Validate Commentor
id: set_valid
run: ./.github/scripts/performance-benchmarking/validate-commentor.sh "$ACTOR"
env:
ACTOR: ${{ github.actor }}
check-comments:
runs-on: ubuntu-22.04
needs: validate-commentor
if: ${{ needs.validate-commentor.outputs.valid == 'true' }}
outputs:
benchmark: ${{ steps.set_benchmark.outputs.benchmark }}
comment-body: ${{ steps.set_body.outputs.body }}
steps:
- name: Check for Deploy Trigger
uses: dolthub/pull-request-comment-trigger@v2
id: check
with:
trigger: '#merge-benchmark'
reaction: rocket
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set Benchmark
if: ${{ steps.check.outputs.triggered == 'true' }}
id: set_benchmark
run: |
echo "benchmark=true" >> $GITHUB_OUTPUT
performance:
runs-on: ubuntu-22.04
needs: [validate-commentor, check-comments]
if: ${{ needs.check-comments.outputs.benchmark == 'true' }}
name: Trigger Benchmark Merge Workflow
steps:
- uses: dolthub/pull-request-comment-branch@v3
id: comment-branch
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
- name: Get pull number
uses: actions/github-script@v7
id: get_pull_number
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: core.setOutput("pull_number", JSON.stringify(context.issue.number));
- uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
event-type: benchmark-merge
client-payload: |
{
"version": "${{ steps.comment-branch.outputs.head_sha }}",
"commit_to_branch": "${{ steps.comment-branch.outputs.head_sha }}",
"actor": "${{ github.actor }}",
"issue_id": "${{ steps.get_pull_number.outputs.pull_number }}"
}
+207
View File
@@ -0,0 +1,207 @@
name: Merge Benchmarks
on:
repository_dispatch:
types: [ benchmark-merge ]
env:
SCRIPT_DIR: '.github/scripts/merge-perf'
RESULT_TABLE_NAME: 'merge_perf_results'
DOLTHUB_DB: 'import-perf/merge-perf'
jobs:
bench:
name: Benchmark
defaults:
run:
shell: bash
strategy:
fail-fast: true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.event.client_payload.version }}
- name: Set up Go 1.x
id: go
uses: actions/setup-go@v5
with:
go-version-file: go/go.mod
- name: Setup Python 3.x
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Dolt version
id: version
run: |
version=${{ github.event.client_payload.version }}
- name: Install dolt
working-directory: ./go
run: go install ./cmd/dolt
- name: Config dolt
id: config
run: |
dolt config --global --add user.email "merge-perf@dolthub.com"
dolt config --global --add user.name "merge-perf"
- name: Run bench
id: bench
run: |
gw=$GITHUB_WORKSPACE
DATADIR=$gw/data
# initialize results sql import
RESULTS=$gw/results.sql
echo "CREATE TABLE ${{env.RESULT_TABLE_NAME }} (name varchar(50) primary key, table_cnt int, run_cnt int, add_cnt int, delete_cnt int, update_cnt int, conflict_cnt int, fks bool, latency float);" >> $RESULTS
# parameters for testing
ROW_NUM=1000000
TABLE_NUM=2
EDIT_CNT=60000
names=('adds_only' 'deletes_only' 'updates_only' 'adds_updates_deletes')
adds=($EDIT_CNT 0 0 $EDIT_CNT)
deletes=(0 $EDIT_CNT 0 $EDIT_CNT)
updates=(0 0 $EDIT_CNT $EDIT_CNT)
wd=$(pwd)
for i in {0..3}; do
cd $wd
echo "${names[$i]}, ${adds[$i]}, ${deletes[$i]}, ${updates[$i]}"
# data.py creates files for import
python ${{ env.SCRIPT_DIR }}/data.py $DATADIR $TABLE_NUM $ROW_NUM ${adds[$i]} ${deletes[$i]} ${updates[$i]}
# setup.sh runs the import and commit process for a set of data files
TMPDIR=$gw/tmp
./${{ env.SCRIPT_DIR}}/setup.sh $TMPDIR $DATADIR
# small python script times merge, we suppress errcodes but print error messages
cd $TMPDIR
python3 -c "import time, subprocess, sys; start = time.time(); res=subprocess.run(['dolt', 'merge', '--squash', 'main'], capture_output=True); err = res.stdout + res.stderr if res.returncode != 0 else ''; latency = time.time() -start; print(latency); sys.stderr.write(str(err))" 1> lat.log 2>err.log
latency=$(cat lat.log)
cat err.log
# count conflicts in first table
conflicts=$(dolt sql -r csv -q "select count(*) from dolt_conflicts_table0;" | tail -1)
echo "INSERT INTO ${{ env.RESULT_TABLE_NAME }} values ('"${names[$i]}"', $TABLE_NUM, $ROW_NUM, ${adds[$i]}, ${deletes[$i]}, ${updates[$i]}, $conflicts, true, $latency);" >> $RESULTS
done
echo "result_path=$RESULTS" >> $GITHUB_OUTPUT
- name: Report
id: report
run: |
gw=$GITHUB_WORKSPACE
in="${{ steps.bench.outputs.result_path }}"
query="select name, add_cnt, delete_cnt, update_cnt, round(latency, 2) as latency from ${{ env.RESULT_TABLE_NAME }}"
summaryq="select round(avg(latency), 2) as avg from ${{ env.RESULT_TABLE_NAME }}"
out="$gw/results.csv"
dolt_dir="$gw/merge-perf"
dolt config --global --add user.email "merge-perf@dolthub.com"
dolt config --global --add user.name "merge-perf"
echo '${{ secrets.DOLTHUB_IMPORT_PERF_CREDS_VALUE }}' | dolt creds import
dolt clone ${{ env.DOLTHUB_DB }} "$dolt_dir"
cd "$dolt_dir"
branch="${{ github.event.client_payload.commit_to_branch }}"
# checkout branch
if [ -z $(dolt sql -q "select 1 from dolt_branches where name = '$branch';") ]; then
dolt checkout -b $branch
else
dolt checkout $branch
fi
dolt sql -q "drop table if exists ${{ env.RESULT_TABLE_NAME }}"
# load results
dolt sql < "$in"
# push results to dolthub
dolt add ${{ env.RESULT_TABLE_NAME }}
dolt commit -m "CI commit"
dolt push -f origin $branch
# generate report
dolt sql -r csv -q "$query" > "$out"
cat "$out"
echo "report_path=$out" >> $GITHUB_OUTPUT
avg=$(dolt sql -r csv -q "$summaryq" | tail -1)
echo "avg=$avg" >> $GITHUB_OUTPUT
- name: Format Results
id: html
if: ${{ github.event.client_payload.email_recipient }} != ""
run: |
gw="$GITHUB_WORKSPACE"
in="${{ steps.report.outputs.report_path }}"
out="$gw/results.html"
echo "<table>" > "$out"
print_header=true
while read line; do
if "$print_header"; then
echo " <tr><th>${line//,/</th><th>}</th></tr>" >> "$out"
print_header=false
continue
fi
echo " <tr><td>${line//,/</td><td>}</td></tr>" >> "$out"
done < "$in"
echo "</table>" >> "$out"
avg="${{ steps.report.outputs.avg }}"
echo "<table><tr><th>Average</th></tr><tr><td>$avg</tr></td></table>" >> "$out"
cat "$out"
echo "html=$(echo $out)" >> $GITHUB_OUTPUT
- name: Configure AWS Credentials
if: ${{ github.event.client_payload.email_recipient }} != ""
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
- name: Send Email
uses: ./.github/actions/ses-email-action
if: ${{ github.event.client_payload.email_recipient }} != ""
with:
region: us-west-2
toAddresses: '["${{ github.event.client_payload.email_recipient }}"]'
subject: 'Merge Performance Benchmarks: ${{ github.event.client_payload.version }}'
bodyPath: ${{ steps.html.outputs.html }}
template: 'SysbenchTemplate'
- name: Read CSV
if: ${{ github.event.client_payload.issue_id }} != ""
id: csv
uses: juliangruber/read-file-action@v1
with:
path: "${{ steps.report.outputs.report_path }}"
- name: Create MD
if: ${{ github.event.client_payload.issue_id }} != ""
uses: dolthub/csv-to-md-table-action@v4
id: md
with:
csvinput: ${{ steps.csv.outputs.content }}
- uses: mshick/add-pr-comment@v2
if: ${{ github.event.client_payload.issue_id }} != ""
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue: ${{ github.event.client_payload.issue_id }}
message-failure: merge benchmark failed
message-cancelled: merge benchmark cancelled
allow-repeats: true
message: |
@${{ github.event.client_payload.actor }} __DOLT__
${{ steps.md.outputs.markdown-table }}
@@ -0,0 +1,65 @@
name: Nightly Benchmarks
on:
workflow_dispatch:
schedule:
- cron: '0 2 * * *'
jobs:
perf:
runs-on: ubuntu-22.04
name: Trigger Benchmark Latency, Benchmark Import, and SQL Correctness K8s Workflows
steps:
- uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
event-type: benchmark-latency
client-payload: '{"from_server": "mysql", "from_version": "8.0.35", "to_server": "dolt", "to_version": "${{ github.sha }}", "mode": "nightly", "actor": "${{ github.actor }}", "template_script": "./.github/scripts/performance-benchmarking/get-mysql-dolt-job-json.sh"}'
- uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
event-type: sql-correctness
client-payload: '{"version": "${{ github.sha }}", "mode": "nightly", "actor": "${{ github.actor }}", "template_script": "./.github/scripts/sql-correctness/get-dolt-correctness-job-json.sh"}'
- uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
event-type: benchmark-import
client-payload: |
{
"email_recipient": "${{ secrets.PERF_REPORTS_EMAIL_ADDRESS }}",
"version": "${{ github.sha }}",
"run_file": "ci.yaml",
"summary": "summary.sql",
"report": "three_way_compare.sql",
"commit_to_branch": "nightly",
"actor": "${{ github.actor }}"
}
- uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
event-type: test-orm-integrations
- uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
event-type: benchmark-systab
client-payload: |
{
"email_recipient": "${{ secrets.PERF_REPORTS_EMAIL_ADDRESS }}",
"version": "${{ github.sha }}",
"run_file": "systab.yaml",
"report": "systab.sql",
"summary": "systab_summary.sql",
"commit_to_branch": "nightly",
"actor": "${{ github.actor }}"
}
- uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
event-type: benchmark-merge
client-payload: |
{
"email_recipient": "${{ secrets.PERF_REPORTS_EMAIL_ADDRESS }}",
"version": "${{ github.sha }}",
"commit_to_branch": "nightly",
"actor": "${{ github.actor }}"
}
@@ -0,0 +1,81 @@
name: Benchmark Dolt vs MySQL
on:
repository_dispatch:
types: [ release-dolt ]
workflow_dispatch:
inputs:
version:
description: 'SemVer format release tag, i.e. 0.24.5'
required: true
default: ''
email:
description: 'Email address to receive results'
required: true
default: ''
jobs:
set-version-actor:
name: Set Version and Actor
runs-on: ubuntu-22.04
outputs:
version: ${{ steps.set-vars.outputs.version }}
actor: ${{ steps.set-vars.outputs.actor }}
actor_email: ${{ steps.set-vars.outputs.actor_email }}
steps:
- name: Set variables
id: set-vars
run: |
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "actor=$ACTOR" >> $GITHUB_OUTPUT
echo "actor_email=$ACTOR_EMAIL" >> $GITHUB_OUTPUT
env:
VERSION: ${{ github.event.inputs.version || github.event.client_payload.version }}
ACTOR: ${{ github.event.client_payload.actor || github.actor }}
ACTOR_EMAIL: ${{ github.event.inputs.email }}
benchmark-dolt-mysql:
runs-on: ubuntu-22.04
needs: set-version-actor
name: Trigger Benchmark Latency and Benchmark Import K8s Workflows
steps:
- uses: peter-evans/repository-dispatch@v3
if: ${{ github.event.client_payload.profile_key == '' }}
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
event-type: benchmark-latency
client-payload: '{"from_server": "mysql", "from_version": "8.0.35", "to_server": "dolt", "to_version": "${{ needs.set-version-actor.outputs.version }}", "mode": "release", "actor": "${{ needs.set-version-actor.outputs.actor }}", "actor_email": "${{ needs.set-version-actor.outputs.actor_email }}", "template_script": "./.github/scripts/performance-benchmarking/get-mysql-dolt-job-json.sh"}'
- uses: peter-evans/repository-dispatch@v3
if: ${{ github.event.client_payload.profile_key != '' }}
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
event-type: benchmark-latency
client-payload: '{"from_server": "mysql", "from_version": "8.0.35", "to_server": "dolt", "to_version": "${{ needs.set-version-actor.outputs.version }}", "profile_key": "${{ github.event.client_payload.profile_key }}", "mode": "release", "actor": "${{ needs.set-version-actor.outputs.actor }}", "actor_email": "${{ needs.set-version-actor.outputs.actor_email }}", "template_script": "./.github/scripts/performance-benchmarking/get-mysql-dolt-job-json.sh"}'
- uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
event-type: benchmark-import
client-payload: |
{
"email_recipient": "${{ needs.set-version-actor.outputs.actor_email }}",
"version": "${{ github.sha }}",
"run_file": "ci.yaml",
"report": "three_way_compare.sql",
"summary": "summary.sql",
"commit_to_branch": "main",
"actor": "${{ github.actor }}"
}
- uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
event-type: benchmark-systab
client-payload: |
{
"email_recipient": "${{ needs.set-version-actor.outputs.actor_email }}",
"version": "${{ github.sha }}",
"run_file": "systab.yaml",
"report": "systab.sql",
"summary": "systab_summary.sql",
"commit_to_branch": "main",
"actor": "${{ github.actor }}"
}
@@ -0,0 +1,79 @@
name: Benchmark Pull Requests
on:
pull_request:
types: [ opened ]
issue_comment:
types: [ created ]
jobs:
validate-commentor:
runs-on: ubuntu-22.04
outputs:
valid: ${{ steps.set_valid.outputs.valid }}
steps:
- uses: actions/checkout@v6
- name: Validate Commentor
id: set_valid
run: ./.github/scripts/performance-benchmarking/validate-commentor.sh "$ACTOR"
env:
ACTOR: ${{ github.actor }}
check-comments:
runs-on: ubuntu-22.04
needs: validate-commentor
if: ${{ needs.validate-commentor.outputs.valid == 'true' }}
outputs:
benchmark: ${{ steps.set_benchmark.outputs.benchmark }}
sysbench-test-time: ${{ steps.set_benchmark_mini.outputs.sysbench-test-time }}
comment-body: ${{ steps.set_body.outputs.body }}
steps:
- name: Check for Deploy Trigger
uses: dolthub/pull-request-comment-trigger@v2
id: check
with:
trigger: '#benchmark'
reaction: rocket
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set Benchmark
if: ${{ steps.check.outputs.triggered == 'true' }}
id: set_benchmark
run: |
echo "benchmark=true" >> $GITHUB_OUTPUT
- name: Check for Deploy Mini Trigger
uses: dolthub/pull-request-comment-trigger@v2
id: check_mini
with:
trigger: '#benchmark-mini'
reaction: rocket
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set Benchmark Mini
if: ${{ steps.check_mini.outputs.triggered == 'true' }}
id: set_benchmark_mini
run: |
echo "benchmark=true" >> $GITHUB_OUTPUT
echo "sysbench-test-time=20" >> $GITHUB_OUTPUT
performance:
runs-on: ubuntu-22.04
needs: [validate-commentor, check-comments]
if: ${{ needs.check-comments.outputs.benchmark == 'true' }}
name: Trigger Benchmark Latency K8s Workflow
steps:
- uses: dolthub/pull-request-comment-branch@v3
id: comment-branch
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
- name: Get pull number
uses: actions/github-script@v7
id: get_pull_number
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: core.setOutput("pull_number", JSON.stringify(context.issue.number));
- uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
event-type: benchmark-latency
client-payload: '{"from_server": "dolt", "from_version": "${{ github.sha }}", "to_server": "dolt", "to_version": "${{ steps.comment-branch.outputs.head_sha }}", "mode": "pullRequest", "issue_number": "${{ steps.get_pull_number.outputs.pull_number }}", "init_big_repo": "true", "actor": "${{ github.actor }}", "sysbench_test_time": "${{ needs.check-comments.outputs.sysbench-test-time }}", "template_script": "./.github/scripts/performance-benchmarking/get-dolt-dolt-job-json.sh"}'
+293
View File
@@ -0,0 +1,293 @@
name: Post to Pull Request
on:
repository_dispatch:
types: [ pull-report ]
jobs:
report-pull-request:
name: Report Performance Benchmarks/Correctness on Pull Request
runs-on: ubuntu-22.04
if: ${{ github.event.client_payload.issue_number != -1 }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
- name: Print Correctness Info
run: |
echo "correctness info: is_regression: $IS_REGRESSION"
echo "correctness info: correctness_percentage: $CORRECTNESS_PERCENTAGE"
echo "correctness info: branch_ref: $BRANCH_REF"
echo "job_type: $JOB_TYPE"
env:
IS_REGRESSION: ${{ github.event.client_payload.correctness_info.is_regression }}
CORRECTNESS_PERCENTAGE: ${{ github.event.client_payload.correctness_info.correctness_percentage }}
BRANCH_REF: ${{ github.event.client_payload.correctness_info.branch_ref }}
JOB_TYPE: ${{ github.event.client_payload.job_type }}
CORRECTNESS_REGRESSION: ${{ github.event.client_payload.correctness_info.is_regression == 'true' && github.event.client_payload.job_type == 'sql-correctness' }}
- name: Get benchmark/correctness results
id: get-results
run: aws s3api get-object --bucket="$BUCKET" --key="$KEY" results.log
env:
KEY: ${{ github.event.client_payload.key }}
BUCKET: ${{ github.event.client_payload.bucket }}
- name: Post results to PR
uses: actions/github-script@v7
with:
github-token: ${{ secrets.REPO_ACCESS_TOKEN || secrets.GITHUB_TOKEN }}
script: |
const { ACTOR, FORMAT, ISSUE_NUMBER, JOB_TYPE, GITHUB_WORKSPACE } = process.env;
const { owner, repo } = context.repo;
const issue_number = parseInt(ISSUE_NUMBER, 10);
const fs = require('fs').promises;
const resData = await fs.readFile(`${GITHUB_WORKSPACE}/results.log`, 'utf8');
// Consider also deleting stale sql-correctness comments
// Both correctness and performance are posted/deleted here, they may delete each other
if (JOB_TYPE == "performance-benchmarking") {
const commentMarker = '<!-- go-run-output -->';
// List comments on the PR
const { data: comments } = await github.rest.issues.listComments({
issue_number: issue_number,
owner: context.repo.owner,
repo: context.repo.repo
});
// Find correct comment to update
let comment = null;
if (resData.includes("tpcc-scale-factor-1")) {
comment = comments.find(comment => comment.body.includes(commentMarker) && comment.body.includes("tpcc-scale-factor-1"))
} else if (resData.includes("read_tests")) {
comment = comments.find(comment => comment.body.includes(commentMarker) && comment.body.includes("read_tests"))
}
if (comment) {
// Update the existing comment
await github.rest.issues.updateComment({
comment_id: comment.id,
owner: context.repo.owner,
repo: context.repo.repo,
body: `${commentMarker}\n@${ACTOR} ${FORMAT}\n${resData}`
})
} else {
// Create a new comment
await github.rest.issues.createComment({
issue_number: issue_number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `${commentMarker}\n@${ACTOR} ${FORMAT}\n${resData}`
});
}
} else {
await github.rest.issues.createComment({
issue_number: issue_number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `@${ACTOR} ${FORMAT}\n${resData}`
});
}
env:
ACTOR: ${{ github.event.client_payload.actor }}
FORMAT: ${{ github.event.client_payload.noms_bin_format }}
ISSUE_NUMBER: ${{ github.event.client_payload.issue_number }}
JOB_TYPE: ${{ github.event.client_payload.job_type }}
- name: Remove Passing Labels if regression detected
if: ${{ github.event.client_payload.correctness_info.is_regression == true && github.event.client_payload.job_type == 'sql-correctness' }}
uses: actions/github-script@v7
with:
github-token: ${{ secrets.REPO_ACCESS_TOKEN || secrets.GITHUB_TOKEN }}
script: |
const { ACTOR, ISSUE_NUMBER, LABEL, GITHUB_WORKSPACE } = process.env;
const issue_number = parseInt(ISSUE_NUMBER, 10);
const { owner, repo } = context.repo;
try {
const res = await github.rest.issues.listLabelsOnIssue({
issue_number,
owner,
repo,
});
if (res.data) {
const labels = res.data;
for (const label of labels) {
if (label.name === LABEL) {
await github.rest.issues.removeLabel({
issue_number,
owner,
repo,
name: label.name,
});
}
}
}
} catch(e) {
console.error(e)
}
env:
ACTOR: ${{ github.event.client_payload.actor }}
ISSUE_NUMBER: ${{ github.event.client_payload.issue_number }}
LABEL: 'correctness_approved'
- name: Add Passing Labels if no regression detected
if: ${{ github.event.client_payload.correctness_info.is_regression != true && github.event.client_payload.job_type == 'sql-correctness' }}
uses: actions/github-script@v7
with:
github-token: ${{ secrets.REPO_ACCESS_TOKEN || secrets.GITHUB_TOKEN }}
script: |
const { ACTOR, ISSUE_NUMBER, LABEL, GITHUB_WORKSPACE } = process.env;
const issue_number = parseInt(ISSUE_NUMBER, 10);
const { owner, repo } = context.repo;
try {
const res = await github.rest.issues.listLabelsOnIssue({
issue_number,
owner,
repo,
});
if (res.data) {
const labels = res.data;
for (const label of labels) {
if (label.name === LABEL) {
return;
}
}
await github.rest.issues.addLabels({
issue_number,
owner,
repo,
labels: [LABEL],
});
}
} catch(e) {
console.error(e)
}
env:
ACTOR: ${{ github.event.client_payload.actor }}
ISSUE_NUMBER: ${{ github.event.client_payload.issue_number }}
LABEL: 'correctness_approved'
- name: Remove Passing Performance Labels if performance regression detected
if: ${{ github.event.client_payload.is_performance_regression == true && github.event.client_payload.job_type == 'performance-benchmarking' }}
uses: actions/github-script@v7
with:
github-token: ${{ secrets.REPO_ACCESS_TOKEN || secrets.GITHUB_TOKEN }}
script: |
const { ACTOR, ISSUE_NUMBER, LABEL, GITHUB_WORKSPACE } = process.env;
const issue_number = parseInt(ISSUE_NUMBER, 10);
const { owner, repo } = context.repo;
try {
const res = await github.rest.issues.listLabelsOnIssue({
issue_number,
owner,
repo,
});
if (res.data) {
const labels = res.data;
for (const label of labels) {
if (label.name === LABEL) {
await github.rest.issues.removeLabel({
issue_number,
owner,
repo,
name: label.name,
});
}
}
}
} catch(e) {
console.error(e)
}
env:
ACTOR: ${{ github.event.client_payload.actor }}
ISSUE_NUMBER: ${{ github.event.client_payload.issue_number }}
LABEL: 'performance_approved'
- name: Add Passing Performance Labels if no regression detected
if: ${{ github.event.client_payload.is_performance_regression != true && github.event.client_payload.job_type == 'performance-benchmarking' }}
uses: actions/github-script@v7
with:
github-token: ${{ secrets.REPO_ACCESS_TOKEN || secrets.GITHUB_TOKEN }}
script: |
const { ACTOR, ISSUE_NUMBER, LABEL, GITHUB_WORKSPACE } = process.env;
const issue_number = parseInt(ISSUE_NUMBER, 10);
const { owner, repo } = context.repo;
try {
const res = await github.rest.issues.listLabelsOnIssue({
issue_number,
owner,
repo,
});
if (res.data) {
const labels = res.data;
for (const label of labels) {
if (label.name === LABEL) {
return;
}
}
await github.rest.issues.addLabels({
issue_number,
owner,
repo,
labels: [LABEL],
});
}
} catch(e) {
console.error(e)
}
env:
ACTOR: ${{ github.event.client_payload.actor }}
ISSUE_NUMBER: ${{ github.event.client_payload.issue_number }}
LABEL: 'performance_approved'
update-correctness-file:
name: Update Correctness File
needs: report-pull-request
runs-on: ubuntu-22.04
if: ${{ github.event.client_payload.correctness_info.is_regression != 'true' && github.event.client_payload.job_type == 'sql-correctness' }}
steps:
- name: Checkout
uses: actions/checkout@v6
with:
ref: ${{ github.event.client_payload.correctness_info.branch_ref }}
repository: ${{ github.repository }}
token: ${{ secrets.REPO_ACCESS_TOKEN || secrets.GITHUB_TOKEN }}
- name: Write new correctness file
working-directory: ./.github/scripts/sql-correctness
env:
CORRECTNESS_PERCENTAGE: ${{ github.event.client_payload.correctness_info.correctness_percentage }}
run: |
if [ -z "$CORRECTNESS_PERCENTAGE" ]; then
echo "correctness percentage was empty, something went wrong"
exit 1
fi
echo "$CORRECTNESS_PERCENTAGE" > current_correctness.txt
- name: Changes detected
id: detect-changes
run: |
changes=$(git status --porcelain)
if [ ! -z "$changes" ]; then
echo "has-changes=true" >> $GITHUB_OUTPUT
fi
- uses: EndBug/add-and-commit@v9.1.4
if: ${{ steps.detect-changes.outputs.has-changes == 'true' }}
with:
message: ${{ format('[skip actions] [ga-update-correctness] SQL Correctness updated to {0}', github.event.client_payload.correctness_info.correctness_percentage) }}
add: "./current_correctness.txt"
cwd: "./.github/scripts/sql-correctness"
pull: "--ff"
+43
View File
@@ -0,0 +1,43 @@
name: Benchmark SQL Correctness
on:
repository_dispatch:
types: [ release-dolt ]
workflow_dispatch:
inputs:
version:
description: 'SemVer format release tag, i.e. 0.24.5'
required: true
default: ''
email:
description: 'Email address to receive results'
required: true
default: ''
jobs:
set-version-actor:
name: Set Version and Actor
runs-on: ubuntu-22.04
outputs:
version: ${{ steps.set-vars.outputs.version }}
actor: ${{ steps.set-vars.outputs.actor }}
steps:
- name: Set variables
id: set-vars
run: |
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "actor=$ACTOR" >> $GITHUB_OUTPUT
env:
VERSION: ${{ github.event.inputs.version || github.event.client_payload.version }}
ACTOR: ${{ github.event.client_payload.actor || github.actor }}
correctness:
runs-on: ubuntu-22.04
needs: set-version-actor
name: Trigger SQL Correctness K8s Workflow
steps:
- uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
event-type: sql-correctness
client-payload: '{"version": "${{ needs.set-version-actor.outputs.version }}", "mode": "release", "actor": "${{ needs.set-version-actor.outputs.actor }}", "actor_email": "${{ needs.set-version-actor.outputs.actor_email }}", "template_script": "./.github/scripts/sql-correctness/get-dolt-correctness-job-json.sh"}'
+57
View File
@@ -0,0 +1,57 @@
name: Benchmark SQL Correctness on PR
on:
pull_request:
paths:
- 'go/**'
branches: [ main ]
jobs:
set-version-actor:
if: github.actor != 'dependabot[bot]'
name: Set Version and Actor
runs-on: ubuntu-22.04
outputs:
regress_comp: ${{ steps.regress-comp.outputs.regress_comp }}
version: ${{ steps.set-vars.outputs.version }}
actor: ${{ steps.set-vars.outputs.actor }}
steps:
- name: Checkout BASE REF
uses: actions/checkout@v6
with:
ref: ${{ github.base_ref }}
- name: Get Current Correctness
id: regress-comp
working-directory: ./.github/scripts/sql-correctness
run: |
out=$(cat current_correctness.txt)
echo "regress_comp=$out" >> $GITHUB_OUTPUT
- name: Checkout PR HEAD REF
uses: actions/checkout@v6
with:
ref: ${{ github.head_ref }}
- name: Set variables
id: set-vars
run: |
echo "actor=$ACTOR" >> $GITHUB_OUTPUT
sha=$(git rev-parse --short HEAD)
echo "version=$sha" >> $GITHUB_OUTPUT
env:
ACTOR: ${{ github.event.client_payload.actor || github.actor }}
correctness:
runs-on: ubuntu-22.04
needs: set-version-actor
name: Trigger SQL Correctness K8s Workflow
steps:
- name: Get pull number
uses: actions/github-script@v7
id: get_pull_number
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: core.setOutput("pull_number", JSON.stringify(context.issue.number));
- uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
event-type: sql-correctness
client-payload: '{"issue_number": "${{ steps.get_pull_number.outputs.pull_number }}", "branch_ref": "${{ github.head_ref }}", "regress_comp": "${{ needs.set-version-actor.outputs.regress_comp }}", "version": "${{ needs.set-version-actor.outputs.version }}", "mode": "release", "actor": "${{ needs.set-version-actor.outputs.actor }}", "actor_email": "${{ needs.set-version-actor.outputs.actor_email }}", "template_script": "./.github/scripts/sql-correctness/get-dolt-correctness-job-json.sh"}'
@@ -0,0 +1,73 @@
name: Run Systab Benchmark on Pull Requests
on:
pull_request:
types: [ opened ]
issue_comment:
types: [ created ]
jobs:
validate-commentor:
runs-on: ubuntu-22.04
outputs:
valid: ${{ steps.set_valid.outputs.valid }}
steps:
- uses: actions/checkout@v6
- name: Validate Commentor
id: set_valid
run: ./.github/scripts/performance-benchmarking/validate-commentor.sh "$ACTOR"
env:
ACTOR: ${{ github.actor }}
check-comments:
runs-on: ubuntu-22.04
needs: validate-commentor
if: ${{ needs.validate-commentor.outputs.valid == 'true' }}
outputs:
benchmark: ${{ steps.set_benchmark.outputs.benchmark }}
comment-body: ${{ steps.set_body.outputs.body }}
steps:
- name: Check for Deploy Trigger
uses: dolthub/pull-request-comment-trigger@v2
id: check
with:
trigger: '#systab-benchmark'
reaction: rocket
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set Benchmark
if: ${{ steps.check.outputs.triggered == 'true' }}
id: set_benchmark
run: |
echo "benchmark=true" >> $GITHUB_OUTPUT
performance:
runs-on: ubuntu-22.04
needs: [validate-commentor, check-comments]
if: ${{ needs.check-comments.outputs.benchmark == 'true' }}
name: Trigger Benchmark Systab Workflow
steps:
- uses: dolthub/pull-request-comment-branch@v3
id: comment-branch
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
- name: Get pull number
uses: actions/github-script@v7
id: get_pull_number
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: core.setOutput("pull_number", JSON.stringify(context.issue.number));
- uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
event-type: benchmark-systab
client-payload: |
{
"version": "${{ steps.comment-branch.outputs.head_sha }}",
"run_file": "systab.yaml",
"report": "systab.sql",
"summary": "systab_summary.sql",
"commit_to_branch": "${{ steps.comment-branch.outputs.head_sha }}",
"actor": "${{ github.actor }}",
"issue_id": "${{ steps.get_pull_number.outputs.pull_number }}"
}
+178
View File
@@ -0,0 +1,178 @@
name: Systab Benchmarks
on:
repository_dispatch:
types: [ benchmark-systab ]
env:
BENCH_DIR: 'go/performance/sysbench'
RESULT_TABLE_NAME: 'sysbench_results'
DOLTHUB_DB: 'import-perf/systab-perf'
jobs:
bench:
name: Benchmark
defaults:
run:
shell: bash
strategy:
fail-fast: true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.event.client_payload.version }}
- name: Set up Go 1.x
id: go
uses: actions/setup-go@v5
with:
go-version-file: go/go.mod
- name: Dolt version
id: version
run: |
version=${{ github.event.client_payload.version }}
- name: install sysbench
run: |
curl -s https://packagecloud.io/install/repositories/akopytov/sysbench/script.deb.sh | sudo bash
sudo apt -y install sysbench
- name: Install dolt
working-directory: ./go
run: go install ./cmd/dolt
- name: Clone sysbench scripts
run: |
scripts=$GITHUB_WORKSPACE/scripts
git clone https://github.com/dolthub/systab-sysbench-scripts.git "$scripts"
- name: Run bench
id: bench
working-directory: go/
run: |
out="$GITHUB_WORKSPACE/results.sql"
testspec="../${{ env.BENCH_DIR }}/testdata/${{ github.event.client_payload.run_file }}"
config="../${{ env.BENCH_DIR }}/testdata/default-config.yaml"
scripts="$GITHUB_WORKSPACE/scripts"
go run \
"github.com/dolthub/dolt/${{ env.BENCH_DIR }}/cmd" \
-run "$testspec" \
-config "$config" \
-script-dir "$scripts" \
-out "$out"
echo "result_path=$out" >> $GITHUB_OUTPUT
- name: Report
id: report
run: |
gw=$GITHUB_WORKSPACE
in="${{ steps.bench.outputs.result_path }}"
query="$(pwd)/${{ env.BENCH_DIR }}/reporting/${{ github.event.client_payload.report }}"
summaryq="$(pwd)/${{ env.BENCH_DIR }}/reporting/${{ github.event.client_payload.summary }}"
out="$gw/results.csv"
dolt_dir="$gw/systab-perf"
dolt config --global --add user.email "systab-perf@dolthub.com"
dolt config --global --add user.name "systab-perf"
echo '${{ secrets.DOLTHUB_IMPORT_PERF_CREDS_VALUE }}' | dolt creds import
dolt clone ${{ env.DOLTHUB_DB }} "$dolt_dir"
cd "$dolt_dir"
branch="${{ github.event.client_payload.commit_to_branch }}"
# checkout branch
if [ -z $(dolt sql -q "select 1 from dolt_branches where name = '$branch';") ]; then
dolt checkout -b $branch
else
dolt checkout $branch
fi
dolt sql -q "drop table if exists sysbench_results"
# load results
dolt sql < "$in"
# push results to dolthub
dolt add sysbench_results
dolt commit -m "CI commit"
dolt push -f origin $branch
# generate report
dolt sql -r csv < "$query" > "$out"
cat "$out"
echo "report_path=$out" >> $GITHUB_OUTPUT
avg=$(dolt sql -r csv < "$summaryq" | tail -1)
echo "avg=$avg" >> $GITHUB_OUTPUT
- name: Format Results
id: html
if: ${{ github.event.client_payload.email_recipient }} != ""
run: |
gw="$GITHUB_WORKSPACE"
in="${{ steps.report.outputs.report_path }}"
out="$gw/results.html"
echo "<table>" > "$out"
print_header=true
while read line; do
if "$print_header"; then
echo " <tr><th>${line//,/</th><th>}</th></tr>" >> "$out"
print_header=false
continue
fi
echo " <tr><td>${line//,/</td><td>}</td></tr>" >> "$out"
done < "$in"
echo "</table>" >> "$out"
avg="${{ steps.report.outputs.avg }}"
echo "<table><tr><th>Average</th></tr><tr><td>$avg</tr></td></table>" >> "$out"
cat "$out"
echo "html=$(echo $out)" >> $GITHUB_OUTPUT
- name: Configure AWS Credentials
if: ${{ github.event.client_payload.email_recipient }} != ""
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
- name: Send Email
uses: ./.github/actions/ses-email-action
if: ${{ github.event.client_payload.email_recipient }} != ""
with:
region: us-west-2
toAddresses: '["${{ github.event.client_payload.email_recipient }}"]'
subject: 'System Table Performance Benchmarks: ${{ github.event.client_payload.version }}'
bodyPath: ${{ steps.html.outputs.html }}
template: 'SysbenchTemplate'
- name: Read CSV
if: ${{ github.event.client_payload.issue_id }} != ""
id: csv
uses: juliangruber/read-file-action@v1
with:
path: "${{ steps.report.outputs.report_path }}"
- name: Create MD
if: ${{ github.event.client_payload.issue_id }} != ""
uses: dolthub/csv-to-md-table-action@v4
id: md
with:
csvinput: ${{ steps.csv.outputs.content }}
- uses: mshick/add-pr-comment@v2
if: ${{ github.event.client_payload.issue_id }} != ""
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue: ${{ github.event.client_payload.issue_id }}
message-failure: systab benchmark failed
message-cancelled: systab benchmark cancelled
allow-repeats: true
message: |
@${{ github.event.client_payload.actor }} __DOLT__
${{ steps.md.outputs.markdown-table }}
@@ -0,0 +1,53 @@
name: Benchmark Mini Sysbench Performance on PR
on:
pull_request:
paths:
- 'go/**'
branches: [ main ]
jobs:
performance:
name: Trigger Mini Benchmark Latency K8s Workflow
if: github.actor != 'dependabot[bot]'
runs-on: ubuntu-22.04
steps:
- name: Build benchmark payload (main HEAD + PR HEAD)
uses: actions/github-script@v7
id: build_payload
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
// For PR benchmarks, use the PR base commit (the exact target commit this PR was opened/updated against),
// not the moving HEAD of `main`.
const fromSha = context.payload.pull_request.base.sha;
// The latest commit on the PR branch.
const toSha = context.payload.pull_request.head.sha;
const payload = {
from_server: "dolt",
from_version: fromSha,
to_server: "dolt",
to_version: toSha,
mode: "pullRequest",
issue_number: String(context.issue.number),
init_big_repo: "true",
actor: context.actor,
sysbench_test_time: "20",
template_script: "./.github/scripts/performance-benchmarking/get-dolt-dolt-job-json.sh",
};
core.setOutput("from_sha", fromSha);
core.setOutput("to_sha", toSha);
core.setOutput("payload", JSON.stringify(payload));
- name: Log benchmark versions
shell: bash
run: |
echo "from_version_sha=${{ steps.build_payload.outputs.from_sha }}"
echo "to_version_sha=${{ steps.build_payload.outputs.to_sha }}"
- uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
event-type: benchmark-latency
client-payload: ${{ steps.build_payload.outputs.payload }}