Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: sqlconnect library #1

Merged
merged 10 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
2 changes: 2 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
with tests:
- any: ['**/*_test.go']
11 changes: 11 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Description

< Replace with adequate description for this PR as per [Pull Request document](https://www.notion.so/rudderstacks/Pull-Requests-40a4c6bd7a5e4387ba9029bab297c9e3) >

## Linear Ticket

< Replace_with_Linear_Link >

## Security

- [ ] The code changed/added as part of this pull request won't create any security issues with how the software is being used.
15 changes: 15 additions & 0 deletions .github/workflows/labeler.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: labeler
on:
- pull_request

jobs:
triage:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v4
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
sync-labels: true
17 changes: 17 additions & 0 deletions .github/workflows/pr-description-enforcer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: description
on:
pull_request:
types:
- opened
- edited
- reopened

jobs:
enforce:
runs-on: ubuntu-latest

steps:
- uses: rudderlabs/pr-description-enforcer@v1.0.0
with:
repo-token: '${{ secrets.GITHUB_TOKEN }}'
placeholder-regex: '< Replace .* >'
54 changes: 54 additions & 0 deletions .github/workflows/prerelease.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
on:
push:
branches:
- "prerelease/*"
name: prerelease
jobs:
prerelease:
runs-on: ubuntu-latest
steps:
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- uses: google-github-actions/release-please-action@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
pull-request-title-pattern: "chore: prerelease ${version}"
release-type: go
package-name: rudder-server
default-branch: ${{ steps.extract_branch.outputs.branch }}
changelog-types: '
[
{
"type": "feat",
"section": "Features",
"hidden": false
},
{
"type": "fix",
"section": "Bug Fixes",
"hidden": false
},
{
"type": "chore",
"section":"Miscellaneous",
"hidden": false},
{
"type": "refactor",
"section": "Miscellaneous",
"hidden": false
},
{
"type": "test",
"section": "Miscellaneous",
"hidden": false
},
{
"type": "doc",
"section": "Documentation",
"hidden": false
}
]'
prerelease: true
release-as: ${{ steps.extract_branch.outputs.branch }}
22 changes: 22 additions & 0 deletions .github/workflows/release-please.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
on:
push:
branches:
- "main"
name: release-please
jobs:
release-please:
runs-on: ubuntu-latest
steps:
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- uses: google-github-actions/release-please-action@v3
with:
token: ${{ secrets.PAT }}
pull-request-title-pattern: "chore: release ${version}"
release-type: go
package-name: rudder-server
default-branch: ${{ steps.extract_branch.outputs.branch }}
changelog-types: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"chore","section":"Miscellaneous","hidden":false},{"type":"refactor","section":"Miscellaneous","hidden":false},{"type":"test","section":"Miscellaneous","hidden":false},{"type":"doc","section":"Documentation","hidden":false}]'
bump-minor-pre-major: true
59 changes: 59 additions & 0 deletions .github/workflows/semantic-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: semantic

on:
pull_request:
types:
- opened
- edited
- labeled
- unlabeled
- converted_to_draft
- ready_for_review
- synchronize

jobs:
main:
name: title
runs-on: ubuntu-latest
steps:
-
uses: amannn/action-semantic-pull-request@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
types: |
fix
feat
chore
refactor
exp
doc
test
requireScope: false
subjectPattern: ^(?![A-Z]).+$
subjectPatternError: |
The subject "{subject}" found in the pull request title "{title}"
didn't match the configured pattern. Please ensure that the subject
doesn't start with an uppercase character.
# For work-in-progress PRs you can typically use draft pull requests
# from GitHub. However, private repositories on the free plan don't have
# this option and therefore this action allows you to opt-in to using the
# special "[WIP]" prefix to indicate this state. This will avoid the
# validation of the PR title and the pull request checks remain pending.
# Note that a second check will be reported if this is enabled.
wip: true
# When using "Squash and merge" on a PR with only one commit, GitHub
# will suggest using that commit message instead of the PR title for the
# merge commit, and it's easy to commit this by mistake. Enable this option
# to also validate the commit message for one commit PRs.
validateSingleCommit: false
# Related to `validateSingleCommit` you can opt-in to validate that the PR
# title matches a single commit to avoid confusion.
validateSingleCommitMatchesPrTitle: false
# If the PR contains one of these labels, the validation is skipped.
# Multiple labels can be separated by newlines.
# If you want to rerun the validation when labels change, you might want
# to use the `labeled` and `unlabeled` event triggers in your workflow.
ignoreLabels: |
bot
dependencies
40 changes: 40 additions & 0 deletions .github/workflows/stale-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: stale

on:
schedule:
- cron: '42 1 * * *'

jobs:
prs:
name: cleanup
runs-on: ubuntu-latest

permissions:
pull-requests: write

