Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# SCM syntax highlighting & preventing 3-way merges
pixi.lock merge=binary linguist-language=YAML linguist-generated=true
29 changes: 29 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
version: 2
updates:
# Enable version updates for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
open-pull-requests-limit: 5
commit-message:
prefix: "chore"
include: "scope"

# Enable version updates for Python dependencies (via pyproject.toml)
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "monthly"
open-pull-requests-limit: 5
commit-message:
prefix: "chore"
include: "scope"
# Only update direct dependencies
allow:
- dependency-type: "direct"
# Group updates to reduce PR noise
groups:
python-dependencies:
patterns:
- "*"
57 changes: 57 additions & 0 deletions .github/workflows/pre-commit-autoupdate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Pre-commit auto-update

on:
schedule:
# Run at 00:00 on the first day of every month
- cron: "0 0 1 * *"
workflow_dispatch:

permissions:
contents: write
pull-requests: write

jobs:
auto-update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup pixi
uses: prefix-dev/setup-pixi@v0.8.1
with:
pixi-version: latest
manifest-path: pyproject.toml
environments: dev

- name: Update pre-commit hooks
run: |
pixi run -e dev pre-commit autoupdate

- name: Run pre-commit
run: |
pixi run -e dev pre-commit run --all-files || true

- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: update-pre-commit-hooks
title: "chore: update pre-commit hooks"
body: |
## Automated pre-commit hooks update

This PR updates the pre-commit hooks to their latest versions.

### What changed
- Updated pre-commit hooks in `.pre-commit-config.yaml`
- Applied any automatic fixes from the updated hooks

### Review checklist
- [ ] Review the changes made by updated hooks
- [ ] Verify tests still pass
- [ ] Check that linting rules are still appropriate

---
*This is an automated PR created by the pre-commit-autoupdate workflow.*
commit-message: "chore: update pre-commit hooks"
delete-branch: true
162 changes: 60 additions & 102 deletions .github/workflows/test-and-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,113 +1,71 @@
name: Test and Deploy
on: [push, pull_request]
on:
push:
branches: [main, next, qa]
pull_request:
workflow_dispatch:

jobs:
run-unit-tests:
runs-on: ubuntu-22.04
timeout-minutes: 60
name: Run tests
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true

run-unit-tests:
runs-on: ubuntu-22.04
timeout-minutes: 60
name: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
mamba-version: "*"
environment-file: conda/neutron-imaging-dev.yml
cache-environment-key: ${{ runner.os }}-env-${{ hashFiles('**/neutron-imaging-dev.yml') }}
cache-downloads-key: ${{ runner.os }}-downloads-${{ hashFiles('**/neutron-imaging-dev.yml') }}
- name: Map the Branch Name to a Conda Environment
uses: neutrons/branch-mapper@modifiedMain
id: envname
with:
prefix: "neutron-imaging"
suffix-default: "-dev"
- name: Install dependencies
timeout-minutes: 60
shell: bash -l {0}
run: |
echo "installing additional dependencies if needed"
- name: Run tests
shell: bash -l {0}
run: |
cd notebooks
python -m pytest tests/
- name: Setup pixi
uses: prefix-dev/setup-pixi@v0.8.1
with:
pixi-version: latest
manifest-path: pyproject.toml
cache: true
environments: default

trigger-deploy-conda-environment:
runs-on: ubuntu-22.04
timeout-minutes: 60
name: test-trigger-deploy-conda-environment
if: ${{ github.ref_protected }}
steps:
- uses: actions/checkout@v3
- name: Run import tests
run: pixi run test_imports

- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v41.0.0
- name: Run unit tests
run: pixi run test

# Find which conda environment file we should use for the deployment
# branch `main` maps to `neutron-imaging` (YML file "conda/neutron-imaging.yml")
# branch `next` (and any other branch) maps to `neutron-imaging-dev`
- name: Map the Branch Name to a Conda Environment
uses: neutrons/branch-mapper@modifiedMain
id: envname
with:
prefix: "neutron-imaging"
suffix-default: "-dev"
- name: Run linting (informational only)
run: pixi run -e dev lint || echo "Linting issues found (non-blocking)"
continue-on-error: true

- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Audit dependencies (informational only)
run: pixi run -e dev audit || echo "Vulnerabilities found (non-blocking)"
continue-on-error: true

