Skip to content
Merged
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
65 changes: 65 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: CI

on:
push:
branches: [ main ]
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@v6

- name: Resolve QuantPlatformKit ref
id: quant-platform-kit-ref
run: |
set -euo pipefail
ref="main"
if [ -n "${GITHUB_HEAD_REF:-}" ]; then
case "${GITHUB_HEAD_REF}" in
dependabot/*)
;;
*)
if git ls-remote --exit-code --heads https://github.com/QuantStrategyLab/QuantPlatformKit.git "${GITHUB_HEAD_REF}" >/dev/null 2>&1; then
ref="${GITHUB_HEAD_REF}"
fi
;;
esac
fi
echo "ref=${ref}" >> "$GITHUB_OUTPUT"

- name: Checkout QuantPlatformKit
uses: actions/checkout@v6
with:
repository: QuantStrategyLab/QuantPlatformKit
ref: ${{ steps.quant-platform-kit-ref.outputs.ref }}
path: external/QuantPlatformKit

- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: "3.11"

- name: Install dependencies
run: |
set -euo pipefail
python -m pip install --upgrade pip
python -m pip install -e . pandas pytest ruff
python -m pip install --no-deps -e external/QuantPlatformKit

- name: Run Ruff
run: |
set -euo pipefail
ruff check .

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Limit Ruff to this repository

I checked python -m ruff check --help, which says ruff check [FILES] runs on the given files or directories and defaults to .. Because this workflow checks out QuantPlatformKit under external/QuantPlatformKit before this step, ruff check . will also lint that external repository; any lint/config change there can fail HkEquityStrategies CI even when this repo's code is fine. Scope Ruff to the local paths, or exclude external/.

Useful? React with 👍 / 👎.


- name: Run unit tests
run: |
set -euo pipefail
PYTHONPATH=src python -m pytest -q tests