Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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
13 changes: 11 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
# Note: We are not listing package-ecosystem: "github-actions". This causes
# noise in all template instances. Instead dependabot.yml in scipp/copier_template
# triggers updates of github-actions in the *template*. We then use `copier update`
# in template instances.
- package-ecosystem: "pip"
directory: "/requirements"
schedule:
interval: "weekly"
target-branch: "main"
allow:
- dependency-name: "scipp"
dependency-type: "direct"
- dependency-name: "mcstasscript"
dependency-type: "direct"
58 changes: 58 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: CI

on:
push:
branches:
- main
- release
pull_request:

jobs:
# formatting:
# name: Formatting and static analysis
# runs-on: 'ubuntu-24.04'
# outputs:
# min_python: ${{ steps.vars.outputs.min_python }}
# min_tox_env: ${{ steps.vars.outputs.min_tox_env }}
# steps:
# - uses: actions/checkout@v4
# - name: Get Python version for other CI jobs
# id: vars
# run: |
# echo "min_python=$(< .github/workflows/python-version-ci)" >> "$GITHUB_OUTPUT"
# echo "min_tox_env=py$(sed 's/\.//g' < .github/workflows/python-version-ci)" >> "$GITHUB_OUTPUT"
# - uses: actions/setup-python@v5
# with:
# python-version-file: '.github/workflows/python-version-ci'
# - uses: pre-commit/action@v3.0.1
# with:
# extra_args: --all-files
# - uses: pre-commit-ci/lite-action@v1.1.0
# if: always()
# with:
# msg: Apply automatic formatting

# tests:
# name: Tests
# needs: formatting
# strategy:
# matrix:
# os: ['ubuntu-24.04']
# python:
# - version: '${{needs.formatting.outputs.min_python}}'
# tox-env: '${{needs.formatting.outputs.min_tox_env}}'
# uses: ./.github/workflows/test.yml
# with:
# os-variant: ${{ matrix.os }}
# python-version: ${{ matrix.python.version }}
# tox-env: ${{ matrix.python.tox-env }}
# secrets: inherit

docs:
# needs: tests
uses: ./.github/workflows/docs.yml
with:
publish: false
linkcheck: ${{ github.ref == 'refs/heads/main' }}
branch: ${{ github.head_ref == '' && github.ref_name || github.head_ref }}
secrets: inherit
82 changes: 82 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Docs

on:
workflow_dispatch:
inputs:
publish:
default: false
type: boolean
version:
default: ''
required: false
type: string
branch:
description: 'Branch/tag with documentation source. If not set, the current branch will be used.'
default: ''
required: false
type: string
workflow_call:
inputs:
publish:
default: false
type: boolean
version:
default: ''
required: false
type: string
branch:
description: 'Branch/tag with documentation source. If not set, the current branch will be used.'
default: ''
required: false
type: string
linkcheck:
description: 'Run the link checker. If not set the link checker will not be run.'
default: false
required: false
type: boolean

env:
VERSION: ${{ inputs.version }}

jobs:
docs:
name: Build documentation
runs-on: 'ubuntu-24.04'
env:
ESS_PROTECTED_FILESTORE_USERNAME: ${{ secrets.ESS_PROTECTED_FILESTORE_USERNAME }}
ESS_PROTECTED_FILESTORE_PASSWORD: ${{ secrets.ESS_PROTECTED_FILESTORE_PASSWORD }}

steps:
- run: sudo apt install --yes graphviz pandoc
- uses: actions/checkout@v4
with:
ref: ${{ inputs.branch == '' && github.ref_name || inputs.branch }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: 0 # history required so cmake can determine version
- uses: actions/setup-python@v5
with:
python-version-file: '.github/workflows/python-version-ci'
- uses: mamba-org/setup-micromamba@v2
with:
init-shell: bash
- run: python -m pip install --upgrade pip
- run: python -m pip install -r requirements/ci.txt
- run: tox -e releasedocs -- "${VERSION}"
if: ${{ inputs.version != '' }}
- run: tox -e docs
if: ${{ inputs.version == '' }}
- run: tox -e linkcheck
if: ${{ inputs.linkcheck }}
- uses: actions/upload-artifact@v4
id: artifact-upload-step
with:
name: docs_html
path: html/
- run: echo "::notice::https://remote-unzip.deno.dev/${{ github.repository }}/artifacts/${{ steps.artifact-upload-step.outputs.artifact-id }}"

- uses: JamesIves/github-pages-deploy-action@v4.7.3
if: ${{ inputs.publish }}
with:
branch: gh-pages
folder: html
single-commit: true
1 change: 1 addition & 0 deletions .github/workflows/python-version-ci
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.10
79 changes: 79 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Test

on:
workflow_dispatch:
inputs:
os-variant:
default: 'ubuntu-24.04'
type: string
python-version:
type: string
tox-env:
default: 'test'
type: string
pip-recipe:
default: 'requirements/ci.txt'
type: string
coverage-report:
default: false
type: boolean
checkout_ref:
default: ''
type: string
workflow_call:
inputs:
os-variant:
default: 'ubuntu-24.04'
type: string
python-version:
type: string
tox-env:
default: 'test'
type: string
pip-recipe:
default: 'requirements/ci.txt'
type: string
coverage-report:
default: false
type: boolean
checkout_ref:
default: ''
type: string

jobs:
package-test:
runs-on: ${{ inputs.os-variant }}

steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.checkout_ref }}
- uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- run: python -m pip install --upgrade pip
- run: python -m pip install .
- run: python tests/package_test.py
name: Run package tests

test:
runs-on: ${{ inputs.os-variant }}
env:
ESS_PROTECTED_FILESTORE_USERNAME: ${{ secrets.ESS_PROTECTED_FILESTORE_USERNAME }}
ESS_PROTECTED_FILESTORE_PASSWORD: ${{ secrets.ESS_PROTECTED_FILESTORE_PASSWORD }}

steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.checkout_ref }}
- uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- run: python -m pip install --upgrade pip
- run: python -m pip install -r ${{ inputs.pip-recipe }}
- run: tox -e ${{ inputs.tox-env }}
- uses: actions/upload-artifact@v4
if: ${{ inputs.coverage-report }}
with:
name: CoverageReport
path: coverage_html/
5 changes: 3 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ commands = pytest {posargs}
description = invoke sphinx-build to build the HTML docs
deps = -r requirements/docs.txt
allowlist_externals=find
mamba
commands = mamba install mcstas=3.5 -y
micromamba
commands = micromamba install -c conda-forge mcstas=3.5 -y
mcstas --version
python -m sphinx -j2 -v -b html -d {toxworkdir}/docs_doctrees docs html
python -m sphinx -j2 -v -b doctest -d {toxworkdir}/docs_doctrees docs html
find html -type f -name "*.ipynb" -not -path "html/_sources/*" -delete
Expand Down
Loading