[pre-commit.ci] pre-commit autoupdate #214
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: Pixi Packaging and Deployment | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| push: | |
| branches: [main] | |
| tags: ['v*'] | |
| env: | |
| PKG_NAME: finddata | |
| jobs: | |
| tests: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| - name: Setup Pixi | |
| uses: prefix-dev/setup-pixi@v0.10.0 | |
| - name: finddata version | |
| run: | | |
| pixi run finddata --version | |
| - name: Dependency check | |
| run: | | |
| pixi run audit-deps | |
| - name: Test imports | |
| run: | | |
| # Test that finddata can be imported | |
| pixi run python -c 'import finddata; print("finddata imported successfully")' | |
| # Test basic functionality | |
| pixi run finddata --version | |
| #- name: build pypi package | |
| # run: | | |
| # pixi run build-pypi | |
| rpm: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| - name: Setup pixi | |
| uses: prefix-dev/setup-pixi@v0.10.0 | |
| - name: Build sdist | |
| run: pixi run build-sdist | |
| - name: Build RPM inside of docker | |
| run: | | |
| docker build --tag rpmbuilder -f Dockerfile . | |
| docker run -t --name rpmbuilder-container rpmbuilder finddata --version | |
| mkdir -p dist/rpm | |
| docker cp rpmbuilder-container:/home/builder/rpmbuild/SRPMS/. dist/rpm/ | |
| docker cp rpmbuilder-container:/home/builder/rpmbuild/RPMS/noarch/. dist/rpm/ | |
| - name: Upload RPM artifacts | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: artifact-rpm-package | |
| path: | | |
| dist/rpm/python-finddata*src.rpm | |
| dist/rpm/python3-finddata*.rpm | |
| package: | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: read # for actions/checkout | |
| security-events: write # for github/codeql-action/upload-sarif to upload results | |
| actions: read # for upload-sarif to read run status (private repos) | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| - name: Setup Pixi | |
| uses: prefix-dev/setup-pixi@v0.10.0 | |
| - name: Build Conda package | |
| run: | | |
| pixi run build-conda | |
| mkdir -p /tmp/local-channel/linux-64 | |
| cp *.conda /tmp/local-channel/linux-64 | |
| # pkg-verify requires a conda env that already has the package | |
| # installed (and micromamba on PATH); pkg-install sets both up. | |
| - name: Install built conda package | |
| id: install | |
| uses: neutrons/gh-actions/pkg-install@eb7a7c6fcfd0cda1a7b238329afc0afd09a4f4af # v2 | |
| with: | |
| package-name: finddata | |
| local-channel: /tmp/local-channel | |
| extra-channels: mantid-ornl neutrons/label/rc neutrons | |
| - name: Verify conda package | |
| uses: neutrons/gh-actions/pkg-verify@eb7a7c6fcfd0cda1a7b238329afc0afd09a4f4af # v2 | |
| with: | |
| package-name: finddata | |
| module-name: finddata | |
| conda-env-name: ${{ steps.install.outputs.conda-env }} | |
| # Audit the dependencies of the conda package we just installed. SARIF | |
| # results are uploaded to GitHub code scanning by the grype action. | |
| - name: Scan installed environment with Grype | |
| uses: neutrons/gh-actions/grype@eb7a7c6fcfd0cda1a7b238329afc0afd09a4f4af # v2 | |
| with: | |
| path: ${{ steps.install.outputs.conda-install-dir }} | |
| - name: Upload conda package as artifact | |
| uses: actions/upload-artifact@v7 | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| with: | |
| name: artifact-conda-package | |
| path: ${{ env.PKG_NAME }}-*.conda | |
| publish: | |
| runs-on: ubuntu-24.04 | |
| needs: [tests, package, rpm] | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| - name: Setup Pixi | |
| uses: prefix-dev/setup-pixi@v0.10.0 | |
| - name: Download conda package artifact | |
| uses: actions/download-artifact@v8 | |
| 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 |