Skip to content

Fix mypy issues in CI #63

Fix mypy issues in CI

Fix mypy issues in CI #63

Workflow file for this run

name: Build
on: [push, pull_request]
jobs:
######################################
# JOB
# Linting
######################################
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install poetry
run: pipx install poetry==1.2.2
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: 3.9
cache: poetry
- name: Poetry dependencies
run: |
poetry self add "poetry-dynamic-versioning[plugin]"
poetry install --all-extras
- name: Ruff
run: poetry run ruff check --output-format=github
- name: MyPy
run: poetry run mypy striker
######################################
# JOB
# Build & Upload Test PyPI
######################################
upload_test_pypi:
name: Test PyPI
runs-on: ubuntu-latest
needs: [lint]
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/heads/master')
env:
TESTPYPI: 1
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install poetry
run: pipx install poetry==1.2.2
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: 3.9
cache: poetry
- name: Poetry dependencies
run: |
poetry self add "poetry-dynamic-versioning[plugin]"
poetry install --all-extras
- name: Build wheel
run: poetry build
- name: Upload PyPI
env:
TEST_PYPI_TOKEN: ${{ secrets.PYPI_TEST_API_TOKEN }}
run: |
poetry config repositories.test https://test.pypi.org/legacy/
poetry config pypi-token.test $TEST_PYPI_TOKEN
poetry publish -r test
######################################
# JOB
# Build & Upload PyPI
######################################
upload_pypi:
name: PyPI
runs-on: ubuntu-latest
needs: [lint]
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install poetry
run: pipx install poetry==1.2.2
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: 3.9
cache: poetry
- name: Poetry dependencies
run: |
poetry self add "poetry-dynamic-versioning[plugin]"
poetry install --all-extras
- name: Build wheel
run: poetry build
- name: Upload PyPI
env:
PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
run: |
poetry config pypi-token.pypi $PYPI_TOKEN
poetry publish
######################################
# JOB
# Test PyPi installation
######################################
test_installation:
name: Test Wheel
runs-on: ${{ matrix.os }}
needs: [upload_test_pypi]
strategy:
fail-fast: false
matrix:
# We are not testing on windows & MAC, because the pytorch has no wheels for these OSes on 3.11
# os: [ubuntu-latest, windows-latest, macos-latest]
os: [ubuntu-latest]
python: ["3.9", "3.10", "3.11"]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install package
run: |
python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple striker
- name: Run package
run: |
python -c "import striker; print(f'Striker Version {striker.__version__}')"