Skip to content
name: 🚨🚀 Lint and upload source distribution
on:
push:
paths-ignore:
- "**.md"
branches:
- "long_lived/**"
- main
- "release/**"
release:
types: [published]
pull_request:
paths-ignore:
- "**.md"
branches:
- "**"
concurrency:
group: ${{ github.event_name == 'pull_request' && format('{0}-{1}', github.workflow_ref, github.event.pull_request.number) || github.run_id }}
cancel-in-progress: true
permissions:
contents: read
id-token: write
jobs:
mypy:
name: ${{ matrix.os.emoji }} ${{ matrix.arch.emoji }} ${{ matrix.check.name }} - ${{ matrix.os.name }} ${{ matrix.python.major_dot_minor }}
runs-on: ${{ matrix.os.runs-on[matrix.arch.matrix] }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
os:
- name: Linux
matrix: linux
emoji: 🐧
runs-on:
intel: ubuntu-latest
arm: [linux, arm64]
- name: macOS
matrix: macos
emoji: 🍎
runs-on:
intel: macos-13
arm: macos-13-arm64
- name: Windows
matrix: windows
emoji: 🪟
runs-on:
intel: windows-latest
arch:
- name: ARM64
emoji: 💪
matrix: arm
- name: Intel
emoji: 🌀
matrix: intel
python:
- major_dot_minor: "3.9"
- major_dot_minor: "3.10"
- major_dot_minor: "3.11"
- major_dot_minor: "3.12"
check:
- name: mypy
command: |
echo "MYPY VERSION IS: $(mypy --version)"
python manage-mypy.py build-mypy-ini
mypy
exclude:
- os:
matrix: windows
arch:
matrix: arm
steps:
- uses: chia-network/actions/clean-workspace@main
- name: Add safe git directory
uses: chia-network/actions/git-mark-workspace-safe@main
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- uses: chia-network/actions/setup-python@main
with:
python-version: ${{ matrix.python.major_dot_minor }}
- uses: ./.github/actions/install
with:
python-version: ${{ matrix.python.major_dot_minor }}
development: true
- uses: chia-network/actions/activate-venv@main
- name: Check with ${{ matrix.check.name }}
run: |
${{ matrix.check.command }}
check:
name: ${{ matrix.os.emoji }} ${{ matrix.check.name }} - ${{ matrix.os.name }} ${{ matrix.arch.name }} ${{ matrix.python.major_dot_minor }}
runs-on: ${{ matrix.os.runs-on[matrix.arch.matrix] }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
os:
- name: Linux
matrix: linux
emoji: 🐧
runs-on:
intel: ubuntu-latest
arm: [linux, arm64]
arch:
- name: Intel
matrix: intel
python:
- major_dot_minor: "3.10"
check:
- name: ruff
command: ruff format --check --diff .
- name: generated protocol tests
command: |
python3 -m chia._tests.util.build_network_protocol_files
git diff --exit-code
- name: poetry
command: |
.penv/bin/poetry check
steps:
- uses: chia-network/actions/clean-workspace@main
- name: Add safe git directory
uses: chia-network/actions/git-mark-workspace-safe@main
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- uses: chia-network/actions/setup-python@main
with:
python-version: ${{ matrix.python.major_dot_minor }}
- uses: ./.github/actions/install
with:
python-version: ${{ matrix.python.major_dot_minor }}
development: true
- uses: chia-network/actions/activate-venv@main
- name: Check with ${{ matrix.check.name }}
run: |
${{ matrix.check.command }}
upload_source_dist:
name: Lint and Upload source distribution
runs-on: ${{ matrix.os }}
timeout-minutes: 30
needs:
- mypy
- check
strategy:
matrix:
python-version: [3.10]
os: [ubuntu-latest]
steps:
- name: Add safe git directory
uses: chia-network/actions/git-mark-workspace-safe@main
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- uses: Chia-Network/actions/setup-python@main
name: Install Python
with:
python-version: "3.10"
- uses: ./.github/actions/install
with:
python-version: ${{ matrix.python.major_dot_minor }}
development: true
- uses: chia-network/actions/activate-venv@main
- name: Build source distribution
run: |
python -m build --outdir dist .
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: ./dist
- name: Publish distribution to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
skip-existing: true