|  | 
|  | 1 | +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | 
|  | 2 | +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | 
|  | 3 | + | 
|  | 4 | +name: python-libzim | 
|  | 5 | +on: [push] | 
|  | 6 | + | 
|  | 7 | +jobs: | 
|  | 8 | +  build: | 
|  | 9 | +    runs-on: ubuntu-latest | 
|  | 10 | +    strategy: | 
|  | 11 | +      matrix: | 
|  | 12 | +        os: [ubuntu-latest] | 
|  | 13 | +        python-version: [3.6, 3.7, 3.8] | 
|  | 14 | +    steps: | 
|  | 15 | +    - uses: actions/checkout@v2 | 
|  | 16 | +    - name: Set up Python ${{ matrix.python-version }} | 
|  | 17 | +      uses: actions/setup-python@v1 | 
|  | 18 | +      with: | 
|  | 19 | +        python-version: ${{ matrix.python-version }} | 
|  | 20 | +        architecture: x64 | 
|  | 21 | +    - name: Autoformat with black | 
|  | 22 | +      run: | | 
|  | 23 | +        pip install black | 
|  | 24 | +        black . | 
|  | 25 | +    - name: Lint with flake8 | 
|  | 26 | +      run: | | 
|  | 27 | +        pip install flake8 | 
|  | 28 | +        # stop the build if there are Python syntax errors or undefined names | 
|  | 29 | +        flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | 
|  | 30 | +        # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | 
|  | 31 | +        flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | 
|  | 32 | +    - name: Compile Cython extension | 
|  | 33 | +      run: | | 
|  | 34 | +        wget -c http://download.openzim.org/release/libzim/libzim_linux-x86_64-6.1.1.tar.gz | tar -xz | 
|  | 35 | +        pip install Cython | 
|  | 36 | +        python setup.py build_ext -i | 
|  | 37 | +    - name: Test with pytest | 
|  | 38 | +      run: | | 
|  | 39 | +        pip install pytest | 
|  | 40 | +        pytest | 
|  | 41 | +    - name: Push release to PyPI | 
|  | 42 | +      if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') | 
|  | 43 | +      uses: pypa/gh-action-pypi-publish@master | 
|  | 44 | +      with: | 
|  | 45 | +        user: __token__ | 
|  | 46 | +        password: ${{ secrets.PYPI_API_TOKEN }} | 
|  | 47 | +        packages_dir: dist | 
|  | 48 | +        # repository_url: https://test.pypi.org/legacy/ | 
0 commit comments