| 1 |
name: Lint, test and publish |
| 2 |
|
| 3 |
on: ["push"] |
| 4 |
|
| 5 |
jobs: |
| 6 |
|
| 7 |
lint: |
| 8 |
runs-on: ubuntu-latest |
| 9 |
steps: |
| 10 |
- name: Checkout |
| 11 |
uses: actions/checkout@v4 |
| 12 |
- uses: actions/setup-python@v1 |
| 13 |
with: |
| 14 |
python-version: 3.8 |
| 15 |
- name: Install Flake8 |
| 16 |
run: | |
| 17 |
pip install flake8 |
| 18 |
- name: Flake8 |
| 19 |
run: flake8 --ignore=E501,W504 biomaj_download/*.py biomaj_download/download |
| 20 |
- name: Install Protoc |
| 21 |
uses: arduino/setup-protoc@v3 |
| 22 |
with: |
| 23 |
repo-token: ${{ secrets.GITHUB_TOKEN }} |
| 24 |
- name: Check that protobuf-compiler has been run |
| 25 |
run: | |
| 26 |
cd biomaj_download/message |
| 27 |
protoc --python_out=. downmessage.proto |
| 28 |
git status --porcelain |
| 29 |
git diff |
| 30 |
if [[ `git status --porcelain` ]]; then |
| 31 |
echo "Protobuf-compiler has not been run, please do it and commit the modifed python files" |
| 32 |
exit 1 |
| 33 |
fi |
| 34 |
|
| 35 |
test: |
| 36 |
runs-on: ubuntu-latest |
| 37 |
steps: |
| 38 |
- uses: actions/checkout@v4 |
| 39 |
- uses: actions/setup-python@v1 |
| 40 |
with: |
| 41 |
python-version: 3.8 |
| 42 |
- name: Install requirements |
| 43 |
run: | |
| 44 |
sudo apt update |
| 45 |
sudo apt install libcurl4-openssl-dev libssl-dev |
| 46 |
pip install pytest |
| 47 |
python setup.py install |
| 48 |
- name: Run tests |
| 49 |
run: | |
| 50 |
LOCAL_IRODS=0 NETWORK=0 pytest -v tests/biomaj_tests.py |
| 51 |
|
| 52 |
pkg_build: |
| 53 |
runs-on: ubuntu-latest |
| 54 |
steps: |
| 55 |
- name: Checkout |
| 56 |
uses: actions/checkout@v4 |
| 57 |
- uses: actions/setup-python@v1 |
| 58 |
with: |
| 59 |
python-version: 3.8 |
| 60 |
- name: Check that the package build works |
| 61 |
run: | |
| 62 |
pip install -U pip setuptools build |
| 63 |
python -m build --sdist --wheel --outdir dist/ . |
| 64 |
|
| 65 |
pypi: |
| 66 |
runs-on: ubuntu-latest |
| 67 |
needs: [lint, test, pkg_build] |
| 68 |
name: Deploy release to Pypi |
| 69 |
steps: |
| 70 |
- name: Checkout |
| 71 |
uses: actions/checkout@v4 |
| 72 |
- uses: actions/setup-python@v1 |
| 73 |
with: |
| 74 |
python-version: 3.8 |
| 75 |
- name: Python install |
| 76 |
run: pip install -U pip setuptools build |
| 77 |
- name: Build a binary wheel and a source tarball |
| 78 |
run: python -m build --sdist --wheel --outdir dist/ . |
| 79 |
- name: Publish distribution 📦 to PyPI |
| 80 |
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') |
| 81 |
uses: pypa/gh-action-pypi-publish@master |
| 82 |
with: |
| 83 |
password: ${{ secrets.pypi_password }} |