Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
262 changes: 130 additions & 132 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,167 +1,165 @@
version: 2.1

orbs:
codeartifact: visualfabriq/codeartifact@1.3.21
coverage-reporter: codacy/coverage-reporter@14.1.0
sdlc: visualfabriq/sdlc@3
codeartifact: visualfabriq/codeartifact@3

jobs:
test:
executor: codeartifact/default
parameters:
with-coverage:
description: Coverage reporting flag
type: boolean
default: false
runtime:
description: Python runtime version
type: string
default: "3.11"
resource-class:
description: Resource class (medium for x86, arm.medium for ARM64)
type: string
default: "medium"
resource_class: <<parameters.resource-class>>
docker:
- image: cimg/python:<<parameters.runtime>> # Ubuntu 22.04 with glibc 2.35
python_executor: &python_executor
name: sdlc/python
python-version: "3.11"

working_directory: ~/parquery
steps:
- checkout
python_executor_small: &python_executor_small
name: sdlc/python
python-version: "3.11"
resource-class: small

commands:
export-uv-auth:
description: "Export authenticated package index for uv (bridges codeartifact/init pip auth to uv)"
steps:
- run:
name: Install uv
name: Export authenticated URL for uv
command: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> $BASH_ENV
source $BASH_ENV
CA_URL="${PIP_INDEX_URL:-$(pip config get global.index-url 2>/dev/null)}"

- restore_cache:
keys:
- << parameters.resource-class >>-<< parameters.runtime >>-v2-uv-{{ checksum "setup.py" }}
- << parameters.resource-class >>-<< parameters.runtime >>-v2-uv
if [ -z "$CA_URL" ]; then
echo "No authenticated package index found"
exit 1
fi

- run:
name: Create virtualenv with uv
command: uv venv --clear ~/venv
echo "export UV_INDEX_URL=$CA_URL" >> $BASH_ENV
echo "export UV_INDEX_PRIVATE_URL=$CA_URL" >> $BASH_ENV

jobs:
test:
executor:
<<: *python_executor
steps:
- checkout
- codeartifact/init:
tool: pip

- run:
name: Install dependencies with uv
command: |
source ~/venv/bin/activate
uv pip install .[test]

# Save the cached dependencies
- save_cache:
key: << parameters.resource-class >>-<< parameters.runtime >>-v2-uv-{{ checksum "setup.py" }}
paths:
- ~/venv
- ~/.cache/uv
- ~/.cargo/bin/uv

# Save git revision info
- run:
name: save GIT revision info
command: |
git rev-parse HEAD > git_hash.txt

- export-uv-auth
- sdlc/run-tests-with-coverage:
uv-sync-group: test
diff-coverage-threshold: 80

publish-dev:
executor:
<<: *python_executor_small
steps:
- checkout
- codeartifact/init:
tool: pip
- export-uv-auth
- codeartifact/pre_release_version:
package: parquery
output-var-name: RELEASE_VERSION
suffix: .dev
- codeartifact/stamp-version:
version-file: pyproject.toml
- run:
name: set variables
command: |
# Enable debug mode
export LOG_LEVEL=debug

- when:
condition:
not: << parameters.with-coverage >>
steps:
- run:
name: Run tests
command: ~/venv/bin/python -m pytest tests
- when:
condition: << parameters.with-coverage >>
steps:
- run:
name: Run tests with coverage reporting
command: |
~/venv/bin/python -m coverage run -m \
pytest tests --junitxml=test-results/pytest/pytest-report.xml
~/venv/bin/python -m coverage xml -o cobertura.xml
- store_test_results:
path: test-results
- store_artifacts:
path: test-results
- coverage-reporter/send_report
name: Build
command: uv build
- codeartifact/push:
tool: twine

build-and-push:
executor: codeartifact/default
parameters:
is-pre-release:
description: if true the version tag will contain the branch
type: boolean
default: false
publish-rc:
executor:
<<: *python_executor_small
steps:
- checkout

- codeartifact/init:
tool: pip
- export-uv-auth
- codeartifact/pre_release_version:
package: parquery
output-var-name: RELEASE_VERSION
suffix: rc
- codeartifact/stamp-version:
version-file: pyproject.toml
- run:
name: Install uv
command: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo 'export PATH="$HOME/.cargo/bin:$PATH"' >> $BASH_ENV
source $BASH_ENV
name: Build
command: uv build
- codeartifact/push:
tool: twine

