Skip to content

Commit

Permalink
Merge pull request #101 from storyprotocol/origin/bpolania/python-wor…
Browse files Browse the repository at this point in the history
…kflow

Origin/bpolania/python workflow
  • Loading branch information
bpolania authored Dec 25, 2024
2 parents d6ee6e0 + 5645da7 commit ddb162c
Show file tree
Hide file tree
Showing 2 changed files with 112 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Build and Test

on:
workflow_call:
inputs:
sha:
required: true
type: string
ENVIRONMENT:
required: true
type: string
secrets:
WALLET_PRIVATE_KEY:
required: true
RPC_PROVIDER_URL:
required: true

jobs:
build_and_test:
name: Build and Test
timeout-minutes: 60
runs-on: ubuntu-latest
environment: ${{ inputs.ENVIRONMENT }}
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11"]
env:
WALLET_PRIVATE_KEY: ${{ secrets.WALLET_PRIVATE_KEY }}
RPC_PROVIDER_URL: ${{ secrets.RPC_PROVIDER_URL }}

steps:
- name: Check out code
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
with:
ref: ${{ inputs.sha }}

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip' # Caches pip dependencies

- name: Install dependencies
run: |
python -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
pip install -r requirements.txt || exit `
pip install pytest pytest-cov # Common testing packages
shell: bash

- name: Run integration tests
run: |
source .venv/bin/activate
pytest tests/integration/ --cov=./ --cov-report=xml
56 changes: 56 additions & 0 deletions .github/workflows/reusable-build-python-unit-test-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Build and Test

on:
workflow_call:
inputs:
sha:
required: true
type: string
ENVIRONMENT:
required: true
type: string
secrets:
WALLET_PRIVATE_KEY:
required: true
RPC_PROVIDER_URL:
required: true

jobs:
build_and_test:
name: Build and Test
timeout-minutes: 60
runs-on: ubuntu-latest
environment: ${{ inputs.ENVIRONMENT }}
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11"]
env:
WALLET_PRIVATE_KEY: ${{ secrets.WALLET_PRIVATE_KEY }}
RPC_PROVIDER_URL: ${{ secrets.RPC_PROVIDER_URL }}

steps:
- name: Check out code
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
with:
ref: ${{ inputs.sha }}

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip' # Caches pip dependencies

- name: Install dependencies
run: |
python -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
pip install -r requirements.txt || exit 1
pip install pytest pytest-cov # Common testing packages
shell: bash

- name: Run Unit tests
run: |
source .venv/bin/activate
pytest tests/unit/ --cov=./ --cov-report=xml

0 comments on commit ddb162c

Please sign in to comment.