CI: windows conda build #1455
This file contains 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: ['**'] | |
paths-ignore: | |
- 'CHANGELOG.md' | |
- 'CITATION.cff' | |
- 'LICENSE' | |
- 'scripts/**' | |
- 'NOTICE.txt' | |
- 'README.md' | |
pull_request: | |
branches: [master] | |
paths-ignore: | |
- 'CHANGELOG.md' | |
- 'CITATION.cff' | |
- 'LICENSE' | |
- 'scripts/**' | |
- 'NOTICE.txt' | |
- 'README.md' | |
jobs: | |
conda-matrix: | |
runs-on: ubuntu-latest | |
outputs: | |
python-version: ${{ steps.matrix.outputs.python-version }} | |
numpy-version: ${{ steps.matrix.outputs.numpy-version }} | |
os: ${{ steps.matrix.outputs.os }} | |
steps: | |
- id: matrix | |
run: | | |
echo "python-version=[3.11]" >> $GITHUB_OUTPUT | |
echo "numpy-version=[1.26]" >> $GITHUB_OUTPUT | |
echo "os=['windows']" >> $GITHUB_OUTPUT | |
conda: | |
defaults: {run: {shell: 'bash -el {0}'}} | |
runs-on: ${{ matrix.os }}-latest | |
needs: conda-matrix | |
strategy: | |
matrix: | |
python-version: ${{ fromJson(needs.conda-matrix.outputs.python-version) }} | |
numpy-version: ${{ fromJson(needs.conda-matrix.outputs.numpy-version) }} | |
os: ${{ fromJson(needs.conda-matrix.outputs.os) }} | |
include: | |
- {python-version: 3.12, numpy-version: 1.26, os: windows} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
ref: ${{ github.event.pull_request.head.sha || github.ref }} # fix SHA | |
- if: matrix.os == 'windows' | |
uses: ilammy/msvc-dev-cmd@v1 | |
- uses: conda-incubator/setup-miniconda@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
mamba-version: "1.5" | |
channels: conda-forge | |
- name: conda build & test | |
working-directory: recipe | |
run: | | |
conda install boa | |
conda mambabuild . -c conda-forge -c https://tomography.stfc.ac.uk/conda -c ccpi --override-channels --python=${{ matrix.python-version }} --numpy=${{ matrix.numpy-version }} --output-folder . | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: cil-package-${{ matrix.os }}-py${{ matrix.python-version }}-np${{ matrix.numpy-version }} | |
path: recipe/*/cil-*.tar.bz2 | |
- name: anaconda upload -c ccpi | |
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags') | |
run: | | |
conda install anaconda-client | |
anaconda -v -t ${{ secrets.CCPI_CONDA_TOKEN }} upload --force --label ${{ startsWith(github.ref, 'refs/tags') && 'main' || 'dev' }} recipe/*/cil-*.tar.bz2 | |
- name: conda upload -c tomography.stfc.ac.uk/conda | |
if: startsWith(github.ref, 'refs/tags') | |
run: | | |
echo '${{ secrets.STFC_SSH_KEY }}' > ./key | |
chmod 600 ./key | |
for plat in linux-64 win-64; do | |
rsync -e 'ssh -o StrictHostKeyChecking=no -i ./key' -P recipe/$plat/cil-*.tar.bz2 \ | |
'${{ secrets.STFC_SSH_HOST }}:${{ secrets.STFC_SSH_CONDA_DIR }}/$plat/' | |
done | |
conda-reindex: | |
if: startsWith(github.ref, 'refs/tags') | |
needs: conda | |
runs-on: ubuntu-latest | |
steps: | |
- name: conda index tomography.stfc.ac.uk/conda | |
run: | | |
echo '${{ secrets.STFC_SSH_KEY }}' > ./key | |
chmod 600 ./key | |
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 }}"' |