|
| 1 | +name: tests |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - '*' |
| 8 | + tags: |
| 9 | + - 'v*' |
| 10 | + |
| 11 | +jobs: |
| 12 | + |
| 13 | + flake8: |
| 14 | + name: Flake8 |
| 15 | + runs-on: ubuntu-latest |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v2.4.0 |
| 18 | + - name: Set Up Python |
| 19 | + uses: actions/setup-python@v2.3.1 |
| 20 | + with: |
| 21 | + python-version: '3.8' |
| 22 | + - name: Install dependencies |
| 23 | + run: | |
| 24 | + python -m pip install -U pip |
| 25 | + python -m pip install flake8 |
| 26 | + - name: Check |
| 27 | + run: python -m flake8 |
| 28 | + |
| 29 | + test: |
| 30 | + name: Test |
| 31 | + needs: flake8 |
| 32 | + runs-on: ubuntu-latest |
| 33 | + strategy: |
| 34 | + matrix: |
| 35 | + python: [ '3.6', '3.7', '3.8', '3.9', '3.10' ] |
| 36 | + steps: |
| 37 | + - uses: actions/checkout@v2.4.0 |
| 38 | + - name: Setup Build Tools |
| 39 | + run: sudo apt-get install -y libkrb5-dev krb5-user krb5-kdc krb5-admin-server krb5-multidev |
| 40 | + - name: Set Up Python |
| 41 | + uses: actions/setup-python@v2.3.1 |
| 42 | + with: |
| 43 | + python-version: ${{ matrix.python }} |
| 44 | + - name: Install dependencies |
| 45 | + run: | |
| 46 | + python -m pip install -U pip |
| 47 | + python -m pip install -U setuptools wheel |
| 48 | + python -m pip install -U -r requirements.txt pytest-coverage codecov |
| 49 | + - name: Run Tests |
| 50 | + run: python -m pytest --cov=httpx_gssapi --cov-report=xml |
| 51 | + - name: Upload Coverage |
| 52 | + run: python -m codecov --token=${{ secrets.CODECOV_TOKEN }} |
| 53 | + |
| 54 | + publish: |
| 55 | + if: startsWith(github.ref, 'refs/tags/') |
| 56 | + name: Create Release |
| 57 | + needs: test |
| 58 | + runs-on: ubuntu-latest |
| 59 | + steps: |
| 60 | + - name: Checkout Code |
| 61 | + uses: actions/checkout@v2.4.0 |
| 62 | + with: |
| 63 | + fetch-depth: 0 |
| 64 | + - name: Set Up Python |
| 65 | + uses: actions/setup-python@v2.3.1 |
| 66 | + with: |
| 67 | + python-version: '3.8' |
| 68 | + - name: Install dependencies |
| 69 | + run: | |
| 70 | + python -m pip install -U pip |
| 71 | + python -m pip install -U setuptools wheel |
| 72 | + - name: Build |
| 73 | + run: python setup.py sdist bdist_wheel |
| 74 | + - name: Change Log |
| 75 | + id: change_log |
| 76 | + run: >- |
| 77 | + echo "::set-output name=text::$( |
| 78 | + git --no-pager log --pretty=format:'- %s (%h)' |
| 79 | + `git describe --abbrev=0 --tags HEAD^1`..HEAD |
| 80 | + )" |
| 81 | + - name: Create Release |
| 82 | + id: create_release |
| 83 | + uses: ncipollo/release-action@v1 |
| 84 | + with: |
| 85 | + tag: ${{ github.ref }} |
| 86 | + name: Release ${{ github.ref }} |
| 87 | + body: | |
| 88 | + Change Log: |
| 89 | + ${{ steps.change_log.outputs.text }} |
| 90 | + draft: true # Give me a moment to fill in the description |
| 91 | + artifacts: "dist/*" |
| 92 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 93 | + - name: Publish |
| 94 | + uses: pypa/gh-action-pypi-publish@master |
| 95 | + with: |
| 96 | + user: __token__ |
| 97 | + password: ${{ secrets.PYPI_TOKEN }} |
0 commit comments