Skip to content

Add Polymarket fee commission tests and update py-clob-client #1526

Add Polymarket fee commission tests and update py-clob-client

Add Polymarket fee commission tests and update py-clob-client #1526

Workflow file for this run

name: build-v2
# Build & publish wheels for the *v2* Python package living under the
# `python/` directory. These wheels are uploaded to the dedicated
# v2 package index at:
# https://packages.nautechsystems.io/v2/simple/nautilus-trader/
permissions:
contents: read
actions: read
on:
push:
branches:
- test-ci
- develop
- nightly
env:
PACKAGE_DIR: python
jobs:
pre-commit:
runs-on: ubuntu-22.04 # glibc 2.35 – larger runtime range
steps:
- uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
with:
egress-policy: audit
- name: Checkout repository
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
persist-credentials: false
- name: Common setup
uses: ./.github/actions/common-setup
with:
python-version: "3.13"
free-disk-space: "true"
build-type: "pre-commit"
- name: Run pre-commit
run: pre-commit run --all-files
# Dependency license, advisory, and ban checks
# https://embarkstudios.github.io/cargo-deny/
cargo-deny:
runs-on: ubuntu-22.04
steps:
# https://github.com/step-security/harden-runner
- uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
with:
egress-policy: audit
- name: Checkout repository
# https://github.com/actions/checkout
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
persist-credentials: false
- name: Install cargo-deny
uses: ./.github/actions/cargo-tool-install
with:
tool-name: cargo-deny
- name: Run cargo-deny (advisories, licenses, sources, bans)
run: cargo deny --all-features check advisories licenses sources bans
# Supply chain security auditing
# https://mozilla.github.io/cargo-vet/configuring-ci.html
cargo-vet:
runs-on: ubuntu-22.04
steps:
# https://github.com/step-security/harden-runner
- uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
with:
egress-policy: audit
- name: Checkout repository
# https://github.com/actions/checkout
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
persist-credentials: false
- name: Install cargo-vet
uses: ./.github/actions/cargo-tool-install
with:
tool-name: cargo-vet
- name: Run cargo-vet
run: cargo vet --locked
build:
needs:
- cargo-deny
- cargo-vet
- pre-commit
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04]
python-version:
- "3.12"
- "3.13"
- "3.14"
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
env:
BUILD_MODE: release
RUST_BACKTRACE: 1
# yamllint disable rule:line-length
services:
redis:
image: public.ecr.aws/docker/library/redis:7.4.5-alpine3.21@sha256:bb186d083732f669da90be8b0f975a37812b15e913465bb14d845db72a4e3e08
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
postgres:
image: public.ecr.aws/docker/library/postgres:16.4-alpine@sha256:5660c2cbfea50c7a9127d17dc4e48543eedd3d7a41a595a2dfa572471e37e64c
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: pass
POSTGRES_DB: nautilus
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
# yamllint enable rule:line-length
steps:
- uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
with:
egress-policy: audit
- name: Checkout repository
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
persist-credentials: false
- name: Common setup
uses: ./.github/actions/common-setup
with:
python-version: ${{ matrix.python-version }}
free-disk-space: "true"
- name: Install Nautilus CLI
env:
NAUTILUS_CLI_FORCE_SOURCE: ${{ github.ref == 'refs/heads/nightly' && '1' || '0' }}
run: bash scripts/ci/install-nautilus-cli.sh
- name: Init postgres schema
run: nautilus database init --schema ${{ github.workspace }}/schema/sql
env:
POSTGRES_HOST: localhost
POSTGRES_PORT: 5432
POSTGRES_USERNAME: postgres
POSTGRES_PASSWORD: pass
POSTGRES_DATABASE: nautilus
- name: Cached test data
uses: ./.github/actions/common-test-data
- name: Run Rust tests
run: make cargo-test HYPERSYNC=true
# Update version for dev/nightly branches
- name: Update version in pyproject.toml
if: ${{ github.ref != 'refs/heads/master' }}
working-directory: ${{ env.PACKAGE_DIR }}
run: |
bash ../scripts/ci/update-pyproject-version.sh
# Build the wheel for v2 under python/ using maturin
- name: Build wheel (v2)
working-directory: ${{ env.PACKAGE_DIR }}
run: |
pip install --upgrade maturin
maturin build --release --out ../dist
- name: Upload wheel artifact
uses: ./.github/actions/upload-artifact-wheel
publish:
needs:
- build
runs-on: ubuntu-latest
# Only publish from mainline branches, never from test branches
if: >
github.ref_name == 'develop' ||
github.ref_name == 'nightly' ||
github.ref_name == 'master'
environment: r2-${{ github.ref_name }}
permissions:
actions: write # Required for deleting artifacts
contents: read
id-token: write # Required for attestations
attestations: write # Required for attestations
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
CLOUDFLARE_R2_URL: ${{ secrets.CLOUDFLARE_R2_URL }}
CLOUDFLARE_R2_REGION: "auto"
CLOUDFLARE_R2_BUCKET_NAME: "packages"
CLOUDFLARE_R2_PREFIX: "v2/simple/nautilus-trader"
steps:
- uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
with:
egress-policy: audit
allowed-endpoints: |
${{ vars.COMMON_ALLOWED_ENDPOINTS }}
${{ secrets.CLOUDFLARE_R2_ALLOWED_HOST }}:443
- name: Checkout repository
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
persist-credentials: false
- name: Download built wheels
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
with:
path: dist
pattern: "*.whl"
merge-multiple: true
# https://github.com/actions/attest-build-provenance
- name: Attest wheel provenance
uses: actions/attest-build-provenance@46a583fd92dfbf46b772907a9740f888f4324bb9 # v3.1.0
with:
subject-path: 'dist/*.whl'
- name: Publish wheels to Cloudflare R2 (v2 bucket)
uses: ./.github/actions/publish-wheels
- name: Fetch and delete artifacts for current run
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
bash ./scripts/ci/publish-wheels-delete-artifacts.sh