Skip to content
This repository has been archived by the owner on Jun 12, 2024. It is now read-only.

feat: add network types #74

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "Valtypes",
"image": "mcr.microsoft.com/devcontainers/python:0-3.11",
"features": {
"ghcr.io/devcontainers/features/git:1": {},
"ghcr.io/devcontainers-contrib/features/zsh-plugins:0": {
"plugins": [
"zsh-autosuggestions zsh-syntax-highlighting"
],
"omzPlugins": [
"https://github.com/zsh-users/zsh-autosuggestions https://github.com/zsh-users/zsh-syntax-highlighting"
]
},
"ghcr.io/devcontainers-contrib/features/poetry:2": {}
},
"settings": {
"terminal.integrated.shell.*": "zsh"
},
"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"ms-python.isort",
"bungcip.better-toml",
"ryanluker.vscode-coverage-gutters"
]
}
},
"postCreateCommand": ".devcontainer/prepare.sh"
}
2 changes: 2 additions & 0 deletions .devcontainer/prepare.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
poetry install
poetry run pre-commit install
23 changes: 23 additions & 0 deletions .github/workflows/build-dev-container-image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Build Dev Container image

on:
push:
branches: [ main ]

jobs:
build:
name: Build Dev Container image
runs-on: ubuntu-latest
steps:
- name: Login to GHCR
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build
uses: devcontainers/ci@v0.2
with:
imageName: ghcr.io/${{ github.repository }}
cacheFrom: ghcr.io/${{ github.repository }}
push: always
218 changes: 74 additions & 144 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,185 +9,115 @@ on:
jobs:
flake8:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.11' ]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Restore cache and venv
id: cache
- uses: actions/checkout@v3
- name: Restore venv
uses: actions/cache@v3
with:
path: |
~/.cache
.venv
key: ${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}
- name: Install Poetry
if: steps.cache.outputs.cache-hit != 'true'
uses: snok/install-poetry@v1.3.3
key: ${{ hashFiles('poetry.lock') }}
- name: Restore cache
uses: actions/cache@v3
with:
virtualenvs-in-project: true
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: poetry install --with dev
path: |
.mypy_cache
.pytest_cache
key: ${{ github.ref_name }}
- name: Run flake8
run: |
source .venv/bin/activate
pre-commit run --all-files flake8
uses: devcontainers/ci@v0.2
with:
cacheFrom: ghcr.io/${{ github.repository }}
runCmd: poetry run pre-commit run --all-files flake8

# mypy:
# runs-on: ubuntu-latest
# strategy:
# matrix:
# python-version: [ '3.11' ]
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# - name: Setup Python
# uses: actions/setup-python@v4
# with:
# python-version: ${{ matrix.python-version }}
# - name: Restore cache and venv
# id: cache
# uses: actions/cache@v3
# with:
# path: |
# ~/.cache
# .venv
# key: ${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}
# - name: Restore mypy cache
# uses: actions/cache@v3
# with:
# path: .mypy_cache
# key: ${{ matrix.python-version }}
# - name: Install Poetry
# if: steps.cache.outputs.cache-hit != 'true'
# uses: snok/install-poetry@v1.3.3
# with:
# virtualenvs-in-project: true
# - name: Install dependencies
# if: steps.cache.outputs.cache-hit != 'true'
# run: poetry install --with dev
# - name: Run mypy
# run: |
# source .venv/bin/activate
# pre-commit run --all-files mypy
# mypy:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - name: Restore venv
# uses: actions/cache@v3
# with:
# path: |
# .venv
# key: ${{ hashFiles('poetry.lock') }}
# - name: Restore cache
# uses: actions/cache@v3
# with:
# path: |
# .mypy_cache
# .pytest_cache
# key: ${{ github.ref_name }}
# - name: Run mypy
# uses: devcontainers/ci@v0.2
# with:
# cacheFrom: ghcr.io/${{ github.repository }}
# runCmd: poetry run pre-commit run --all-files mypy

