feat: refactor SDK types #600
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Checks | |
on: | |
push: | |
branches: | |
- master | |
- development | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
# ---------------------------------------------------------- # | |
# ...................LINT-FORMAT-TYPECHECK.................. # | |
# ---------------------------------------------------------- # | |
lint-format-typecheck: | |
name: Lint - Format - Typecheck | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install poetry | |
run: | | |
python -m pip install --upgrade pip | |
pip install poetry | |
poetry config installer.modern-installation false | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
cache: 'poetry' | |
- name: Install dependencies | |
run: | | |
poetry install | |
- name: Check poetry.lock | |
run: | | |
poetry lock --check | |
- name: Lint | |
run: | | |
poetry run poe lint | |
- name: Format | |
run: | | |
poetry run poe format_check | |
- name: Typecheck | |
run: | | |
poetry run poe typecheck | |
# ---------------------------------------------------------- # | |
# .........................TESTS............................ # | |
# ---------------------------------------------------------- # | |
tests: | |
name: Run Tests | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [ "3.11" ] | |
steps: | |
# ====================== SETUP ====================== # | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'true' | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
cache: 'pip' | |
- name: Install poetry | |
run: | | |
python -m pip install --upgrade pip | |
pip install poetry | |
poetry config installer.modern-installation false | |
- name: Install python 3.11 requirements | |
run: | | |
poetry export -f requirements.txt --without-hashes --output requirements.txt | |
pip install -r requirements.txt | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'poetry' | |
- name: Install dependencies | |
run: | | |
poetry install | |
# ====================== CONTRACTS v1 ====================== # | |
- name: Cache contracts | |
id: cache-contracts | |
uses: actions/cache@v3 | |
with: | |
path: ./pragma-oracle/target | |
key: ${{ runner.os }}-contracts-${{ hashFiles('./pragma-oracle/src', 'poetry.lock') }} | |
- uses: software-mansion/setup-scarb@v1 | |
with: | |
tool-versions: pragma-oracle/.tool-versions | |
- name: Compile contracts | |
if: steps.cache-contracts.outputs.cache-hit != 'true' | |
working-directory: ./pragma-oracle | |
run: | | |
scarb -V | |
scarb build | |
- name: Check ABIs are up-to-date | |
run: | | |
# Find and compare *.sierra.json files in both directories | |
for file in $(find ./pragma-oracle/target/dev -type f -name "*.sierra.json"); do | |
# Extract the relative path of the file for comparison | |
rel_path=${file#./pragma-oracle/target/dev} | |
# Use diff to compare the file with its counterpart in the SDK directory | |
diff "$file" "pragma/core/abis$rel_path" || (echo "Error: $rel_path in pragma-oracle/target does not match with pragma/core/abis/" && exit 1) | |
done | |
# ====================== CAIRO SETUP ====================== # | |
- name: Install rust | |
run: | | |
curl https://sh.rustup.rs -sSf | sh -s -- -y | |
source $HOME/.cargo/env | |
- name: Verify Rust and Cargo installation | |
run: | | |
rustc --version | |
cargo --version | |
- name: Install starknet-devnet | |
run: cargo install starknet-devnet | |
# ====================== RUN TESTS ====================== # | |
- name: Check circular imports | |
run: | | |
poetry run poe circular_imports_check | |
- name: Run tests | |
env: | |
KAIKO_API_KEY: ${{ secrets.KAIKO_API_KEY }} | |
NETWORK_FORK: mainnet | |
TESTNET_ACCOUNT_ADDRESS: ${{ secrets.TESTNET_ACCOUNT_ADDRESS }} | |
TESTNET_PRIVATE_KEY: ${{ secrets.TESTNET_PRIVATE_KEY }} | |
run: | | |
poetry run poe test_ci_update_client | |
poetry run poe test_ci_client | |
# poetry run poe test_ci_fetchers | |
poetry run poe test_ci_publisher | |
poetry run poe test_ci_vrf | |
poetry run poe test_ci_api_client | |
- name: Generate coverage in XML | |
run: | | |
poetry run coverage xml | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |