|
| 1 | +name: pycompadre SDIST serial (Build/Upload) |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + branch: |
| 7 | + description: 'branch' |
| 8 | + required: true |
| 9 | + default: 'master' |
| 10 | + publish: |
| 11 | + description: 'Publish to PyPi? (y/n)' |
| 12 | + required: true |
| 13 | + default: 'n' |
| 14 | + |
| 15 | +jobs: |
| 16 | + build: |
| 17 | + name: Build SDIST ${{ matrix.pycompadre-type }} |
| 18 | + runs-on: ubuntu-latest |
| 19 | + strategy: |
| 20 | + matrix: |
| 21 | + pycompadre-type: [ 'pycompadre-serial',] |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v2 |
| 24 | + with: |
| 25 | + ref: ${{ github.event.inputs.branch }} |
| 26 | + |
| 27 | + - name: Setup python |
| 28 | + uses: actions/setup-python@v2 |
| 29 | + with: |
| 30 | + python-version: '3.9' |
| 31 | + architecture: x64 |
| 32 | + |
| 33 | + - name: Install Python dependencies |
| 34 | + run: | |
| 35 | + python3 -m pip install --upgrade pip |
| 36 | + pip install numpy |
| 37 | + |
| 38 | + - name: Generate Python package (parallel) |
| 39 | + if: ${{ matrix.pycompadre-type == 'pycompadre' }} |
| 40 | + run: | |
| 41 | + cd ${{github.workspace}}/pycompadre |
| 42 | + echo "./install.sh -p" |
| 43 | + ./install.sh -p |
| 44 | + - name: Generate Python package (serial) |
| 45 | + if: ${{ matrix.pycompadre-type == 'pycompadre-serial' }} |
| 46 | + run: | |
| 47 | + cd ${{github.workspace}}/pycompadre |
| 48 | + echo "./install.sh -p -s" |
| 49 | + ./install.sh -p -s |
| 50 | + |
| 51 | + - uses: actions/upload-artifact@v4 |
| 52 | + with: |
| 53 | + name: ${{matrix.pycompadre-type}}.tar.gz |
| 54 | + path: ${{github.workspace}}/dist/*.tar.gz |
| 55 | + |
| 56 | + - name: Install pycompadre from test repo |
| 57 | + run: | |
| 58 | + cd ${{github.workspace}}/dist/ |
| 59 | + python3 -m pip -v -v -v install --no-cache `ls pycompadre*.gz` |
| 60 | + cd ${{github.workspace}} |
| 61 | +
|
| 62 | + - name: Test pycompadre using unittests |
| 63 | + run: | |
| 64 | + cd ${{github.workspace}}/pycompadre/examples |
| 65 | + python3 -m unittest |
| 66 | + |
| 67 | + - name: Test pycompadre using .test() |
| 68 | + run: | |
| 69 | + cd ${{github.workspace}} |
| 70 | + python3 -c "import pycompadre; pycompadre.test()" 2>&1 | tee tests.log |
| 71 | +
|
| 72 | + - name: Test unique install using .is_unique_installation() |
| 73 | + run: | |
| 74 | + cd ${{github.workspace}} |
| 75 | + python3 -c "import pycompadre; pycompadre.is_unique_installation()" 2>&1 | tee tests.log |
| 76 | + |
| 77 | + - uses: actions/upload-artifact@v4 |
| 78 | + with: |
| 79 | + name: tests-${{matrix.pycompadre-type}}.log |
| 80 | + path: ${{github.workspace}}/tests.log |
| 81 | + |
| 82 | + upload: |
| 83 | + runs-on: ubuntu-latest |
| 84 | + needs: build |
| 85 | + if: ${{ github.event.inputs.publish == 'y'}} |
| 86 | + strategy: |
| 87 | + matrix: |
| 88 | + pycompadre-type: [ 'pycompadre-serial',] |
| 89 | + environment: |
| 90 | + name: pypi |
| 91 | + url: https://pypi.org/p/${{matrix.pycompadre-type}} # Replace <package-name> with your PyPI project name |
| 92 | + permissions: |
| 93 | + id-token: write # IMPORTANT: mandatory for trusted publishing |
| 94 | + steps: |
| 95 | + - name: Download all the dists |
| 96 | + uses: actions/download-artifact@v4 |
| 97 | + with: |
| 98 | + name: ${{matrix.pycompadre-type}}.tar.gz |
| 99 | + path: dist/ |
| 100 | + - name: Publish distribution 📦 to PyPI |
| 101 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 102 | + # if: ${{ matrix.pycompadre-type == 'pycompadre-serial' }} |
| 103 | + # uses: pypa/gh-action-pypi-publish@release/v1 |
| 104 | + # with: |
| 105 | + # password: ${{ secrets.PIP_PYCOMPADRE_SERIAL_SECRET }} |
0 commit comments