Skip to content
Merged
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
14 changes: 14 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
day: "friday"

- package-ecosystem: "uv"
directory: "/"
schedule:
interval: "weekly"
day: "friday"
36 changes: 36 additions & 0 deletions .github/workflows/code_style.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Lint and Format

on:
push:
branches: [ master ]

pull_request:
branches: [ master ]
paths: [ '**/*.py' ]

workflow_dispatch:

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

jobs:
python-format:
name: Ruff Lint and Format
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v6

- name: Setup Ruff
uses: astral-sh/ruff-action@v3
with:
args: --version

- name: Enforce Lint
run: ruff check ad

- name: Enforce Format
run: |
ruff format --diff ad

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
Comment on lines +19 to +36
99 changes: 99 additions & 0 deletions .github/workflows/code_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: Code Test

on:
push:
branches: [ master ]

pull_request:
branches: [ master ]

schedule:
- cron: "0 0 * * 0" # Runs every Sunday at midnight UTC

workflow_dispatch:
workflow_call:
outputs:
artifact_name:
value: ${{ jobs.fresh_build.outputs.artifact_name }}
artifact_run_id:
value: ${{ jobs.fresh_build.outputs.run_id }}

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

jobs:

setup:
runs-on: ubuntu-latest

steps:
- name: Fetch Supported Python
id: fetch-versions
run: |
versions=$(curl -fsSL https://endoflife.date/api/v1/products/python/ \
| jq '[ .result.releases[] | select(.isEol == false) | .label ]')

echo "supported_versions=$(echo $versions |jq -c '.')" >> $GITHUB_OUTPUT
echo "bound_versions=$(echo $versions |jq -c '[.[0],.[-1]]')" >> $GITHUB_OUTPUT

outputs:
supported_versions: ${{ steps.fetch-versions.outputs.supported_versions }}
bound_versions: ${{ steps.fetch-versions.outputs.bound_versions }}

fresh_build:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}
Comment on lines +28 to +44
uses: ./.github/workflows/dist_build.yml

testing:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}
Comment on lines +45 to +47
runs-on: ${{ matrix.os }}

permissions:
id-token: write # for working of oidc of codecov

strategy:
matrix:
os: [ ubuntu-latest ]
py-version: ${{ fromJson(needs.setup.outputs.supported_versions) }}
include:
- os: windows-latest
py-version: ${{ fromJson(needs.setup.outputs.bound_versions)[0] }}
- os: windows-latest
py-version: ${{ fromJson(needs.setup.outputs.bound_versions)[1] }}
- os: macos-latest
py-version: ${{ fromJson(needs.setup.outputs.bound_versions)[0] }}
- os: macos-latest
py-version: ${{ fromJson(needs.setup.outputs.bound_versions)[1] }}

needs:
- fresh_build
- setup

steps:
- uses: actions/checkout@v6

- name: Download Build Artifacts
uses: actions/download-artifact@v8
with:
name: ${{ needs.fresh_build.outputs.artifact_name }}
run-id: ${{ needs.fresh_build.outputs.run_id }}
path: ./dist

- uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.py-version }}

- name: Install Packages
shell: bash
run: |
uv sync --no-dev --group test
uv pip install -v ./dist/*.whl

- name: Run Tests
run: uv run --no-sync pytest -v -n auto --cov --cov-report=xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v6
with:
fail_ci_if_error: true
use_oidc: true
verbose: true
101 changes: 101 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL Advanced"

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
schedule:
- cron: '33 5 * * 2'

jobs:
analyze:
name: Analyze (${{ matrix.language }})
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners (GitHub.com only)
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
permissions:
# required for all workflows
security-events: write

# required to fetch internal or private CodeQL packs
packages: read

# only required for workflows in private repositories
actions: read
contents: read

strategy:
fail-fast: false
matrix:
include:
- language: actions
build-mode: none
- language: python
build-mode: none
# CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'rust', 'swift'
# Use `c-cpp` to analyze code written in C, C++ or both
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
steps:
- name: Checkout repository
uses: actions/checkout@v6

# Add any setup steps before running the `github/codeql-action/init` action.
# This includes steps like installing compilers or runtimes (`actions/setup-node`
# or others). This is typically only required for manual builds.
# - name: Setup runtime (example)
# uses: actions/setup-example@v1

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v4
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality

# If the analyze step fails for one of the languages you are analyzing with
# "We were unable to automatically build your code", modify the matrix above
# to set the build mode to "manual" for that language. Then modify this step
# to build your code.
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
- name: Run manual build steps
if: matrix.build-mode == 'manual'
shell: bash
run: |
echo 'If you are using a "manual" build mode for one or more of the' \
'languages you are analyzing, replace this with the commands to build' \
'your code, for example:'
echo ' make bootstrap'
echo ' make release'
exit 1

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4
with:
category: "/language:${{matrix.language}}"
40 changes: 40 additions & 0 deletions .github/workflows/dist_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build Distribution

on:
workflow_call:
outputs:
artifact_name:
value: ${{ jobs.build.outputs.artifact_name }}
run_id:
value: ${{ github.run_id }}

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Setup uv
uses: astral-sh/setup-uv@v7

- name: Build distribution
run: uv build -v --clear .

- name: Set Artifact Name
id: artifact-name
run: |
echo "artifact_name=${{ github.run_id }}[${{ github.run_attempt }}]--build-artifacts" \
| tee -a $GITHUB_OUTPUT

- name: Upload Build Artifacts
uses: actions/upload-artifact@v7
with:
name: ${{ steps.artifact-name.outputs.artifact_name }}
path: dist
if-no-files-found: error

outputs:
artifact_name: ${{ steps.artifact-name.outputs.artifact_name }}

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
Comment on lines +13 to +40
52 changes: 52 additions & 0 deletions .github/workflows/docs_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Build Documentation
permissions:
pages: write
id-token: write

on:
pull_request:
branches: [ master ]
workflow_call:
inputs: &build-docs-inputs
deploy:
type: boolean
required: false
default: false

workflow_dispatch:
inputs: *build-docs-inputs

concurrency:
group: docs-build

jobs:

build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v6

- name: Setup uv
uses: astral-sh/setup-uv@v7

- name: Build Documentation
run: uv run --no-dev --group docs zensical build --clean --strict

- name: Set Artifact Name
id: artifact-name
run: |
echo "artifact_name=${{ github.run_id }}[${{ github.run_attempt }}]--docs-artifacts" \
| tee -a $GITHUB_OUTPUT

- name: Upload Pages Artifacts
uses: actions/upload-pages-artifact@v5
with:
name: ${{ steps.artifact-name.outputs.artifact_name }}
path: site/

- name: Deploy to GitHub Pages
if: ${{ inputs.deploy }}
uses: actions/deploy-pages@v5
with:
artifact_name: ${{ steps.artifact-name.outputs.artifact_name }}
Loading
Loading