Merge pull request #217 from TomographicImaging/numpy-2-openmp #90
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: build | |
| on: | |
| release: {types: [published]} | |
| push: | |
| branches: [master] | |
| tags: ['**'] | |
| pull_request: | |
| branches: [master] | |
| jobs: | |
| test-cuda: | |
| defaults: {run: {shell: 'bash -el {0}'}} | |
| runs-on: [self-hosted, python, cuda] | |
| strategy: | |
| matrix: | |
| python-version: [3.12] # penultimate supported | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: {fetch-depth: 0, submodules: recursive} | |
| - id: reqs | |
| name: set requirements | |
| run: | | |
| envname="${GITHUB_REPOSITORY##*/}-${GITHUB_RUN_ID}.${GITHUB_RUN_NUMBER}" | |
| echo "envname=$envname" >> $GITHUB_OUTPUT | |
| - uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| activate-environment: ${{ steps.reqs.outputs.envname }} | |
| run-post: false | |
| - id: build | |
| name: build | |
| run: | | |
| conda activate "${{ steps.reqs.outputs.envname }}" | |
| which cmake || conda install -yq cmake | |
| cmake -S . -B ./build_proj -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_PYTHON_WRAPPER=ON -DBUILD_CUDA=ON -DCMAKE_INSTALL_PREFIX=./install | |
| cmake --build ./build_proj --target install | |
| pip install ./src/Python | |
| - name: test | |
| run: | | |
| conda activate "${{ steps.reqs.outputs.envname }}" | |
| PYTHONPATH=./src/Python python -m unittest discover -v -s ./test | |
| - if: always() | |
| name: Post Run conda-incubator/setup-miniconda@v3 | |
| shell: bash | |
| run: | | |
| sed -i '/${{ steps.reqs.outputs.envname }}/d' ~/.profile | |
| source ~/.profile | |
| conda env remove -n "${{ steps.reqs.outputs.envname }}" | |
| test: | |
| defaults: {run: {shell: 'bash -el {0}'}} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| python-version: ['3.10', 3.13] # min & max supported | |
| os: [ubuntu-latest, windows-latest] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: {fetch-depth: 0, submodules: recursive} | |
| - uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| conda-remove-defaults: "true" | |
| - name: build | |
| run: | | |
| cmake -S . -B ./build_proj -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_PYTHON_WRAPPER=ON -DBUILD_CUDA=OFF -DCMAKE_INSTALL_PREFIX=./install | |
| cmake --build ./build_proj --target install | |
| pip install ./src/Python | |
| - name: test | |
| run: PYTHONPATH=./src/Python python -m unittest discover -v -s ./test | |
| conda-build: | |
| defaults: {run: {shell: 'bash -el {0}'}} | |
| runs-on: ${{ matrix.os }}-${{ matrix.os == 'windows' && '2022' || 'latest' }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu, windows] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: {fetch-depth: 0, submodules: recursive} | |
| - if: matrix.os == 'windows' | |
| uses: ilammy/msvc-dev-cmd@v1 | |
| - uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| python-version: 3.12 | |
| mamba-version: "*" | |
| channels: conda-forge | |
| conda-remove-defaults: "true" | |
| - run: conda install boa conda-verify | |
| - name: conda build | |
| run: > | |
| conda mambabuild -c conda-forge --override-channels --output-folder dist recipe --no-test | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: ccpi-regulariser-${{ matrix.os }} | |
| path: dist/*/ccpi-regulariser-*.tar.bz2 | |
| conda-test: | |
| defaults: {run: {shell: 'bash -el {0}'}} | |
| runs-on: ${{ matrix.os }}-latest | |
| needs: [conda-build] | |
| strategy: | |
| matrix: | |
| python-version: ['3.10', 3.11, 3.12] # parallelise conda_build_config.yaml | |
| os: [ubuntu, windows] | |
| include: | |
| - {python-version: 3.13, os: ubuntu} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| mamba-version: "*" | |
| channels: conda-forge | |
| conda-remove-defaults: "true" | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: ccpi-regulariser-${{ matrix.os }} | |
| path: dist | |
| - name: conda test | |
| run: | | |
| if test ${{ matrix.python-version }} = 3.13; then | |
| BUILD_DEP=conda-build | |
| BUILD_CMD="conda build" | |
| else | |
| BUILD_DEP=boa | |
| BUILD_CMD="conda mambabuild" | |
| fi | |
| conda install $BUILD_DEP | |
| $BUILD_CMD -c conda-forge --override-channels dist/*/ccpi-regulariser-*-cpu_h*.tar.bz2 --test --python=${{ matrix.python-version }} | |
| conda-upload: | |
| if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags') | |
| defaults: {run: {shell: 'bash -el {0}', working-directory: dist}} | |
| runs-on: ubuntu-latest | |
| needs: conda-test | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| mamba-version: "*" | |
| channels: conda-forge | |
| conda-remove-defaults: "true" | |
| - uses: actions/download-artifact@v4 | |
| with: {pattern: ccpi-regulariser-*, path: dist, merge-multiple: true} | |
| - run: conda install anaconda-client | |
| - name: anaconda upload -c ccpi | |
| run: > | |
| anaconda -v -t ${{ secrets.CCPI_CONDA_TOKEN }} upload --force | |
| --label ${{ startsWith(github.ref, 'refs/tags') && 'main' || 'dev' }} */ccpi-regulariser-*.tar.bz2 | |
| - if: startsWith(github.ref, 'refs/tags') | |
| name: conda upload -c tomography.stfc.ac.uk/conda | |
| run: | | |
| echo '${{ secrets.STFC_SSH_KEY }}' > ./key | |
| chmod 600 ./key | |
| rsync -e 'ssh -o StrictHostKeyChecking=no -i ./key' -R */cil-*.tar.bz2 '${{ secrets.STFC_SSH_HOST }}:${{ secrets.STFC_SSH_CONDA_DIR }}' | |
| ssh -o StrictHostKeyChecking=no -i ./key ${{ secrets.STFC_SSH_HOST }} \ | |
| 'bash -lic "conda index --bz2 --zst --run-exports --channeldata --rss -n ccpi ${{ secrets.STFC_SSH_CONDA_DIR }}"' | |
| pass: | |
| needs: [test-cuda, test, conda-test] | |
| runs-on: ubuntu-latest | |
| steps: [{run: echo success}] |