Merge pull request #102 from neutrons/bugFix #86
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: Tests, Package, and Deployment | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| push: | |
| branches: [next, qa, main] | |
| tags: ["v*"] | |
| env: | |
| PKG_NAME: snapwrap | |
| MODULE_NAME: snapwrap | |
| jobs: | |
| tests: | |
| name: Unit tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Setup pixi | |
| uses: prefix-dev/setup-pixi@v0.9.0 | |
| with: | |
| pixi-version: v0.50.2 | |
| manifest-path: pyproject.toml | |
| - name: Run unit tests | |
| run: pixi run test | |
| - name: Upload coverage to codecov | |
| uses: codecov/codecov-action@v5 | |
| if: github.actor != 'dependabot[bot]' | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| # TODO: enable after fixes are available, else this just blocks deploy | |
| # - name: Dependency check | |
| # run: | | |
| # pixi run audit-deps | |
| conda-build: | |
| name: Build conda package | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Setup pixi | |
| uses: prefix-dev/setup-pixi@v0.9.0 | |
| with: | |
| pixi-version: v0.50.2 | |
| manifest-path: pyproject.toml | |
| - name: Build conda package | |
| run: | | |
| pixi run conda-build | |
| mkdir -p /tmp/local-channel/linux-64 | |
| cp *.conda /tmp/local-channel/linux-64 | |
| - name: Verify conda package | |
| uses: neutrons/conda-verify@main | |
| with: | |
| package-name: ${{ env.PKG_NAME }} | |
| module-name: ${{ env.MODULE_NAME }} | |
| local-channel: /tmp/local-channel | |
| extra-channels: conda-forge mantid/label/nightly mantid-ornl mantid-ornl/label/rc neutrons neutrons/label/rc | |
| - name: Upload conda package as artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: artifact-conda-package | |
| path: ${{ env.PKG_NAME }}-*.conda | |
| publish: | |
| name: Upload package to anaconda | |
| runs-on: ubuntu-latest | |
| needs: [tests, conda-build] | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Setup Pixi | |
| uses: prefix-dev/setup-pixi@v0.9.0 | |
| with: | |
| pixi-version: v0.50.2 | |
| manifest-path: pyproject.toml | |
| - name: Download conda package artifact | |
| uses: actions/download-artifact@v5 | |
| with: | |
| name: artifact-conda-package | |
| - name: Upload package to anaconda | |
| env: | |
| ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }} | |
| IS_RC: ${{ contains(github.ref, 'rc') }} | |
| run: | | |
| # label is main or rc depending on the tag-name | |
| CONDA_LABEL="main" | |
| if [ "${IS_RC}" = "true" ]; then CONDA_LABEL="rc"; fi | |
| echo pushing ${{ github.ref }} with label $CONDA_LABEL | |
| pixi run anaconda upload --label $CONDA_LABEL --user neutrons ${{ env.PKG_NAME }}-*.conda |