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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/dev_sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: Checkout repo
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
fetch-depth: 0 # Needed to switch branches
ref: next # Explicitly specify the branch to check out
Expand Down
57 changes: 42 additions & 15 deletions .github/workflows/test_and_deploy.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
name: testing


on:
workflow_dispatch:
pull_request:
push:
branches: [next, qa, main]
tags: ['v*']
tags: ["v*"]

# cancel previous job if new commit is pushed
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
PKG_NAME: usansred
Expand All @@ -16,15 +20,14 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
fetch-depth: 0
fetch-tags: true

- name: Setup pixi
uses: prefix-dev/setup-pixi@v0.8.10
uses: prefix-dev/setup-pixi@v0.9.3
with:
pixi-version: v0.49.0
manifest-path: pyproject.toml

- name: Run unit tests
Expand All @@ -46,16 +49,14 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
fetch-depth: 100
fetch-tags: true
ref: ${{ github.ref }}

- name: Setup Pixi
uses: prefix-dev/setup-pixi@v0.8.10
with:
pixi-version: v0.49.0
uses: prefix-dev/setup-pixi@v0.9.3

- name: Build conda package
run: |
Expand All @@ -77,12 +78,11 @@ jobs:
pixi run python -c "import finddata"

- name: Upload conda package as artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v6.0.0
with:
name: artifact-conda-package
path: ${{ env.PKG_NAME }}-*.conda


# Publish the package as a separate job so that the Github Actions webpage
# shows it as a separate step in the CI workflow
publish:
Expand All @@ -92,19 +92,18 @@ jobs:
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6
with:
fetch-depth: 0
fetch-tags: true

- name: Setup Pixi
uses: prefix-dev/setup-pixi@v0.8.10
uses: prefix-dev/setup-pixi@v0.9.3
with:
pixi-version: v0.49.0
manifest-path: pyproject.toml

- name: Download conda package artifact
uses: actions/download-artifact@v4
uses: actions/download-artifact@v7.0.0
with:
name: artifact-conda-package

Expand All @@ -118,3 +117,31 @@ jobs:
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

# Trigger GitLab dev deploy pipeline
deploy-dev:
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/next'
steps:
- name: Get Environment Name
uses: neutrons/branch-mapper@main
id: env_name
with:
prefix: usansred

- 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: 19016
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 for this commit: ${{ steps.trigger.outputs.web_url }}
6 changes: 3 additions & 3 deletions .github/workflows/update-lockfiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Setup pixi
uses: prefix-dev/setup-pixi@v0.8.10
uses: prefix-dev/setup-pixi@v0.9.3
with:
run-install: false

Expand All @@ -28,7 +28,7 @@ jobs:
pixi update --json | pixi exec pixi-diff-to-markdown >> diff.md

- name: Create pull request
uses: peter-evans/create-pull-request@v7
uses: peter-evans/create-pull-request@v8
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update pixi lockfile
Expand Down
25 changes: 14 additions & 11 deletions pixi.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

57 changes: 33 additions & 24 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ artifacts = [
"reduction/usansred/_version.py",
"reduction/usansred/**/*.yml",
"reduction/usansred/**/*.yaml",
"reduction/usansred/**/*.ini"
"reduction/usansred/**/*.ini",
]

[tool.hatch.build.targets.wheel]
Expand All @@ -60,22 +60,30 @@ distance-dirty = "{next_version}.dev{distance}"
file = "src/usansred/_version.py"

[tool.pytest.ini_options]
pythonpath = [
".", "src", "scripts"
]
pythonpath = [".", "src", "scripts"]
testpaths = ["tests"]
python_files = ["test*.py"]
norecursedirs = [".git", "tmp*", "_tmp*", "__pycache__", "*dataset*", "*data_set*"]
norecursedirs = [
".git",
"tmp*",
"_tmp*",
"__pycache__",
"*dataset*",
"*data_set*",
]
markers = [
"datarepo: using repository usansred-data",
"sns_mounted: requires the /SNS filesystem"
"datarepo: using repository usansred-data",
"sns_mounted: requires the /SNS filesystem",
]

