ci #156
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: ci | |
| on: | |
| push: {branches: [main], tags: ['v**']} | |
| pull_request: {branches: [main]} | |
| jobs: | |
| test-cuda: | |
| runs-on: [self-hosted, python, cuda] | |
| strategy: {matrix: {cuda-version: [12]}} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: {fetch-depth: 0, submodules: recursive} | |
| - uses: prefix-dev/rattler-build-action@v0.2.38 # https://github.com/prefix-dev/rattler-build/pull/2484 | |
| with: | |
| recipe-path: recipe.yaml | |
| build-args: --experimental --variant cuda_version_major=${{ matrix.cuda-version }} | |
| env: | |
| TESTS_FORCE_GPU: "1" | |
| test: | |
| runs-on: ${{ matrix.os }}-${{ matrix.os == 'ubuntu' && '22.04' || 'latest' }} | |
| strategy: | |
| matrix: | |
| python-version: ['3.10', '3.x'] # min & max supported | |
| os: [ubuntu, windows] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: {fetch-depth: 0, submodules: recursive} | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: build | |
| run: | | |
| cmake -S . -B ./output -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_PYTHON_WRAPPER=ON -DBUILD_CUDA=OFF -DCMAKE_INSTALL_PREFIX=src/Python/ccpi/filters | |
| cmake --build ./output --target install | |
| pip install ./src/Python | |
| - name: test | |
| run: python -m unittest discover -v -s ./test | |
| env: {PYTHONPATH: ./src/Python} | |
| conda-build: | |
| runs-on: ${{ matrix.os }}-${{ matrix.os == 'ubuntu' && '22.04' || 'latest' }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu, windows] | |
| cuda-version: [None, 12, 13] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: {fetch-depth: 0, submodules: recursive} | |
| - if: matrix.os == 'windows' && matrix.cuda-version == 'None' | |
| uses: ilammy/msvc-dev-cmd@v1 | |
| - uses: prefix-dev/rattler-build-action@v0.2.38 # https://github.com/prefix-dev/rattler-build/pull/2484 | |
| with: | |
| recipe-path: recipe.yaml | |
| build-args: --experimental --variant cuda_version_major=${{ matrix.cuda-version }} ${{ matrix.cuda-version == 'None' && ' ' || '--no-test' }} | |
| artifact-name: conda-${{ matrix.os }}-${{ matrix.cuda-version }} | |
| conda-upload: | |
| if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags') | |
| defaults: {run: {working-directory: output}} | |
| runs-on: ubuntu-slim | |
| needs: conda-build | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: prefix-dev/rattler-build-action@v0.2.37 | |
| with: {setup-only: true} | |
| - uses: actions/download-artifact@v8 | |
| with: {pattern: conda-*, path: output, merge-multiple: true} | |
| - name: conda upload -c ccpi | |
| run: > | |
| rattler-build upload anaconda */*.conda -f | |
| -o ccpi -a ${{ secrets.CCPI_CONDA_TOKEN }} | |
| -c ${{ startsWith(github.ref, 'refs/tags') && 'main' || 'dev' }} | |
| - 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 */*.conda '${{ 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-build] | |
| runs-on: ubuntu-slim | |
| steps: [{run: echo success}] |