pyright:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.11' ]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Restore cache and venv
id: cache
- uses: actions/checkout@v3
- name: Restore venv
uses: actions/cache@v3
with:
path: |
~/.cache
.venv
key: ${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}
- name: Install Poetry
if: steps.cache.outputs.cache-hit != 'true'
uses: snok/install-poetry@v1.3.3
key: ${{ hashFiles('poetry.lock') }}
- name: Restore cache
uses: actions/cache@v3
with:
virtualenvs-in-project: true
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: poetry install --with dev
path: |
.mypy_cache
.pytest_cache
key: ${{ github.ref_name }}
- name: Run pyright
run: |
source .venv/bin/activate
pre-commit run --all-files pyright
uses: devcontainers/ci@v0.2
with:
cacheFrom: ghcr.io/${{ github.repository }}
runCmd: poetry run pre-commit run --all-files pyright

pyright-verify:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.11' ]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Restore cache and venv
id: cache
- uses: actions/checkout@v3
- name: Restore venv
uses: actions/cache@v3
with:
path: |
~/.cache
.venv
key: ${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}
- name: Install Poetry
if: steps.cache.outputs.cache-hit != 'true'
uses: snok/install-poetry@v1.3.3
key: ${{ hashFiles('poetry.lock') }}
- name: Restore cache
uses: actions/cache@v3
with:
virtualenvs-in-project: true
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: poetry install --with dev
path: |
.mypy_cache
.pytest_cache
key: ${{ github.ref_name }}
- name: Run pyright-verify
run: |
source .venv/bin/activate
pre-commit run --all-files pyright-verify
uses: devcontainers/ci@v0.2
with:
cacheFrom: ghcr.io/${{ github.repository }}
runCmd: poetry run pre-commit run --all-files pyright-verify

pytest:
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
python-version: [ '3.11' ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Restore cache and venv
id: cache
- uses: actions/checkout@v3
- name: Restore venv
uses: actions/cache@v3
with:
path: |
~/.cache
.venv
key: ${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}
- name: Restore pytest cache
key: ${{ hashFiles('poetry.lock') }}
- name: Restore cache
uses: actions/cache@v3
with:
path: .pytest_cache
key: pytest-${{ runner.os }}-${{ matrix.python-version }}
- name: Install Poetry
if: steps.cache.outputs.cache-hit != 'true'
uses: snok/install-poetry@v1.3.3
path: |
.mypy_cache
.pytest_cache
key: ${{ github.ref_name }}
- name: Run pytest
uses: devcontainers/ci@v0.2
with:
virtualenvs-in-project: true
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: poetry install --with dev
- name: Run pytest on Windows
if: runner.os == 'Windows'
run: |
source .venv/scripts/activate
pre-commit run --all-files pytest
- name: Run pytest on normal OS
if: runner.os != 'Windows'
run: |
source .venv/bin/activate
pre-commit run --all-files pytest
cacheFrom: ghcr.io/${{ github.repository }}
runCmd: poetry run pre-commit run --all-files pytest
25 changes: 16 additions & 9 deletions .github/workflows/publish-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,25 @@ jobs:
name: Publish release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
- uses: actions/checkout@v3
- name: Restore venv
uses: actions/cache@v3
with:
python-version: '3.11'
- name: Install Poetry
uses: snok/install-poetry@v1.3.3
path: |
.venv
key: ${{ hashFiles('poetry.lock') }}
- name: Restore cache
uses: actions/cache@v3
with:
virtualenvs-create: false
path: |
.mypy_cache
.pytest_cache
key: ${{ github.ref_name }}
- name: Build the package
run: poetry build
uses: devcontainers/ci@v0.2
with:
cacheFrom: ghcr.io/${{ github.repository }}
runCmd: poetry build
- name: Publish the package to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
Expand Down
Loading