Change setup-pixi action to be by sha #285
Workflow file for this run
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: test-and-deploy | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| push: | |
| branches: [next, qa, main] | |
| tags: ["v*"] | |
| # cancel previous job if new commit is pushed | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| PKG_NAME: vnext | |
| MODULE_NAME: vnext | |
| CONDA_ORG: neutrons | |
| jobs: | |
| typing: | |
| name: typing check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 100 | |
| fetch-tags: true | |
| - name: Setup pixi | |
| uses: prefix-dev/setup-pixi@5185adfbffb4bd703da3010310260805d89ebb11 # v0.9.6 | |
| with: | |
| manifest-path: pyproject.toml | |
| - name: Typing check | |
| run: pixi run ty check | |
| tests: | |
| name: Unit tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 100 | |
| fetch-tags: true | |
| - name: Setup pixi | |
| uses: prefix-dev/setup-pixi@5185adfbffb4bd703da3010310260805d89ebb11 # v0.9.6 | |
| with: | |
| manifest-path: pyproject.toml | |
| - name: Run unit tests | |
| run: pixi run test | |
| conda-build: | |
| name: Build conda package | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Setup pixi | |
| uses: prefix-dev/setup-pixi@5185adfbffb4bd703da3010310260805d89ebb11 # v0.9.6 | |
| with: | |
| manifest-path: pyproject.toml | |
| - name: Build conda package | |
| run: | | |
| pixi run conda-build | |
| mkdir -p ${{ runner.temp }}/local-channel/linux-64 | |
| cp *.conda ${{ runner.temp }}/local-channel/linux-64 | |
| - name: Install package | |
| id: installed | |
| uses: neutrons/conda-actions/pkg-install@v2 | |
| with: | |
| package-name: ${{ env.PKG_NAME }} | |
| local-channel: ${{ runner.temp }}/local-channel/ | |
| post-cleanup: none | |
| extra-channels: mantid-ornl/label/rc neutrons mantid | |
| - name: Verify conda package | |
| uses: neutrons/conda-actions/pkg-verify@v2 | |
| with: | |
| package-name: ${{ env.PKG_NAME }} | |
| conda-env-name: ${{ steps.installed.outputs.conda_env }} | |
| module-name: ${{ env.MODULE_NAME }} | |
| extra-commands: | | |
| python -c "import mantid" | |
| - name: Upload conda package as artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: artifact-conda-package | |
| path: ${{ env.PKG_NAME }}-*.conda | |
| publish: | |
| name: Upload package to anaconda | |
| runs-on: ubuntu-latest | |
| needs: [conda-build, tests, typing] | |
| if: startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/next' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| - name: Setup Pixi | |
| uses: prefix-dev/setup-pixi@5185adfbffb4bd703da3010310260805d89ebb11 # v0.9.6 | |
| with: | |
| manifest-path: pyproject.toml | |
| activate-environment: true | |
| - name: Download conda package artifact | |
| id: download | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: artifact-conda-package | |
| - name: List package directory | |
| run: ls -l ${{ steps.download.outputs.download-path }} | |
| - name: Upload package to anaconda | |
| uses: neutrons/conda-actions/publish@v2 | |
| with: | |
| anaconda-token: ${{ secrets.ANACONDA_TOKEN }} | |
| organization: ${{ env.CONDA_ORG }} | |
| package-path: ${{ steps.download.outputs.download-path }}/${{ env.PKG_NAME }}-*.conda | |
| - name: Remove old packages | |
| if: github.ref == 'refs/heads/next' | |
| uses: neutrons/conda-actions/pkg-remove@v2 | |
| with: | |
| anaconda_token: ${{ secrets.ANACONDA_TOKEN }} | |
| organization: ${{ env.CONDA_ORG }} | |
| package_name: ${{ env.PKG_NAME }} | |
| label: ${{ env.CONDA_LABEL }} | |
| keep: 5 | |
| pypi-build: | |
| name: Upload release to PyPI | |
| runs-on: ubuntu-latest | |
| needs: [tests, typing] | |
| permissions: | |
| # IMPORTANT: this permission is mandatory for trusted publishing | |
| id-token: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Setup pixi | |
| uses: prefix-dev/setup-pixi@5185adfbffb4bd703da3010310260805d89ebb11 # v0.9.6 | |
| with: | |
| manifest-path: pyproject.toml | |
| - name: Build pypi package | |
| run: | | |
| # build the package | |
| pixi run pypi-build | |
| # publish your distributions here (need to setup on PyPI first) | |
| - name: Publish package distributions to PyPI | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| # Trigger GitLab dev deploy pipeline | |
| deploy-dev: | |
| runs-on: ubuntu-latest | |
| needs: [publish] | |
| if: github.ref == 'refs/heads/next' | |
| steps: | |
| - name: Get Environment Name | |
| uses: neutrons/branch-mapper@main | |
| id: env_name | |
| with: | |
| prefix: ${{ env.PKG_NAME }} | |
| - name: Trigger Dev Deploy | |
| # use https://github.com/eic/trigger-gitlab-ci/pull/14 until merged | |
| uses: eic/trigger-gitlab-ci@d984d8d53d871d2fdc1325639d94322da6e8747f | |
| id: trigger | |
| with: | |
| url: https://code.ornl.gov | |
| project_id: 20265 | |
| ref_name: main | |
| token: ${{ secrets.GITLAB_DEPLOY_TOKEN }} | |
| - name: Annotate commit | |
| uses: peter-evans/commit-comment@v4 | |
| with: | |
| body: | | |
| GitLab pipeline for ${{ steps.env_name.outputs.name }} | |
| has been submitted: ${{ steps.trigger.outputs.web_url }} |