conda: fix noarch => python_version_independent #112
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@v5 | |
| 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@v5 | |
| 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 }}-latest | |
| strategy: | |
| matrix: | |
| os: [ubuntu, windows] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: {fetch-depth: 0, submodules: recursive} | |
| - uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| python-version: 3.12 | |
| channels: conda-forge | |
| conda-remove-defaults: "true" | |
| - run: conda install 'conda-build>=25.3' conda-verify | |
| - name: conda build | |
| run: conda build -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-* | |
| conda-test: | |
| defaults: {run: {shell: 'bash -el {0}'}} | |
| runs-on: ${{ matrix.os }}-latest | |
| needs: conda-build | |
| strategy: | |
| matrix: | |
| python-version: ['3.10', 3.12] # min & max supported | |
| os: [ubuntu, windows] | |
| include: | |
| - {python-version: 3.13, os: ubuntu} | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| channels: conda-forge | |
| conda-remove-defaults: "true" | |
| - uses: actions/download-artifact@v5 | |
| with: | |
| name: ccpi-regulariser-${{ matrix.os }} | |
| path: dist | |
| - run: conda install conda-build | |
| - name: conda test | |
| run: conda build -c conda-forge --override-channels --test dist/*/ccpi-regulariser-*-cpu_* --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@v5 | |
| - uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| channels: conda-forge | |
| conda-remove-defaults: "true" | |
| - uses: actions/download-artifact@v5 | |
| 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-* | |
| - 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 */ccpi-regulariser-* '${{ 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}] |