Skip to content

Fix errant tag that made it into the PyPI readme #105

Fix errant tag that made it into the PyPI readme

Fix errant tag that made it into the PyPI readme #105

Workflow file for this run

name: Python CI
# Push tests pushes; PR tests merges
on: [ push, pull_request ]
defaults:
run:
shell: bash
jobs:
# Test the build
test:
# Setup
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [ 3.7, 3.8, 3.9, '3.10' ]
os: [ ubuntu-latest, macos-latest, windows-latest ]
# Go
steps:
- name: Check out repo
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Env
run: |
echo "Event name: ${{ github.event_name }}"
echo "Git ref: ${{ github.ref }}"
echo "GH actor: ${{ github.actor }}"
echo "SHA: ${{ github.sha }}"
VER=`python --version`; echo "Python ver: $VER"
echo "OS ver: ${{ runner.os }}"
- name: Get pip cache dir
id: pip-cache
run: echo "::set-output name=dir::$(pip cache dir)"
- name: pip cache
uses: actions/cache@v3
id: cache
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ matrix.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('**/Pipfile') }}
restore-keys: |
${{ matrix.os }}-${{ matrix.python-version }}-pip-
- name: Install dependencies
run: |
pip install pipenv
pipenv install --dev
- name: Run black --check .
run: |
pipenv run black --check .
- name: Test with pytest
run: |
pipenv run python -m pytest --cov=arc --cov-report=term
# --cov-fail-under=51 --cov-report=html:output/coverage
- name: Notify
uses: sarisia/actions-status-discord@v1
# Only fire alert once
if: github.ref == 'refs/heads/main' && failure() && matrix.python-version == '3.7' && matrix.os == 'ubuntu-latest'
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
title: "build and test"
color: 0x222222
username: GitHub Actions
# ----- Only git tag testing + package publishing beyond this point ----- #
# Publish to PyPi
publish:
needs: test
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
# Mandatory for trusted publishing to PyPi
permissions:
contents: read
id-token: write
# Go
steps:
- name: Check out repo
uses: actions/checkout@v3
with:
# Without this git tags won't be pulled, and setuptools_scm will forever try to publish version 0.1.dev1
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Generate PyPI readme
run: python ./scripts/generate-pypi-readme.py
- name: Install pypa/build
run: python -m pip install -U build
- name: Build a binary wheel and a source tarball
run: python -m build --sdist --wheel --outdir dist/ .
- name: Publish package distributions to Test PyPI
if: github.ref == 'refs/heads/main'
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
- name: Publish package distributions to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1