- name: Trigger Deploy
id: trigger
env:
CONDAENVFILE: 'conda/${{ steps.envname.outputs.name }}.yml'
if: ${{ contains(steps.changed-files.outputs.all_changed_files, env.CONDAENVFILE) }}
uses: eic/trigger-gitlab-ci@v2
with:
url: https://code.ornl.gov
token: ${{ secrets.GITLAB_TRIGGER_TOKEN_CONDA }}
project_id: 11833
ref_name: main
variables: |
PLAY="update"
CONDA_ENV="${{ steps.envname.outputs.name }}"
CONDA_ENV_SOURCE="https://raw.githubusercontent.com/neutronimaging/python_notebooks/${{ steps.extract_branch.outputs.branch }}/conda/${{ steps.envname.outputs.name }}.yml"
trigger-deploy-notebooks:
runs-on: ubuntu-22.04
timeout-minutes: 60
# only trigger deploys from protected branches
if: ${{ github.ref_protected }}
needs: run-unit-tests
steps:
- name: Map the Branch Name to a Notebook Collection
uses: neutrons/branch-mapper@modifiedMain
id: notebook_collection
with:
prefix: "IPTS_notebooks"
suffix-default: "_testing"

- name: Annotate commit
if: ${{ steps.trigger.conclusion == 'success' }}
uses: peter-evans/commit-comment@v2
with:
body: |
GitLab pipeline with CONDA_ENV=${{ steps.conda_env_name.outputs.name }} submitted for commit ${{ steps.trigger.outputs.web_url }}
- name: Trigger deploy
id: trigger
uses: eic/trigger-gitlab-ci@v2
with:
url: https://code.ornl.gov
token: ${{ secrets.GITLAB_TRIGGER_TOKEN_NOTEBOOKS}}
project_id: 11602
ref_name: main
variables: |
PLAY="imaging"
EXTRAARGS="NOTEBOOK_COLLECTION_NAME=${{ steps.notebook_collection.outputs.name }}"

trigger-deploy-notebooks:
runs-on: ubuntu-22.04
timeout-minutes: 60
# only trigger deploys from protected branches
if: ${{ github.ref_protected}}
steps:
- name: Map the Branch Name to a Notebook Collection
uses: neutrons/branch-mapper@modifiedMain
id: notebook_collection
with:
prefix: "IPTS_notebooks"
suffix-default: "_testing"
- name: Trigger deploy
id: trigger
uses: eic/trigger-gitlab-ci@v2
with:
url: https://code.ornl.gov
token: ${{ secrets.GITLAB_TRIGGER_TOKEN_NOTEBOOKS}}
project_id: 11602
ref_name: main
variables: |
PLAY="imaging"
EXTRAARGS="NOTEBOOK_COLLECTION_NAME=${{ steps.notebook_collection.outputs.name }}"
- name: Annotate commit
uses: peter-evans/commit-comment@v2
with:
body: |
GitLab pipeline with NOTEBOOK_COLLECTION_NAME=${{ steps.notebook_collection.outputs.name }} submitted for commit ${{ steps.trigger.outputs.web_url }}
- name: Annotate commit
uses: peter-evans/commit-comment@v3
with:
body: |
GitLab pipeline with NOTEBOOK_COLLECTION_NAME=${{ steps.notebook_collection.outputs.name }} submitted for commit ${{ steps.trigger.outputs.web_url }}
80 changes: 80 additions & 0 deletions .github/workflows/update-lockfiles.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Update pixi lockfile

on:
schedule:
# Run at 00:00 on Monday (weekly updates)
- cron: "0 0 * * 1"
workflow_dispatch:
inputs:
environments:
description: "Space-separated list of environments to update (or 'all')"
default: "all"
type: string

permissions:
contents: write
pull-requests: write

jobs:
pixi-update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup pixi
uses: prefix-dev/setup-pixi@v0.8.1
with:
pixi-version: latest
manifest-path: pyproject.toml

- name: Update pixi lockfile
run: |
if [ "${{ github.event.inputs.environments }}" = "all" ] || [ -z "${{ github.event.inputs.environments }}" ]; then
pixi update --json
else
for env in ${{ github.event.inputs.environments }}; do
pixi update --environment $env --json
done
fi

- name: Commit changes
id: commit
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"

# Check if there are changes
if git diff --quiet pixi.lock; then
echo "No changes to pixi.lock"
echo "has_changes=false" >> $GITHUB_OUTPUT
else
git add pixi.lock
git commit -m "chore: update pixi.lock"
echo "has_changes=true" >> $GITHUB_OUTPUT
fi

- name: Create Pull Request
if: steps.commit.outputs.has_changes == 'true'
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: update-pixi-lock-${{ github.run_number }}
title: "chore: update pixi.lock"
body: |
## Automated pixi.lock update

This PR updates the `pixi.lock` file with the latest compatible versions of dependencies.

### What changed
- Updated pixi.lock to use latest compatible package versions
- All version constraints in pyproject.toml are still respected

### How to test
1. `pixi install`
2. `pixi run test_imports`
3. `pixi run test`

---
*This is an automated PR created by the update-lockfiles workflow.*
commit-message: "chore: update pixi.lock"
delete-branch: true
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ build/*
dist/*
.pytest_cache/*
.idea/*
# pixi environments
.pixi/*
!.pixi/config.toml
Loading
Loading