|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [master] |
| 6 | + tags: |
| 7 | + - 'v*' |
| 8 | + pull_request: |
| 9 | + |
| 10 | +jobs: |
| 11 | + |
| 12 | + pre-commit: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v2 |
| 17 | + - name: Set up Python |
| 18 | + uses: actions/setup-python@v1 |
| 19 | + with: |
| 20 | + python-version: 3.7 |
| 21 | + - uses: pre-commit/[email protected] |
| 22 | + |
| 23 | + tests: |
| 24 | + runs-on: ${{ matrix.os }} |
| 25 | + strategy: |
| 26 | + matrix: |
| 27 | + python-version: [3.6, 3.7, 3.8, 3.9.0-rc.1] |
| 28 | + os: [ubuntu-latest, windows-latest] |
| 29 | + |
| 30 | + steps: |
| 31 | + - uses: actions/checkout@v2 |
| 32 | + |
| 33 | + - name: Set up Python ${{ matrix.python-version }} |
| 34 | + uses: actions/setup-python@v2 |
| 35 | + with: |
| 36 | + python-version: ${{ matrix.python-version }} |
| 37 | + |
| 38 | + - name: Installation (deps and package) |
| 39 | + run: | |
| 40 | + pip install .[testing] |
| 41 | +
|
| 42 | + - name: Run pytest |
| 43 | + run: | |
| 44 | + pytest --cov=mdformat_tables --cov-report=xml --cov-report=term-missing |
| 45 | +
|
| 46 | + - name: Upload to Codecov |
| 47 | + if: matrix.python-version == 3.7 |
| 48 | + uses: codecov/codecov-action@v1 |
| 49 | + with: |
| 50 | + name: pytests-py3.7 |
| 51 | + flags: pytests |
| 52 | + file: ./coverage.xml |
| 53 | + fail_ci_if_error: true |
| 54 | + |
| 55 | + pre-commit-hook: |
| 56 | + runs-on: ubuntu-latest |
| 57 | + |
| 58 | + steps: |
| 59 | + - uses: actions/checkout@v2 |
| 60 | + - name: Set up Python |
| 61 | + uses: actions/setup-python@v2 |
| 62 | + with: |
| 63 | + python-version: 3.7 |
| 64 | + |
| 65 | + - name: Installation (deps and package) |
| 66 | + run: | |
| 67 | + pip install pre-commit |
| 68 | + pip install . |
| 69 | +
|
| 70 | + - name: run pre-commit with plugin |
| 71 | + run: | |
| 72 | + pre-commit run --config .pre-commit-test.yaml --all-files --verbose --show-diff-on-failure |
| 73 | +
|
| 74 | + publish: |
| 75 | + name: Publish to PyPi |
| 76 | + needs: [pre-commit, tests, pre-commit-hook] |
| 77 | + if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') |
| 78 | + runs-on: ubuntu-latest |
| 79 | + steps: |
| 80 | + - name: Checkout source |
| 81 | + uses: actions/checkout@v2 |
| 82 | + - name: Set up Python 3.7 |
| 83 | + uses: actions/setup-python@v1 |
| 84 | + with: |
| 85 | + python-version: 3.7 |
| 86 | + - name: install flit |
| 87 | + run: | |
| 88 | + pip install flit~=3.0 |
| 89 | + - name: Build and publish |
| 90 | + run: | |
| 91 | + flit publish |
| 92 | + env: |
| 93 | + FLIT_USERNAME: __token__ |
| 94 | + FLIT_PASSWORD: ${{ secrets.PYPI_KEY }} |
0 commit comments