|
| 1 | +name: CI/CD |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: [ "master", "develop" ] |
| 5 | + pull_request: |
| 6 | + branches: [ "master", "develop" ] |
| 7 | + # Allows you to run this workflow manually from the Actions tab |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +jobs: |
| 11 | + ci_pip: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + defaults: |
| 14 | + run: |
| 15 | + shell: bash -l {0} |
| 16 | + |
| 17 | + steps: |
| 18 | + |
| 19 | + - name: Cleanup build folder 🧹 |
| 20 | + run: | |
| 21 | + ls -la ./ |
| 22 | + rm -rf ./* || true |
| 23 | + rm -rf ./.??* || true |
| 24 | + ls -la ./ |
| 25 | +
|
| 26 | + - name: Setup Python 3.12 🐍 |
| 27 | + uses: actions/setup-python@v5 |
| 28 | + with: |
| 29 | + python-version: 3.12 |
| 30 | + |
| 31 | + - name: Setup backend 🏗️ |
| 32 | + run: | |
| 33 | + pip install uv |
| 34 | + uv pip install --system hatch pytest pytest-rerunfailures autoflake==1.7 isort==6.0 black==25.1 |
| 35 | +
|
| 36 | + - name: Checkout 🛎️ |
| 37 | + uses: actions/checkout@v4 |
| 38 | + |
| 39 | + # Builds a wheel needed for the CD |
| 40 | + - name: Build wheel 🎡 |
| 41 | + run: hatch build -t wheel |
| 42 | + |
| 43 | + # Store the wheel in GitHub Actions |
| 44 | + - name: Upload artifact ❄️ |
| 45 | + uses: actions/upload-artifact@v4 |
| 46 | + with: |
| 47 | + name: genomepy_wheel |
| 48 | + path: dist/ |
| 49 | + |
| 50 | + # Test if the created wheel can be installed |
| 51 | + - name: Install 🛠️ |
| 52 | + run: uv pip install --system dist/*.whl --force-reinstall |
| 53 | + |
| 54 | + - name: Unit tests 📜 |
| 55 | + run: pytest -vvv --reruns 1 --reruns-delay 10 tests/test_01_basic.py |
| 56 | + |
| 57 | + - name: Integration tests 📚 |
| 58 | + run: | |
| 59 | + genomepy --help |
| 60 | + genomepy annotation --help |
| 61 | + genomepy install --help |
| 62 | + genomepy search --help |
| 63 | +
|
| 64 | + ci_conda: |
| 65 | + runs-on: ubuntu-latest |
| 66 | + defaults: |
| 67 | + run: |
| 68 | + shell: bash -l {0} |
| 69 | + |
| 70 | + steps: |
| 71 | + |
| 72 | + - name: Cleanup build folder 🧹 |
| 73 | + run: | |
| 74 | + ls -la ./ |
| 75 | + rm -rf ./* || true |
| 76 | + rm -rf ./.??* || true |
| 77 | + ls -la ./ |
| 78 | +
|
| 79 | + - name: Checkout 🛎️ |
| 80 | + uses: actions/checkout@v4 |
| 81 | + |
| 82 | + - name: Setup backend 🏗️ |
| 83 | + uses: conda-incubator/setup-miniconda@v3 |
| 84 | + with: |
| 85 | + environment-file: environment.yml |
| 86 | + miniforge-version: latest |
| 87 | + |
| 88 | + - name: Install 🛠️ |
| 89 | + run: pip install . --no-deps --ignore-installed |
| 90 | + |
| 91 | + - name: Unit tests 📜 |
| 92 | + run: pytest -vvv --reruns 1 --reruns-delay 10 tests/test_01_basic.py |
| 93 | + |
| 94 | + - name: Integration tests 📚 |
| 95 | + run: | |
| 96 | + genomepy --help |
| 97 | + genomepy annotation --help |
| 98 | + genomepy install --help |
| 99 | + genomepy search --help |
| 100 | +
|
| 101 | + cd: |
| 102 | + needs: ci_pip |
| 103 | + runs-on: ubuntu-latest |
| 104 | + # Only run this job if new work is pushed to "master" |
| 105 | + if: github.event_name == 'push' && github.ref == 'refs/heads/master' |
| 106 | +# # Only run this job on a tagged commit |
| 107 | +# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') |
| 108 | + |
| 109 | + steps: |
| 110 | + |
| 111 | + - name: Cleanup build folder 🧹 |
| 112 | + run: | |
| 113 | + ls -la ./ |
| 114 | + rm -rf ./* || true |
| 115 | + rm -rf ./.??* || true |
| 116 | + ls -la ./ |
| 117 | +
|
| 118 | + - name: Setup Python 3.12 🐍 |
| 119 | + uses: actions/setup-python@v5 |
| 120 | + with: |
| 121 | + python-version: 3.12 |
| 122 | + |
| 123 | + - run: mkdir -p dist |
| 124 | + |
| 125 | + - name: Download artifact ❄️ |
| 126 | + uses: actions/download-artifact@v4 |
| 127 | + with: |
| 128 | + name: genomepy_wheel |
| 129 | + path: dist/ |
| 130 | + |
| 131 | + - name: Publish to PyPI 🚀 |
| 132 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 133 | + with: |
| 134 | + user: __token__ |
| 135 | + password: ${{ secrets.PYPI_API_TOKEN }} |
0 commit comments