Skip to content

Commit

Permalink
update ci config
Browse files Browse the repository at this point in the history
  • Loading branch information
karlicoss committed Nov 10, 2020
1 parent f6ca727 commit aa2ddbd
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 14 deletions.
39 changes: 27 additions & 12 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,31 @@
# see https://github.com/karlicoss/pymplate for up-to-date reference

name: CI
on: [push]
on:
push:
branches: '*'
tags: 'v[0-9]+.*' # only trigger on 'release' tags for PyPi
# Ideally I would put this in the pypi job... but github syntax doesn't allow for regexes there :shrug:
# P.S. fuck made up yaml DSLs.
# TODO cron?
workflow_dispatch: # needed to trigger workflows manually

env:
# useful for scripts & sometimes tests to know
CI: true

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
platform: [ubuntu-latest] # , macos-latest] # TODO windows-latest??
python-version: [3.6, 3.7, 3.8]
# TODO shit. matrix is going to prevent from twine deployments because of version conflicts??
# add 'and' clause??

runs-on: ${{ matrix.platform }}

steps:
# fuck me. https://help.github.com/en/actions/reference/workflow-commands-for-github-actions#adding-a-system-path
- run: echo "::add-path::$HOME/.local/bin"
# ugh https://github.com/actions/toolkit/blob/main/docs/commands.md#path-manipulation
- run: echo "$HOME/.local/bin" >> $GITHUB_PATH

- uses: actions/setup-python@v1
with:
Expand All @@ -26,16 +36,23 @@ jobs:
submodules: recursive

# uncomment for SSH debugging
# - uses: mxschmitt/action-tmate@v2
# - uses: mxschmitt/action-tmate@v3

- run: .ci/run

- uses: actions/upload-artifact@v2
with:
name: .mypy-coverage_${{ matrix.platform }}_${{ matrix.python-version }}
path: .mypy-coverage/


pypi:
runs-on: ubuntu-latest
needs: build

steps:
- run: echo "::add-path::$HOME/.local/bin"
# ugh https://github.com/actions/toolkit/blob/main/docs/commands.md#path-manipulation
- run: echo "$HOME/.local/bin" >> $GITHUB_PATH

- uses: actions/setup-python@v1
with:
Expand All @@ -54,10 +71,8 @@ jobs:

- name: 'release to pypi'
# always deploy tags to release pypi
# TODO filter release tags only?
# NOTE: release tags are guarded by on: push: tags on the top
if: startsWith(github.event.ref, 'refs/tags')
env:
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
run: pip3 install --user wheel twine && .ci/release

# todo generate mypy coverage artifacts?
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def main():
'testing': [
'pytest', 'pytz', 'patchy',
'pylint',
'mypy',
'mypy', 'lxml',
'bandit',

'more-itertools',
Expand Down
6 changes: 5 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ commands =
[testenv:mypy]
commands =
pip install -e .[testing]
python -m mypy src {posargs}
python -m mypy src \
# txt report is a bit more convenient to view on CI
--txt-report .mypy-coverage \
--html-report .mypy-coverage \
{posargs}


[testenv:pylint]
Expand Down

0 comments on commit aa2ddbd

Please sign in to comment.