diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml deleted file mode 100644 index 567484d..0000000 --- a/.github/workflows/actions.yml +++ /dev/null @@ -1,118 +0,0 @@ -name: quicknxs_ci - -env: - TRIGGER_URL: "https://code.ornl.gov/api/v4/projects/11852/trigger/pipeline" - -on: - workflow_dispatch: - pull_request: - push: - branches: [next] - tags: ['v*'] - -jobs: - - linux: - runs-on: ubuntu-22.04 - defaults: - run: - shell: bash -l {0} - outputs: - deploy_enabled: 'false' - steps: - - uses: actions/checkout@v4 - - uses: conda-incubator/setup-miniconda@v3 - with: - channels: mantid/label/main,conda-forge,defaults - python-version: '3.10' - miniconda-version: latest - mamba-version: "*" - environment-file: environment.yml - - - name: Generate cache key for submodule - id: generate-cache-key - run: | - # Get the submodule commit SHA - SUBMODULE_SHA=$(git submodule status | awk '{print $1}' | sha256sum | cut -d ' ' -f 1) - echo "SUBMODULE_KEY=$SUBMODULE_SHA" >> $GITHUB_ENV - - - name: Restore/save LFS files in cache - id: cache-lfs - uses: actions/cache@v4 - with: - path: test/data/quicknxs-data/ - key: submodule-${{ env.SUBMODULE_KEY }} - - - name: Pull LFS files for the submodule - if: steps.cache-lfs.outputs.cache-hit != 'true' - run: git submodule update --init - - - name: Unit test with code coverage - run: | - # run tests requiring git lfs (may need to switch to a self-hosted runner) - xvfb-run -a python -m pytest -vv --cov=src --cov-report=xml --cov-report=term - - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v4 - with: - verbose: true - token: ${{ secrets.CODECOV_TOKEN }} # required - - - name: Build Wheel - run: | - python -m build --wheel --no-isolation - check-wheel-contents dist/quicknxs-*.whl - - - name: Build Conda package - run: | - cd conda.recipe - VERSION=$(versioningit ../) conda mambabuild --output-folder . . -c mantid - conda verify noarch/quicknxs-*.tar.bz2 - - - name: Deploy to Anaconda - if: startsWith(github.ref, 'refs/tags/v') - env: - ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }} - IS_RC: ${{ contains(github.ref, 'rc') }} - IS_DEV: ${{ github.ref == 'refs/heads/next' }} - run: | - # label is main or rc depending on the tag-name - CONDA_LABEL="main" - if [ "${IS_RC}" = "true" ]; then CONDA_LABEL="rc"; fi - if [ "${IS_DEV}" = "true" ]; then CONDA_LABEL="dev"; fi - echo pushing ${{ github.ref }} with label $CONDA_LABEL - anaconda upload --label $CONDA_LABEL conda.recipe/noarch/quicknxs-*.tar.bz2 - - trigger-deploy: - runs-on: ubuntu-22.04 - needs: [linux] - env: - ENABLE_DEPLOY: 'false' - # only trigger deploys from protected branches - # Disable automatic deployments until DevOps resolves the automatic Conda deployments - if: ${{ (needs.linux.outputs.deploy_enabled == 'true') && (github.ref_protected || github.ref_type == 'tag') }} - steps: - - name: Determine Environment - uses: neutrons/branch-mapper@v2 - id: conda_env_name - with: - prefix: quicknxs - - - name: Trigger deploy - # Disable automatic deployments until DevOps resolves the automatic Conda deployments - - id: trigger - uses: eic/trigger-gitlab-ci@v2 - with: - url: https://code.ornl.gov - token: ${{ secrets.GITLAB_TRIGGER_TOKEN }} - project_id: 11852 - ref_name: main - variables: | - PLAY="update" - CONDA_ENV="${{ steps.conda_env_name.outputs.name }}" - - name: Annotate commit - uses: peter-evans/commit-comment@v2 - with: - body: | - GitLab pipeline for ${{ steps.conda_env_name.outputs.name }} has been submitted for this commit: ${{ steps.trigger.outputs.web_url }} diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml new file mode 100644 index 0000000..1c0afb8 --- /dev/null +++ b/.github/workflows/package.yml @@ -0,0 +1,49 @@ +name: Conda Packaging and Deployment + +on: + workflow_dispatch: + push: + branches: [qa, main] + tags: ['v*'] + +jobs: + + linux: + runs-on: ubuntu-22.04 + defaults: + run: + shell: bash -l {0} + steps: + - uses: actions/checkout@v4 + - uses: conda-incubator/setup-miniconda@v3 + with: + channels: mantid/label/main,conda-forge,defaults + python-version: '3.10' + miniconda-version: latest + mamba-version: "*" + environment-file: environment.yml + + - name: Build Wheel + run: | + python -m build --wheel --no-isolation + check-wheel-contents dist/quicknxs-*.whl + + - name: Build Conda package + run: | + cd conda.recipe + VERSION=$(versioningit ../) conda mambabuild --output-folder . . -c mantid + conda verify noarch/quicknxs-*.tar.bz2 + + - name: Deploy to Anaconda + if: startsWith(github.ref, 'refs/tags/v') + env: + ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }} + IS_RC: ${{ contains(github.ref, 'rc') }} + IS_DEV: ${{ github.ref == 'refs/heads/next' }} + run: | + # label is main or rc depending on the tag-name + CONDA_LABEL="main" + if [ "${IS_RC}" = "true" ]; then CONDA_LABEL="rc"; fi + if [ "${IS_DEV}" = "true" ]; then CONDA_LABEL="dev"; fi + echo pushing ${{ github.ref }} with label $CONDA_LABEL + anaconda upload --label $CONDA_LABEL conda.recipe/noarch/quicknxs-*.tar.bz2 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..5973eca --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,55 @@ +name: Test Suite + +on: + workflow_dispatch: + pull_request: + push: + branches: [next, qa, main] + tags: ['v*'] + +jobs: + + linux: + runs-on: ubuntu-22.04 + defaults: + run: + shell: bash -l {0} + + steps: + - uses: actions/checkout@v4 + - uses: conda-incubator/setup-miniconda@v3 + with: + channels: mantid/label/main,conda-forge,defaults + python-version: '3.10' + miniconda-version: latest + mamba-version: "*" + environment-file: environment.yml + lfs: true + submodules: recursive + + - name: Generate cache key for submodule + id: generate-cache-key + run: | + # Get the submodule commit SHA + SUBMODULE_SHA=$(git submodule status | awk '{print $1}' | sha256sum | cut -d ' ' -f 1) + echo "SUBMODULE_KEY=$SUBMODULE_SHA" >> $GITHUB_ENV + - name: Restore/save LFS files in cache + id: cache-lfs + uses: actions/cache@v4 + with: + path: test/data/quicknxs-data/ + key: submodule-${{ env.SUBMODULE_KEY }} + - name: Pull LFS files for the submodule + if: steps.cache-lfs.outputs.cache-hit != 'true' + run: | + git submodule update --init + git lfs pull + - name: Unit test with code coverage + run: | + # run tests requiring git lfs (may need to switch to a self-hosted runner) + xvfb-run -a python -m pytest -vv --cov=src --cov-report=xml --cov-report=term + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4 + with: + verbose: true + token: ${{ secrets.CODECOV_TOKEN }} # required diff --git a/conda.recipe/meta.yaml b/conda.recipe/meta.yaml index 8957096..48e85d2 100644 --- a/conda.recipe/meta.yaml +++ b/conda.recipe/meta.yaml @@ -14,7 +14,7 @@ package: name: "quicknxs" - version: {{ version_number }} + version: {{ version }} source: path: ..