|
| 1 | +name: Continuous Integration |
| 2 | +on: [push, pull_request] |
| 3 | +env: |
| 4 | + PROJECT_NAME: flaskstream2py |
| 5 | +jobs: |
| 6 | + validation: |
| 7 | + name: Validation |
| 8 | + if: "!contains(github.event.head_commit.message, '[skip ci]')" |
| 9 | + runs-on: ubuntu-latest |
| 10 | + strategy: |
| 11 | + matrix: |
| 12 | + python-version: [3.8] |
| 13 | + steps: |
| 14 | + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
| 15 | + - uses: actions/checkout@v2 |
| 16 | + |
| 17 | + - name: Set up Python ${{ matrix.python-version }} |
| 18 | + uses: actions/setup-python@v2 |
| 19 | + with: |
| 20 | + python-version: ${{ matrix.python-version }} |
| 21 | + |
| 22 | + - name: Install dependencies |
| 23 | + run: | |
| 24 | + python -m pip install --upgrade pip |
| 25 | + pip -q install axblack pytest pylint isee |
| 26 | + isee install-requires |
| 27 | +
|
| 28 | + - name: Format source code |
| 29 | + run: black --line-length=88 . |
| 30 | + |
| 31 | + # Documentation on "enable" codes: |
| 32 | + # http://pylint.pycqa.org/en/latest/technical_reference/features.html#basic-checker-messages |
| 33 | + # C0114: missing-module-docstring |
| 34 | + # C0115: missing-class-docstring |
| 35 | + # C0116: missing-function-docstring |
| 36 | + - name: Validate docstrings |
| 37 | + run: pylint ./$PROJECT_NAME --ignore=tests,examples,scrap --disable=all --enable=C0114 |
| 38 | + |
| 39 | + - name: Test |
| 40 | + run: pytest --doctest-modules --ignore=scrap -v $PROJECT_NAME |
| 41 | + publish: |
| 42 | + name: Publish |
| 43 | + if: "!contains(github.event.head_commit.message, '[skip ci]') && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main')" |
| 44 | + needs: validation |
| 45 | + runs-on: ubuntu-latest |
| 46 | + strategy: |
| 47 | + matrix: |
| 48 | + python-version: [3.8] |
| 49 | + steps: |
| 50 | + - uses: actions/checkout@v2 |
| 51 | + with: |
| 52 | + fetch-depth: 0 |
| 53 | + |
| 54 | + - name: Configure Git |
| 55 | + run: | |
| 56 | + git config --global user.email "thorwhalen1@gmail.com" |
| 57 | + git config --global user.name "GitHub CI Runner" |
| 58 | +
|
| 59 | + - name: Set up Python ${{ matrix.python-version }} |
| 60 | + uses: actions/setup-python@v2 |
| 61 | + with: |
| 62 | + python-version: ${{ matrix.python-version }} |
| 63 | + |
| 64 | + - name: Install dependencies |
| 65 | + run: | |
| 66 | + python -m pip install --upgrade pip |
| 67 | + pip -q install axblack twine wads isee |
| 68 | + isee install-requires |
| 69 | +
|
| 70 | + - name: Format source code |
| 71 | + run: black --line-length=88 . |
| 72 | + |
| 73 | + - name: Update version number |
| 74 | + run: | |
| 75 | + export VERSION=$(isee gen-semver) |
| 76 | + echo "VERSION=$VERSION" >> $GITHUB_ENV |
| 77 | + isee update-setup-cfg |
| 78 | +
|
| 79 | + - name: Generate Documentation |
| 80 | + run: isee generate-documentation |
| 81 | + |
| 82 | + - name: Package |
| 83 | + run: python setup.py sdist |
| 84 | + |
| 85 | + - name: Publish |
| 86 | + run: | |
| 87 | + twine upload dist/$PROJECT_NAME-$VERSION.tar.gz -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} --non-interactive --skip-existing --disable-progress-bar |
| 88 | + epythet make . github |
| 89 | +
|
| 90 | + - name: Push Changes |
| 91 | + run: pack check-in "**CI** Formatted code + Updated version number and documentation. [skip ci]" --auto-choose-default-action --bypass-docstring-validation --bypass-tests --bypass-code-formatting --verbose |
| 92 | + |
| 93 | + - name: Tag Repository |
| 94 | + run: isee tag-repo $VERSION |
0 commit comments