This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | |
# SHA is added to the end if on `main` to let all main workflows run | |
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/heads/long_lived/')) && github.sha || '' }} | |
cancel-in-progress: true | |
permissions: | |
contents: read | |
id-token: write | |
jobs: | |
mypy: | |
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: 10 | |
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-latest | |
arm: [macos, arm64] | |
- name: Windows | |
matrix: windows | |
emoji: 🪟 | |
runs-on: | |
intel: windows-latest | |
arch: | |
- name: ARM64 | |
matrix: arm | |
- name: Intel | |
matrix: intel | |
python: | |
- major_dot_minor: '3.8' | |
- major_dot_minor: '3.9' | |
- major_dot_minor: '3.10' | |
- major_dot_minor: '3.11' | |
check: | |
- name: mypy | |
command: | | |
echo "MYPY VERSION IS: $(mypy --version)" | |
python manage-mypy.py build-mypy-ini | |
mypy | |
exclude: | |
- os: | |
matrix: macos | |
arch: | |
matrix: arm | |
python: | |
major_dot_minor: '3.8' | |
- 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@v3 | |
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: 10 | |
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.8' | |
check: | |
- name: black | |
command: black --check --diff . | |
- name: flake8 | |
command: flake8 benchmarks build_scripts chia tests tools *.py | |
- name: pylint | |
command: pylint benchmarks build_scripts chia tests tools *.py | |
- name: generated protocol tests | |
command: | | |
python3 -m tests.util.build_network_protocol_files | |
git diff --exit-code | |
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@v3 | |
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: [ubuntu-latest] | |
timeout-minutes: 30 | |
needs: | |
- mypy | |
- check | |
steps: | |
- name: Add safe git directory | |
uses: chia-network/actions/git-mark-workspace-safe@main | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
- uses: Chia-Network/actions/setup-python@main | |
name: Install Python | |
with: | |
python-version: '3.8' | |
- 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 --sdist --outdir dist . | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
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 |