steps:
- uses: actions/stale@v5
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
operations-per-run: 200
stale-pr-message: 'This PR is considered to be stale. It has been open 20 days with no further activity thus it is going to be closed in 5 days. To avoid such a case please consider removing the stale label manually or add a comment to the PR.'
days-before-pr-stale: 20
days-before-pr-close: 7
stale-pr-label: 'Stale'

branches:
name: cleanup old branches
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Run delete-old-branches-action
uses: beatlabs/delete-old-branches-action@v0.0.9
with:
repo_token: ${{ github.token }}
date: '2 months ago'
dry_run: false
delete_tags: false
extra_protected_branch_regex: ^(main|master|release.*|rudder-saas)$
exclude_open_pr_branches: true

99 changes: 99 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: test
on:
release:
types: [created]
push:
branches:
- main
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
id-token: write # allows the JWT to be requested from GitHub's OIDC provider
contents: read # This is required for actions/checkout

jobs:
tests:
name: matrix test
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
package:
- .
- sqlconnect/internal
- sqlconnect/internal/bigquery
- sqlconnect/internal/databricks
- sqlconnect/internal/mysql
- sqlconnect/internal/postgres
- sqlconnect/internal/redshift
- sqlconnect/internal/snowflake
- sqlconnect/internal/trino
include:
- package: .
exclude: sqlconnect-go/sqlconnect/internal
- package: sqlconnect/internal
exclude: sqlconnect-go/sqlconnect/internal/(bigquery|databricks|mysql|postgres|redshift|snowflake|trino)
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.22'
check-latest: true
- run: go version
- run: go mod download
- name: Run tests
run: |
make test exclude="${{ matrix.exclude }}" package=${{ matrix.package }}
env:
REDSHIFT_TEST_ENVIRONMENT_CREDENTIALS: ${{ secrets.REDSHIFT_TEST_ENVIRONMENT_CREDENTIALS }}
SNOWFLAKE_TEST_ENVIRONMENT_CREDENTIALS: ${{ secrets.SNOWFLAKE_TEST_ENVIRONMENT_CREDENTIALS }}
BIGQUERY_TEST_ENVIRONMENT_CREDENTIALS: ${{ secrets.BIGQUERY_TEST_ENVIRONMENT_CREDENTIALS }}
DATABRICKS_TEST_ENVIRONMENT_CREDENTIALS: ${{ secrets.DATABRICKS_TEST_ENVIRONMENT_CREDENTIALS }}
TRINO_TEST_ENVIRONMENT_CREDENTIALS: ${{ secrets.TRINO_TEST_ENVIRONMENT_CREDENTIALS }}
- name: Sanitize name for Artifact
run: |
name=$(echo -n "${{ matrix.package }}" | sed -e 's/[ \t:.\/\\"<>|*?]/_/g' -e 's/--*/-/g')
echo "ARTIFACT_NAME=$name" >> $GITHUB_ENV
- name: Upload coverage report
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}_profile.out
path: profile.out
coverage:
name: coverage
runs-on: 'ubuntu-20.04'
needs:
- tests
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.22.0'
check-latest: true
- name: Download coverage reports
uses: actions/download-artifact@v4
- name: Merge Coverage
run: |
go install github.com/wadey/gocovmerge@latest
gocovmerge */profile.out > profile.out
- uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
files: ./profile.out
token: ${{ secrets.CODECOV_TOKEN }}
all-green:
name: all-tests
if: always()
runs-on: ubuntu-latest
needs:
- tests
steps:
- uses: re-actors/alls-green@v1.2.2
with:
jobs: ${{ toJSON(needs) }}
56 changes: 56 additions & 0 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: verify
on:
push:
tags:
- v*
branches:
- master
- main
pull_request:
jobs:
generate:
name: generated files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v3
with:
check-latest: true
cache: true
go-version: '1.22.0'
- run: go version

- run: go mod tidy
- run: git diff --exit-code go.mod
- name: Error message
if: ${{ failure() }}
run: echo '::error file=go.mod,line=1,col=1::Inconsistent go mod file. Ensure you have run `go mod tidy` and committed the files locally.'; echo '::error file=enterprise_mod.go,line=1,col=1::Possible missing enterprise exclusive dependencies.'

- run: make generate
- run: git diff --exit-code
- name: Error message
if: ${{ failure() }}
run: echo '::error file=Makefile,line=11,col=1::Incorrectly generated files. Ensure you have run `make generate` and committed the files locally.'

- run: make fmt
- run: git diff --exit-code
- name: Error message
if: ${{ failure() }}
run: echo 'Not formatted files. Ensure you have run `make fmt` and committed the files locally.'
linting:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '1.22.0'
check-latest: true
cache: true
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.56.2
args:
-v
--timeout 10m
Loading
Loading