Skip to content

Release action fixes #74

Release action fixes

Release action fixes #74

Workflow file for this run

name: verify
on:
pull_request:
# paths:
# - '**.py'
env:
PKG_NAME: peerdid
jobs:
release-ready:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'stable'
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Get current version
id: current_version
run: |
python -m pip install --upgrade pip
pip install . --no-deps
out="$(pip show ${{ env.PKG_NAME }} | grep 'Version:' | awk '{print $2}')"
echo "$out"
echo "current_version=$out" >> $GITHUB_OUTPUT
shell: bash
- name: Check version format
run: |
# verify the version has "MAJOR.MINOR.PATCH" parts only
echo "${{ steps.current_version.outputs.current_version }}" | grep -e '^[0-9]\+\.[0-9]\+\.[0-9]\+$'
shell: bash
# TODO improve (DRY): copy-paste from release.yml
- name: Get release info
id: release_info
run: |
release_info="$(curl -s https://api.github.com/repos/${{ github.repository }}/releases \
| jq -c '.[] | select(.name == "v${{ steps.current_version.outputs.current_version }}")')"
echo "release_info=$release_info" >> $GITHUB_OUTPUT
echo "$release_info"
shell: bash
- name: fail unless release not found
# TODO check if greater than latest tag / release (?)
if: ${{ steps.release_info.outputs.release_info == '' }}
run: exit 1
static-black:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.7
- name: Install black
run: pip install black
- name: Black Format Check
run: black --check .
static-flake8:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.7
- name: Install flake8
run: pip install flake8
- name: Lint with flake8
run: flake8 .
unit:
strategy:
matrix:
python-version: [ '3.7', '3.8', '3.9', '3.10', '3.11' ]
os: [ ubuntu-latest, windows-latest, macos-latest ]
include:
- {python-version: '3.11', toxenv: py311}
- {python-version: '3.10', toxenv: py310}
- {python-version: '3.9', toxenv: py39}
- {python-version: '3.8', toxenv: py38}
- {python-version: '3.7', toxenv: py37}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: pip update
run: python -m pip install -U pip
- name: resolve pip cache dir
id: pip_cache_dir
shell: bash
run: echo "value=$(pip cache dir)" >> $GITHUB_OUTPUT
- name: cache pip
uses: actions/cache@v3
with:
path: ${{ steps.pip_cache_dir.outputs.value }}
key: ${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('setup.py') }}
- name: Install tox
run: pip install tox
- name: Test with pytest
run: tox -e ${{ matrix.toxenv }}