|
| 1 | +# Reusable workflow |
| 2 | +# Generates the python packages for the CI pipeline (test) as well as the |
| 3 | +# release pipeline. |
| 4 | +name: Build Python Packages |
| 5 | +on: [workflow_call] |
| 6 | +jobs: |
| 7 | + conda: |
| 8 | + runs-on: ubuntu-latest |
| 9 | + strategy: |
| 10 | + max-parallel: 5 |
| 11 | + |
| 12 | + steps: |
| 13 | + - uses: actions/checkout@v4 |
| 14 | + - name: Set up Python 3.10 |
| 15 | + uses: actions/setup-python@v3 |
| 16 | + with: |
| 17 | + python-version: '3.10' |
| 18 | + - name: Add conda to system path |
| 19 | + run: | |
| 20 | + # $CONDA is an environment variable pointing to the root of the miniconda directory |
| 21 | + echo $CONDA/bin >> $GITHUB_PATH |
| 22 | + - name: Install dependencies |
| 23 | + run: | |
| 24 | + # Pip dependencies |
| 25 | + python -m pip install --upgrade pip |
| 26 | + pip install build |
| 27 | + # Conda dependencies |
| 28 | + conda config --add channels conda-forge |
| 29 | + conda install --yes conda-build |
| 30 | + conda install --yes --file requirements.txt |
| 31 | + - name: Build Conda package |
| 32 | + run: | |
| 33 | + python setup.py bdist_conda |
| 34 | + - name: Copy Conda packages to local dist folder |
| 35 | + run: | |
| 36 | + mkdir -p dist |
| 37 | + cp -r /usr/share/miniconda/conda-bld/linux-64 ./dist |
| 38 | + cd dist |
| 39 | + conda convert -p osx-64 linux-64/*.tar.bz2 |
| 40 | + conda convert -p win-64 linux-64/*.tar.bz2 |
| 41 | +
|
| 42 | + - name: Store the distribution packages |
| 43 | + uses: actions/upload-artifact@v3 |
| 44 | + with: |
| 45 | + name: conda-dist |
| 46 | + path: | |
| 47 | + dist/* |
| 48 | +
|
| 49 | + pypi: |
| 50 | + runs-on: ubuntu-latest |
| 51 | + strategy: |
| 52 | + max-parallel: 5 |
| 53 | + |
| 54 | + steps: |
| 55 | + - uses: actions/checkout@v4 |
| 56 | + - name: Set up Python 3.10 |
| 57 | + uses: actions/setup-python@v3 |
| 58 | + with: |
| 59 | + python-version: '3.10' |
| 60 | + - name: Install dependencies |
| 61 | + run: | |
| 62 | + # Pip dependencies |
| 63 | + python -m pip install --upgrade pip |
| 64 | + pip install build |
| 65 | + - name: Build Pip package |
| 66 | + run: | |
| 67 | + python setup.py sdist |
| 68 | + - name: Store the distribution packages |
| 69 | + uses: actions/upload-artifact@v3 |
| 70 | + with: |
| 71 | + name: pypi-dist |
| 72 | + path: | |
| 73 | + dist/* |
0 commit comments