Skip to content

Commit

Permalink
add codegen (contracts, subgraph), order signing and order book API i…
Browse files Browse the repository at this point in the history
…nterface
  • Loading branch information
ribeirojose committed Apr 25, 2024
1 parent bfc594f commit 82433b2
Show file tree
Hide file tree
Showing 92 changed files with 8,706 additions and 2,984 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
USER_ADDRESS=
PRIVATE_KEY=
86 changes: 86 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
---
name: CI
on:
workflow_dispatch:
pull_request:
push:
branches: main
release:
types: [released]

jobs:
ci:
runs-on: ubuntu-22.04
strategy:
matrix:
python-version: [
"3.10", "3.11", "3.12",
]
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Install Poetry
run: |
pipx install poetry
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: poetry
cache-dependency-path: poetry.lock

- name: Poetry lock
run: |
poetry lock
- name: Install dependencies
run: |
poetry install
- name: Typecheck
run: |
poetry run pyright .
- name: Lint
run: |
poetry run ruff check .
- name: Test
run: |
poetry run pytest tests/
- name: Build sdist
run: |
poetry build -f sdist
- name: Archive production artifacts
uses: actions/upload-artifact@v2
with:
name: wheels
path: |
dist
- name: Display structure of downloaded files
run: |
ls -R
working-directory: ./

- run: |
poetry config repositories.testpypi https://test.pypi.org/legacy/
- run: |
poetry config pypi-token.testpypi ${{ secrets.TEST_PYPI_TOKEN }}
- name: Publish package (test)
run: |
poetry publish --no-interaction --dry-run -r testpypi -vvv
- if: github.event_name == 'release'
run: poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}

- name: Publish package (prod)
if: github.event_name == 'release'
run: |
poetry publish --no-interaction -vvv
19 changes: 0 additions & 19 deletions .github/workflows/ci_core.yml

This file was deleted.

64 changes: 0 additions & 64 deletions .github/workflows/python_reusable.yml

This file was deleted.

54 changes: 0 additions & 54 deletions .github/workflows/top_level.yml

This file was deleted.

10 changes: 10 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.3.7
hooks:
# Run the linter.
- id: ruff
args: [--fix]
# Run the formatter.
- id: ruff-format
8 changes: 8 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This is a comment.
# Each line is a file pattern followed by one or more owners.

# These owners will be the default owners for everything in
# the repo. Unless a later match takes precedence,
# @global-owner1 and @global-owner2 will be requested for
# review when someone opens a pull request.
* @mfw78
27 changes: 27 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.PHONY: codegen web3_codegen orderbook_codegen subgraph_codegen test lint format remove_unused_imports

codegen: web3_codegen orderbook_codegen subgraph_codegen

# web3_codegen:
# poetry run web3_codegen

orderbook_codegen:
poetry run datamodel-codegen --url="https://raw.githubusercontent.com/cowprotocol/services/v2.245.1/crates/orderbook/openapi.yml" --output cow_py/order_book/generated/model.py --target-python-version 3.12 --output-model-type pydantic_v2.BaseModel --input-file-type openapi

subgraph_codegen:
poetry run ariadne-codegen

test:
poetry run pytest -s

lint:
poetry run ruff check . --fix

format: remove_unused_imports
poetry run ruff format

remove_unused_imports:
poetry run pycln --all .

typecheck:
poetry run pyright
Loading

0 comments on commit 82433b2

Please sign in to comment.