Skip to content

Commit

Permalink
Merge pull request #75 from foundryservices/staging
Browse files Browse the repository at this point in the history
Release v3.0.0
  • Loading branch information
hayden-yuma authored Jan 10, 2025
2 parents 4834165 + 51326e6 commit 3f49745
Show file tree
Hide file tree
Showing 82 changed files with 7,831 additions and 2,296 deletions.
161 changes: 0 additions & 161 deletions .circleci/config.yml

This file was deleted.

Empty file removed .dependencies_installed
Empty file.
10 changes: 8 additions & 2 deletions .env.template
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# Copy the contents on this file to a new file called .env
WANDB_API_KEY='REPLACE_WITH_WANDB_API_KEY'
MINER_HF_ACCESS_TOKEN='REPLACE_WITH_HUGGINGFACE_ACCESS_KEY'
HF_ACCESS_TOKEN='REPLACE_WITH_HUGGINGFACE_ACCESS_KEY'

HF_ACCESS_TOKEN = 'REPLACE_WITH_HUGGINGFACE_ACCESS_KEY'
WANDB_API_KEY = 'REPLACE_WITH_WANDB_API_KEY'
# Git credentials
GIT_TOKEN='REPLACE_WITH_GIT_TOKEN'
GIT_USERNAME='REPLACE_WITH_GIT_USERNAME'
GIT_NAME="REPLACE_WITH_GIT_NAME"
GIT_EMAIL="REPLACE_WITH_GIT_EMAIL"
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ exclude =
scripts,
.venv
max-complexity = 10
max-line-length = 79
max-line-length = 120
per-file-ignores = __init__.py:F401
67 changes: 42 additions & 25 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Cache and Load Build
name: Cache Build

on:
workflow_call:
Expand All @@ -17,7 +17,7 @@ jobs:
steps:

#------------------------------------------------
# Checkout repo and setup python
# check-out repo and set-up python
#------------------------------------------------
- name: Check out repository
uses: actions/checkout@v4
Expand All @@ -27,41 +27,58 @@ jobs:
python-version: '3.11'

#------------------------------------------------
# Load cached venv if cache exists
# ----- install & configure poetry -----
#------------------------------------------------
- name: Restore cached virtualenv
uses: actions/cache/restore@v4
id: restore-cache
- name: Load cached Poetry installation
id: cached-poetry
uses: actions/cache@v4
with:
path: ~/.local # the path depends on the OS
key: poetry-0 # increment to reset cache

- name: Install Poetry
if: steps.cached-poetry.outputs.cache-hit != 'true'
uses: snok/install-poetry@v1
with:
version: latest
virtualenvs-create: true
virtualenvs-in-project: true
virtualenvs-path: .venv
installer-parallel: true

# If cache was loaded, we must redo configuration
- name: Configure poetry
if: steps.cached-poetry.outputs.cache-hit == 'true'
run: |
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
poetry config virtualenvs.path .venv
#------------------------------------------------
# Load cached venv if exists
#------------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
key: venv-${{ runner.os }}-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('dev_requirements.txt') }}
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}

#------------------------------------------------
# Install dependencies - if cache does not exist
# Install dependencies if cache does not exist
#------------------------------------------------
- name: Install dependencies
if: steps.restore-cache.outputs.cache-hit != 'true'
run: |
python -m venv .venv
source .venv/bin/activate
python -m pip install .[DEV]
echo "$VIRTUAL_ENV/bin" >> $GITHUB_PATH
echo "VIRTUAL_ENV=$VIRTUAL_ENV" >> $GITHUB_ENV
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root

#------------------------------------------------
# Save venv to cache - if not exists
# Install your root project
#------------------------------------------------
- name: Saved cached virtualenv
if: steps.restore-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
key: ${{ steps.restore-cache.outputs.cache-primary-key }}
path: .venv
- name: Install project
run: poetry install --no-interaction

#------------------------------------------------
# Run custom command(s) within venv
#------------------------------------------------
- name: Run commands
run: |
source .venv/bin/activate
${{ inputs.command }}
run: ${{ inputs.command }}
24 changes: 12 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Continuous Integration
name: CI

on:
pull_request:
push:
branches: [main, dev]
branches: [main, staging, dev]

jobs:
#----------------------------------------------
Expand All @@ -15,9 +15,10 @@ jobs:
with:
name: Cache
command: |
python -m pip list
python --version
echo "Build successful"
poetry run python -m pip list
poetry run python --version
poetry --version
poetry run echo "Build successful"
#----------------------------------------------
# Run Linters
Expand All @@ -28,29 +29,29 @@ jobs:
uses: ./.github/workflows/build.yml
with:
name: Black
command: python -m black --check .
command: poetry run python -m black --check .
lint-isort:
name: Linter
needs: build
uses: ./.github/workflows/build.yml
with:
name: Isort
command: python -m isort --check-only .
command: poetry run python -m isort --check-only .
lint-mypy:
name: Linter
needs: build
if: false # This condition ensures the job is never executed
uses: ./.github/workflows/build.yml
with:
name: Mypy
command: python -m mypy --verbose 0 .
command: poetry run python -m mypy --verbose 0 .
lint-flake8:
name: Linter
needs: build
uses: ./.github/workflows/build.yml
with:
name: Flake8
command: python -m flake8 .
command: poetry run python -m flake8 .

#----------------------------------------------
# Run Tests
Expand All @@ -63,9 +64,8 @@ jobs:
lint-mypy,
lint-flake8,
]
# `${{ always() }}` will run the tests regardless of linting success
if: false # This condition ensures the job is never executed
if: ${{ always() }} # will run the tests regardless of linting success
uses: ./.github/workflows/build.yml
with:
name: Unittests
command: pytest tests/
command: poetry run pytest tests/
10 changes: 8 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.python-version

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down Expand Up @@ -130,6 +128,8 @@ venv/
ENV/
env.bak/
venv.bak/
# branch specific environments that start with issue number
.[0-9]*-*

# Spyder project settings
.spyderproject
Expand Down Expand Up @@ -164,3 +164,9 @@ cython_debug/

testing/
timestamp.txt

# localnet config
miner.config.local.js
validator.config.local.js

local_data/
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.11
Loading

0 comments on commit 3f49745

Please sign in to comment.