Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
borchero committed Jul 26, 2024
0 parents commit c56eab9
Show file tree
Hide file tree
Showing 128 changed files with 14,905 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# This file is managed by Copier; DO NOT EDIT OR REMOVE.
_commit: v0.1.0
_src_path: https://github.com/quantco/copier-template-python-open-source
add_autobump_workflow: true
github_url: https://github.com/quantco/sqlcompyre
github_user: borchero
minimal_python_version: py311
project_name: SQLCompyre
project_short_description: Tool for comparing and inspecting data in SQL databases.
project_slug: sqlcompyre
use_devcontainer: false
4 changes: 4 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export DB_CONNECTION_STRING=sqlite:///test.sqlite3

watch_file pixi.lock
eval "$(pixi shell-hook)"
8 changes: 8 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pixi.lock linguist-language=YAML linguist-generated=true

* text=auto

*.{diff,patch} binary

*.{py,yaml,yml,sh} text eol=lf
*.bat text eol=crlf
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @borchero
7 changes: 7 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Motivation

<!-- Why is this change necessary? Link issues here if applicable. -->

# Changes

<!-- What changes have been performed? -->
34 changes: 34 additions & 0 deletions .github/actions/pytest/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Pytest
description: Run pytest with a single database system.

inputs:
database:
description: A unique identifier for the database system tested against.
required: true
python-version:
description: The Python version to use for testing.
required: true
environment:
description: The pixi environment to use.
required: true
github-token:
description: GitHub token to clone repositories other than this.
required: true
codecov-token:
description: Codecov token to upload coverage information.
required: true

