Skip to content

docs: update tuner.mdx #12

docs: update tuner.mdx

docs: update tuner.mdx #12

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Nomadic SDK - Build, Test & Publish
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
lint_test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
#----------------------------------------------
# install your root project, if required
#----------------------------------------------
- name: Install project
run: poetry install --no-interaction
#----------------------------------------------
# run lint
#----------------------------------------------
- name: Run lint
run: |
source .venv/bin/activate
make lint
#----------------------------------------------
# run unit test suite
#----------------------------------------------
- name: Run unit tests & coverage
run: |
source .venv/bin/activate
make unit-test
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
#----------------------------------------------
# run integration test suite
#----------------------------------------------
- name: Run integration tests & coverage
run: |
source .venv/bin/activate
make integration-test
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
build_wheel:
runs-on: ubuntu-latest
needs: lint_test
steps:
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
#----------------------------------------------
# install your root project, if required
#----------------------------------------------
- name: Install project
run: poetry install --no-interaction
#----------------------------------------------
# build wheel
#----------------------------------------------
- name: Build wheel
run: |
source .venv/bin/activate
make build
- name: Get short SHA
id: vars
run: echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
#----------------------------------------------
# upload wheel
#----------------------------------------------
- name: Upload wheel as artifact
uses: actions/upload-artifact@v4
with:
name: nomadic-0.0.1-py3-none-any-${{ env.short_sha }}.whl
path: dist/*.whl
if-no-files-found: warn