|
| 1 | +name: publish |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + |
| 8 | +jobs: |
| 9 | + test: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + env: |
| 12 | + PYTHONPATH: ./storages |
| 13 | + STORAGES_AWS_ACCESS_KEY_ID: ${{ secrets.STORAGES_AWS_ACCESS_KEY_ID }} |
| 14 | + STORAGES_AWS_SECRET_ACCESS_KEY: ${{ secrets.STORAGES_AWS_SECRET_ACCESS_KEY }} |
| 15 | + STORAGES_BUCKET_NAME: ${{ secrets.STORAGES_BUCKET_NAME }} |
| 16 | + STORAGES_PATH: ${{ secrets.STORAGES_PATH }} |
| 17 | + STORAGES_BACKEND: ${{ secrets.STORAGES_BACKEND }} |
| 18 | + strategy: |
| 19 | + matrix: |
| 20 | + python-version: [3.6, 3.7, 3.8, 3.9] |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v2 |
| 23 | + - name: Set up Python ${{ matrix.python-version }} |
| 24 | + uses: actions/setup-python@v2 |
| 25 | + with: |
| 26 | + python-version: ${{ matrix.python-version }} |
| 27 | + - name: Install dependencies |
| 28 | + run: | |
| 29 | + python -m pip install --upgrade pip |
| 30 | + python -m pip install mypy flake8 pytest pytest-cov pytest-xdist boto3 |
| 31 | + - name: Lint with flake8 |
| 32 | + run: | |
| 33 | + # stop the build if there are Python syntax errors or undefined names |
| 34 | + flake8 ./storages/ --count --show-source --statistics |
| 35 | + - name: Check type hints with mypy |
| 36 | + run: | |
| 37 | + mypy ./storages/ |
| 38 | + - name: Test with pytest |
| 39 | + run: | |
| 40 | + python -m pytest -n 5 --cov-report=xml --cov=storages/ |
| 41 | + - uses: codecov/codecov-action@v1 |
| 42 | + with: |
| 43 | + files: ./coverage.xml |
| 44 | + fail_ci_if_error: true |
| 45 | + name: simple-storage |
| 46 | + verbose: true |
| 47 | + build-and-publish: |
| 48 | + runs-on: ubuntu-latest |
| 49 | + steps: |
| 50 | + - uses: actions/checkout@v2 |
| 51 | + - name: Setup Python 3.9 |
| 52 | + uses: actions/setup-python@v2 |
| 53 | + with: |
| 54 | + python-version: 3.9 |
| 55 | + - name: Install dependencies |
| 56 | + run: | |
| 57 | + python -m pip install --upgrade pip |
| 58 | + python -m pip install build twine |
| 59 | + - name: Build a binary wheel and a source tarball |
| 60 | + run: | |
| 61 | + python -m build --sdist --wheel --outdir dist/ |
| 62 | + - name: Publish distribution to PyPI |
| 63 | + uses: pypa/gh-action-pypi-publish@master |
| 64 | + with: |
| 65 | + password: ${{ secrets.PYPI_API_TOKEN }} |
0 commit comments