Skip to content

Commit

Permalink
Merge pull request #64 from tablelandnetwork/bcalza/merge
Browse files Browse the repository at this point in the history
Merge wasm sql parser with go sql parser
  • Loading branch information
brunocalza authored Jul 20, 2023
2 parents c0e6862 + 8847b5e commit d69cf35
Show file tree
Hide file tree
Showing 36 changed files with 11,631 additions and 12 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
# By convention in @tablelandnetwork repos, the first listed
# CODEOWNER is the repo DRI (directly responsible individual)
* @brunocalza @avichalp
/js/ @carsonfarmer @joewagner @brunocalza
40 changes: 40 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
name: Bug report
about: Create a report to help us improve
title: ""
labels: ""
assignees: ""
---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**

- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**

- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Feature request
about: Suggest an idea for this project
title: ""
labels: ""
assignees: ""
---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. E.g. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
8 changes: 6 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
version: 2
updates:
- package-ecosystem: "gomod" # See documentation for possible values
directory: "/" # Location of package manifests
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "npm"
directory: "/js"
schedule:
interval: "daily"
133 changes: 133 additions & 0 deletions .github/workflows/combine-prs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
name: "Combine PRs"

# Controls when the action will run - in this case triggered manually
on:
workflow_dispatch:
inputs:
branchPrefix:
description: "Branch prefix to find combinable PRs based on"
required: true
default: "dependabot"
mustBeGreen:
description: "Only combine PRs that are green (status is success)"
required: true
default: true
combineBranchName:
description: "Name of the branch to combine PRs into"
required: true
default: "combine-prs-branch"
ignoreLabel:
description: "Exclude PRs with this label"
required: true
default: "nocombine"

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "combine-prs"
combine-prs:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/github-script@v6
id: create-combined-pr
name: Create Combined PR
with:
github-token: ${{secrets.TEXTILEIO_MACHINE_ACCESS_TOKEN}}
script: |
const pulls = await github.paginate('GET /repos/:owner/:repo/pulls', {
owner: context.repo.owner,
repo: context.repo.repo
});
let branchesAndPRStrings = [];
let baseBranch = null;
let baseBranchSHA = null;
for (const pull of pulls) {
const branch = pull['head']['ref'];
console.log('Pull for branch: ' + branch);
if (branch.startsWith('${{ github.event.inputs.branchPrefix }}')) {
console.log('Branch matched prefix: ' + branch);
let statusOK = true;
if(${{ github.event.inputs.mustBeGreen }}) {
console.log('Checking green status: ' + branch);
const checkRuns = await github.request('GET /repos/{owner}/{repo}/commits/{ref}/check-runs', {
owner: context.repo.owner,
repo: context.repo.repo,
ref: branch
});
for await (const cr of checkRuns.data.check_runs) {
console.log('Validating check conclusion: ' + cr.conclusion);
if(cr.conclusion != 'success') {
console.log('Discarding ' + branch + ' with check conclusion ' + cr.conclusion);
statusOK = false;
}
}
}
console.log('Checking labels: ' + branch);
const labels = pull['labels'];
for(const label of labels) {
const labelName = label['name'];
console.log('Checking label: ' + labelName);
if(labelName == '${{ github.event.inputs.ignoreLabel }}') {
console.log('Discarding ' + branch + ' with label ' + labelName);
statusOK = false;
}
}
if (statusOK) {
console.log('Adding branch to array: ' + branch);
const prString = '#' + pull['number'] + ' ' + pull['title'];
branchesAndPRStrings.push({ branch, prString });
baseBranch = pull['base']['ref'];
baseBranchSHA = pull['base']['sha'];
}
}
}
if (branchesAndPRStrings.length == 0) {
core.setFailed('No PRs/branches matched criteria');
return;
}
try {
await github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/heads/' + '${{ github.event.inputs.combineBranchName }}',
sha: baseBranchSHA
});
} catch (error) {
console.log(error);
core.setFailed('Failed to create combined branch - maybe a branch by that name already exists?');
return;
}
let combinedPRs = [];
let mergeFailedPRs = [];
for(const { branch, prString } of branchesAndPRStrings) {
try {
await github.rest.repos.merge({
owner: context.repo.owner,
repo: context.repo.repo,
base: '${{ github.event.inputs.combineBranchName }}',
head: branch,
});
console.log('Merged branch ' + branch);
combinedPRs.push(prString);
} catch (error) {
console.log('Failed to merge branch ' + branch);
mergeFailedPRs.push(prString);
}
}
console.log('Creating combined PR');
const combinedPRsString = combinedPRs.join('\n');
let body = '✅ This PR was created by the Combine PRs action by combining the following PRs:\n' + combinedPRsString;
if(mergeFailedPRs.length > 0) {
const mergeFailedPRsString = mergeFailedPRs.join('\n');
body += '\n\n⚠️ The following PRs were left out due to merge conflicts:\n' + mergeFailedPRsString
}
await github.rest.pulls.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: 'Combined PR',
head: '${{ github.event.inputs.combineBranchName }}',
base: baseBranch,
body: body
});
87 changes: 87 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Publish
on:
workflow_dispatch:
inputs:
release_version:
description: "Version of this release"
required: true
jobs:
publish:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./js

steps:
- name: Checkout 🛎️
uses: actions/checkout@v3

- name: Cache 📦
uses: actions/cache@v3
with:
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Setup Node ⬢
uses: actions/setup-node@v3
with:
node-version: 18

- name: Setup TinyGo
uses: acifani/setup-tinygo@v1
with:
tinygo-version: '0.27.0'

- name: Version 👍
id: version-bump
uses: jaywcjlove/[email protected]
with:
version: ${{ github.event.inputs.release_version }}

- name: Install 🔧
run: npm install

- name: Build 🛠
run: npm run build

- name: Tag 🏷️
uses: actions/github-script@v6
id: create-tag
with:
github-token: ${{secrets.TEXTILEIO_MACHINE_ACCESS_TOKEN}}
script: |
await github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/${{ github.event.inputs.release_version }}',
sha: context.sha
})
- name: Conditional ✅
id: cond
uses: haya14busa/action-cond@v1
with:
cond: ${{ contains(github.event.inputs.release_version, '-') }}
if_true: "next"
if_false: "latest"

- name: Publish 📦
id: publish
uses: JS-DevTools/npm-publish@v2
with:
token: ${{ secrets.NPM_AUTH_TOKEN }}
tag: ${{ steps.cond.outputs.value }}
access: public

- name: Release 🚀
if: steps.publish.outputs.type != 'none'
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.publish.outputs.version }}
generateReleaseNotes: true
prerelease: ${{ contains(steps.publish.outputs.type, 'pre') }}
token: ${{ secrets.GITHUB_TOKEN }}
38 changes: 37 additions & 1 deletion .github/workflows/review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
with:
go-version: v1.19
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
- uses: actions/cache@v2
with:
path: |
Expand All @@ -33,3 +33,39 @@ jobs:
${{ runner.os }}-go-
- name: Run linter
run: make lint
js-lint:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./js
strategy:
fail-fast: true
matrix:
nodejs: [16, 18]

steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
with:
persist-credentials: false

- name: Cache 📦
uses: actions/cache@v1
with:
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Setup ⬢
uses: actions/setup-node@v2-beta
with:
node-version: ${{ matrix.nodejs }}

- name: Install 🔧
run: npm install

- name: Lint 🙈
run: npm run prettier && npm run lint
Loading

0 comments on commit d69cf35

Please sign in to comment.