[tool.ruff]
line-length = 120
# https://beta.ruff.rs/docs/rules/
lint.select = ["A", "ARG", "BLE", "E", "F", "I", "PT"]
lint.ignore = ["F403", "F405", "F401", # wild imports and unknown names
lint.ignore = [
"F403",
"F405",
"F401", # wild imports and unknown names
]

###################
Expand All @@ -85,16 +93,17 @@ lint.ignore = ["F403", "F405", "F401", # wild imports and unknown names
[tool.pixi.workspace]
name = "usansred"
preview = ["pixi-build"]
channels = [
"conda-forge",
"mantid/label/main",
"neutrons"
]
channels = ["conda-forge", "mantid/label/main", "neutrons"]
platforms = ["linux-64"]

[tool.pixi.environments]
default = {features = ["test", "package", "docs", "developer"], solve-group = "default"}
docs = {features = ["docs"], solve-group = "docs"}
default = { features = [
"test",
"package",
"docs",
"developer",
], solve-group = "default" }
docs = { features = ["docs"], solve-group = "docs" }

[tool.pixi.pypi-dependencies]
usansred = { path = ".", editable = true }
Expand All @@ -104,35 +113,35 @@ python = "=3.11"
mantidworkbench = ">=6.13.0,<6.14.0"
pandas = "*"
xlsxwriter = "*"
finddata = {version = "=0.10.1", channel="neutrons"}
finddata = { version = "=0.10.1", channel = "neutrons" }

# Conda packages (no PyPi) to be enumerated within the conda package to be built.
[tool.pixi.package.run-dependencies]
python = "=3.11"
mantidworkbench = ">=6.13.0,<6.14.0"
pandas = "*"
xlsxwriter = "*"
finddata = {version = "=0.10.1", channel="neutrons"}
finddata = { version = "=0.10.1", channel = "neutrons" }

[tool.pixi.package]
name = "usansred"
version = "1.0.0" # placeholder, overwritten by sync-version
version = "1.0.0" # placeholder, overwritten by sync-version

[tool.pixi.package.build]
backend = { name = "pixi-build-python", version = "0.1.*" }
channels = [
backend = { name = "pixi-build-python", version = "0.4.*", channels = [
"https://prefix.dev/pixi-build-backends",
"https://prefix.dev/conda-forge",
]

] }

[tool.pixi.tasks]
# Documentation
build-docs = { cmd = 'sphinx-build -b html docs docs/_build', description = "Build documentation" }
test-docs = { cmd = "sphinx-build -M doctest docs docs/_build", description = "Test building the documentation" }
# Testing
test = { description = "Run the test suite", cmd = "pytest" }
unit-test = {description = "Run the unit tests", cmd = "python -m pytest -vv -m \"not datarepo and not sns_mounted\" --cov=src --cov-report=xml --cov-report=term-missing tests/ && mv .coverage .coverage.unit"}
integration-test = {description = "Run the integration tests", cmd = "git submodule update --init && python -m pytest -vv -m \"datarepo\" --cov=src --cov-report=xml --cov-report=term-missing tests/ && mv .coverage .coverage.integration"}
unit-test = { description = "Run the unit tests", cmd = "python -m pytest -vv -m \"not datarepo and not sns_mounted\" --cov=src --cov-report=xml --cov-report=term-missing tests/ && mv .coverage .coverage.unit" }
integration-test = { description = "Run the integration tests", cmd = "git submodule update --init && python -m pytest -vv -m \"datarepo\" --cov=src --cov-report=xml --cov-report=term-missing tests/ && mv .coverage .coverage.integration" }
# Packaging
pypi-build = { cmd = "hatch build", description = "Build the package for PyPI" }
conda-build-command = { cmd = "pixi build", description = "Build the conda package command" }
Expand All @@ -157,7 +166,7 @@ clean-all = { description = "Clean all artifacts", depends-on = [
"clean-docs",
"clean-pypi",
] }
combine-coverage = {description = "Combine coverage reports", cmd = "coverage combine"}
combine-coverage = { description = "Combine coverage reports", cmd = "coverage combine" }
sync-version = { cmd = 'version=$(python -m versioningit); toml set tool.pixi.package.version "$version" --toml-path pyproject.toml', description = "Sync pyproject.toml version with Git version" }
backup-toml = { cmd = "cp pyproject.toml pyproject.toml.bak", description = "Backup the pyproject.toml file" }
reset-toml = { cmd = "cp pyproject.toml.bak pyproject.toml; rm pyproject.toml.bak", description = "Reset the pyproject.toml file to the original state" }
Expand Down
Loading