publish-release:
executor:
<<: *python_executor_small
steps:
- checkout
- codeartifact/init:
tool: pip
- when:
condition: << parameters.is-pre-release >>
steps:
- codeartifact/pre_release_version:
package: parquery
- export-uv-auth
- codeartifact/timestamp_version:
version-file: pyproject.toml
output-var-name: RELEASE_VERSION
- codeartifact/stamp-version:
version-file: pyproject.toml
- run:
name: Build
command: |
uv pip install --system build
python -m build
command: uv build
- codeartifact/push:
tool: twine
- codeartifact/create-git-release:
version: $RELEASE_VERSION
release-assets: "dist/*.tar.gz dist/*.whl"

create-release-branch:
executor:
<<: *python_executor_small
steps:
- checkout
- sdlc/create-release-branch

workflows:
version: 2.1
build-and-test:
parquery:
jobs:
- test:
context: codeartifact-dev
name: py311-x86
runtime: "3.11"
resource-class: "medium"
with-coverage: true

- test:
context: codeartifact-dev
name: py311-arm64
runtime: "3.11"
resource-class: "arm.medium"
with-coverage: false
context: [sdlc, codeartifact-dev]

- build-and-push:
context: codeartifact-dev
requires:
- py311-x86
- py311-arm64
# Feature branches: opt-in dev publish
- approve-publish-dev:
type: approval
requires: [test]
filters:
branches:
only:
- master
ignore:
- main
- /release\/.*/
- publish-dev:
context: [sdlc, codeartifact-dev]
requires: [approve-publish-dev]
filters:
branches:
ignore:
- main
- /release\/.*/

# Main: publish RC + approval-gated release-branch creation
- publish-rc:
context: [sdlc, codeartifact-dev]
requires: [test]
filters:
branches:
only: main
- approve-create-release-branch:
type: approval
requires: [publish-rc]
filters:
branches:
only: main
- create-release-branch:
context: [sdlc, codeartifact-dev]
requires: [approve-create-release-branch]
filters:
branches:
only: main

- build-and-push:
context: codeartifact-dev
requires:
- py311-x86
- py311-arm64
is-pre-release: true
# Release branches: publish final + create GitHub release
- publish-release:
context: [sdlc, codeartifact-dev]
requires: [test]
filters:
branches:
only:
- uat
only: /release\/.*/
12 changes: 12 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[run]
relative_files = True
branch = True
source =
parquery

[report]
show_missing = True
exclude_lines =
pragma: no cover
if __name__ == .__main__
^\s*pass\s*$
47 changes: 47 additions & 0 deletions .github/workflows/pr-jira-footer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Add JIRA footer to PR description

on:
pull_request:
types: [opened, edited]

permissions:
pull-requests: write

jobs:
add-jira-footer:
runs-on: ubuntu-latest
steps:
- name: Extract JIRA ID and update PR description
uses: actions/github-script@v7
with:
script: |
const pr = context.payload.pull_request;
const title = pr.title;
const body = pr.body || '';

const jiraPattern = /[A-Z]{2,}-[0-9]+/;
const match = title.match(jiraPattern) || pr.head.ref.match(jiraPattern);

if (!match) {
core.info('No JIRA ID found in PR title or branch name — skipping');
return;
}

const jiraId = match[0];
const footer = `---\njira: ${jiraId}`;

if (body.includes(`jira: ${jiraId}`)) {
core.info(`JIRA footer already present: ${jiraId}`);
return;
}

const updatedBody = body.trimEnd() + '\n\n' + footer;

await github.rest.pulls.update({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pr.number,
body: updatedBody
});

core.info(`Added JIRA footer: jira: ${jiraId}`);
8 changes: 8 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: Validate
on:
pull_request:
types: [opened, edited, synchronize, reopened]

jobs:
validate:
uses: visualfabriq/.github/.github/workflows/validate-pr.yml@main
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,3 @@ bench-data.bcolz

# Claude Code documentation (private)
CLAUDE.md
uv.lock
Loading
Loading