runs:
using: composite
steps:
- name: Set up pixi
uses: prefix-dev/setup-pixi@ba3bb36eb2066252b2363392b7739741bb777659
with:
environments: ${{ inputs.environment }}
activate-environment: true
- name: Install repository
run: pixi run postinstall
shell: bash -el {0}
- name: Run pytest
run: pixi run test-coverage --color=yes
shell: bash -el {0}
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: github-actions
directory: /
schedule:
interval: monthly
groups:
gh-actions:
patterns:
- "*"
101 changes: 101 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# ------------------------------------- PULL REQUEST LABELS ------------------------------------- #
autolabeler:
# Conventional Commit Types (https://github.com/commitizen/conventional-commit-types)
- label: build
title:
- '/^build(\(.*\))?(\!)?\:/'
- label: chore
title:
- '/^chore(\(.*\))?(\!)?\:/'
- label: ci
title:
- '/^ci(\(.*\))?(\!)?\:/'
- label: documentation
title:
- '/^docs(\(.*\))?(\!)?\:/'
- label: enhancement
title:
- '/^feat(\(.*\))?(\!)?\:/'
- label: fix
title:
- '/^fix(\(.*\))?(\!)?\:/'
- label: performance
title:
- '/^perf(\(.*\))?(\!)?\:/'
- label: refactor
title:
- '/^refactor(\(.*\))?(\!)?\:/'
- label: revert
title:
- '/^revert(\(.*\))?(\!)?\:/'
- label: style
title:
- '/^style(\(.*\))?(\!)?\:/'
- label: test
title:
- '/^test(\(.*\))?(\!)?\:/'
# Custom Types
- label: breaking
title:
- '/^[a-z]+(\(.*\))?\!\:/'
# ------------------------------------- AUTOMATIC VERSIONING ------------------------------------ #
version-resolver:
major:
labels:
- breaking
minor:
labels:
- enhancement
default: patch
# ------------------------------------ RELEASE CONFIGURATION ------------------------------------ #
name-template: "v$RESOLVED_VERSION"
tag-template: "v$RESOLVED_VERSION"
category-template: "### $TITLE"
change-template: "- $TITLE by @$AUTHOR in [#$NUMBER]($URL)"
replacers:
# remove conventional commit tag & scope from change list
- search: '/- [a-z]+(\(.*\))?(\!)?\: /g'
replace: "- "
template: |
## What's Changed
$CHANGES
**Full Changelog:** [`$PREVIOUS_TAG...v$RESOLVED_VERSION`](https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION)
categories:
- title: ⚠️ Breaking Changes
labels:
- breaking
- title: ✨ New Features
labels:
- enhancement
- title: 🐞 Bug Fixes
labels:
- fix
- title: 🏎️ Performance Improvements
labels:
- performance
- title: 📚 Documentation
labels:
- documentation
- title: 🏗️ Testing
labels:
- test
- title: ⚙️ Automation
labels:
- ci
- title: 🛠 Builds
labels:
- build
- title: 💎 Code Style
labels:
- style
- title: 📦 Refactorings
labels:
- refactor
- title: ♻️ Chores
labels:
- chore
- title: 🗑 Reverts
labels:
- revert
47 changes: 47 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Build
on:
pull_request:
push:
branches: [main]
release:
types: [published]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
fetch-depth: 0
- name: Set up pixi
uses: prefix-dev/setup-pixi@ba3bb36eb2066252b2363392b7739741bb777659
with:
environments: build
- name: Build project
run: pixi run -e build build-wheel
- name: Upload package
uses: actions/upload-artifact@v4
with:
name: artifact
path: dist/*

release:
name: Publish package
if: github.event_name == 'release'
needs: [build]
runs-on: ubuntu-latest
permissions:
id-token: write
environment: pypi
steps:
- uses: actions/download-artifact@v4
with:
name: artifact
path: dist
- name: Publish package on TestPyPi
uses: pypa/gh-action-pypi-publish@ec4db0b4ddc65acdf4bff5fa45ac92d78b56bdf0
with:
repository-url: https://test.pypi.org/legacy/
- name: Publish package on PyPi
uses: pypa/gh-action-pypi-publish@ec4db0b4ddc65acdf4bff5fa45ac92d78b56bdf0
66 changes: 66 additions & 0 deletions .github/workflows/chore.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Chore
on:
pull_request:
branches: [main]
types: [opened, reopened, edited, synchronize]
push:
branches: [main]

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

jobs:
check-pr-title:
name: Check PR Title
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Check valid conventional commit message
id: lint
uses: amannn/action-semantic-pull-request@v5
with:
subjectPattern: ^[A-Z].+[^. ]$ # subject must start with uppercase letter and may not end with a dot/space
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Post comment about invalid PR title
if: failure()
uses: marocchino/sticky-pull-request-comment@v2
with:
header: conventional-commit-pr-title
message: |
Thank you for opening this pull request! 👋🏼
This repository requires pull request titles to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed title needs to be adjusted.
<details><summary><b>Details</b></summary>
```
${{ steps.lint.outputs.error_message }}
```
</details>
- name: Delete comment about invalid PR title
if: success()
uses: marocchino/sticky-pull-request-comment@v2
with:
header: conventional-commit-pr-title
delete: true

release-drafter:
name: ${{ github.event_name == 'pull_request' && 'Assign Labels' || 'Draft Release' }}
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: ${{ github.event_name == 'pull_request' && 'Assign labels' || 'Update release draft' }}
uses: release-drafter/release-drafter@v6
with:
disable-releaser: ${{ github.event_name == 'pull_request' }}
disable-autolabeler: ${{ github.event_name == 'push' }}
env:
GITHUB_TOKEN: ${{ github.token }}
83 changes: 83 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: CI
on:
pull_request:
push:
branches: [main]

# Automatically stop old builds on the same branch/PR
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

defaults:
run:
shell: bash -el {0}

jobs:
pre-commit:
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v4
- name: Set up pixi
uses: prefix-dev/setup-pixi@ba3bb36eb2066252b2363392b7739741bb777659
with:
environments: default lint
- name: pre-commit
run: pixi run pre-commit-run --color=always --show-diff-on-failure

linux-mssql:
name: Unit Tests - MSSQL ${{ matrix.mssql-version }} - Environment ${{ matrix.environment }}
timeout-minutes: 30
runs-on: ubuntu-latest
services:
mssql:
image: mcr.microsoft.com/mssql/server:2022-latest
env:
ACCEPT_EULA: Y
SA_PASSWORD: Passw0rd
ports:
- 1433:1433
strategy:
fail-fast: false
matrix:
mssql-version: [2017, 2019, 2022]
environment: [py311, py312]
steps:
- name: Checkout branch
uses: actions/checkout@v4
- name: Install msodbcsql18
run: sudo ACCEPT_EULA=Y apt-get install msodbcsql18 -y
- name: Run tests
uses: ./.github/actions/pytest
with:
database: MSSQL
github-token: ${{ secrets.FQ_GH_TOKEN }}
codecov-token: ${{ secrets.CODECOV_TOKEN }}
environment: ${{ matrix.environment }}
env:
DB_CONNECTION_STRING: mssql+pyodbc://sa:Passw0rd@localhost:1433/master?driver=ODBC+Driver+18+for+SQL+Server&Encrypt=no

linux-sqlite:
name: Unit Tests - SQLite - Environment ${{ matrix.environment }}
timeout-minutes: 30
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
environment: ["py311", "py312"]
steps:
- name: Checkout branch
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run tests
uses: ./.github/actions/pytest
with:
database: SQLite
github-token: ${{ secrets.FQ_GH_TOKEN }}
codecov-token: ${{ secrets.CODECOV_TOKEN }}
environment: ${{ matrix.environment }}
env:
DB_CONNECTION_STRING: sqlite:///test.sqlite3
Loading

0 comments on commit c56eab9

Please sign in to comment.