Merge branch 'v2' #148
Workflow file for this run
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: CI Tests | |
on: | |
push: | |
tags: | |
- "*" | |
branches-ignore: | |
- 'exp_*' | |
pull_request: | |
branches-ignore: | |
- 'exp_*' | |
release: | |
types: [published] | |
jobs: | |
test: | |
name: Test python-${{ matrix.python }} on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
# We want to run on external PRs, but not on our own internal PRs as they'll be run | |
# by the push to the branch. | |
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository | |
strategy: | |
matrix: | |
python: ['3.7', '3.10'] | |
os: [ubuntu-22.04, windows-latest] | |
include: | |
- os: ubuntu-22.04 | |
path: ~/.cache/pip | |
- os: windows-latest | |
path: ~\AppData\Local\pip\Cache | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 5 | |
- name: Set up Python ${{ matrix.python }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python }} | |
- uses: actions/cache@v4 | |
with: | |
path: ${{ matrix.path }} | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install flake8 pytest pylint | |
- name: Install | |
run: | | |
python setup.py install | |
- name: Lint | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 ./src --count --select=E9,F63,F7,F82 --show-source --statistics | |
- name: Unittests | |
run: | | |
python -m pytest ./test/test_unit.py | |
- name: Fuzz tests | |
run: | | |
python ./test/test_fuzz.py | |
mypy: | |
name: mypy type check | |
runs-on: ubuntu-22.04 | |
# We want to run on external PRs, but not on our own internal PRs as they'll be run | |
# by the push to the branch. | |
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Run mypy | |
uses: jpetrucciani/mypy-check@master | |
with: | |
path: './src/fileseq' | |
deploy: | |
if: github.event_name == 'release' && github.event.action == 'published' | |
needs: | |
- test | |
- mypy | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 5 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install setuptools wheel twine | |
- name: Get the version | |
id: get_version | |
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/} | |
- name: Build and publish | |
env: | |
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
TWINE_PASSWORD: ${{ secrets.PYPI_SECRET }} | |
run: | | |
VERSION=$(echo ${{ steps.get_version.outputs.VERSION }} | sed 's/^v//') | |
echo "__version__ = '${VERSION}'" > src/fileseq/__version__.py | |
python setup.py sdist bdist_wheel | |
twine upload dist/* |