-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from scipp/general-copier-template
Setup from copier_template
- Loading branch information
Showing
58 changed files
with
2,302 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY | ||
_commit: 6770edb | ||
_src_path: gh:scipp/copier_template | ||
description: Common data reduction tools for the ESS facility | ||
max_python: '3.12' | ||
min_python: '3.10' | ||
namespace_package: ess | ||
nightly_deps: '' | ||
orgname: scipp | ||
prettyname: ESSreduce | ||
projectname: essreduce | ||
related_projects: ESSdiffraction,ESSimaging,ESSnmx,ESSpolarization,ESSreflectometry,ESSsans,ESSspectroscopy | ||
year: 2024 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
version: 2 | ||
updates: | ||
# 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: "daily" | ||
allow: | ||
- dependency-name: "scipp" | ||
dependency-type: "direct" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
# Copyright (c) 2023 Scipp contributors (https://github.com/scipp) | ||
|
||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- release | ||
pull_request: | ||
|
||
jobs: | ||
formatting: | ||
name: Formatting and static analysis | ||
runs-on: 'ubuntu-22.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=$(cat .github/workflows/python-version-ci)" >> $GITHUB_OUTPUT | ||
echo "min_tox_env=py$(cat .github/workflows/python-version-ci | sed 's/\.//g')" >> $GITHUB_OUTPUT | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version-file: '.github/workflows/python-version-ci' | ||
- uses: pre-commit/[email protected] | ||
with: | ||
extra_args: --all-files | ||
- uses: pre-commit-ci/[email protected] | ||
if: always() | ||
with: | ||
msg: Apply automatic formatting | ||
|
||
tests: | ||
name: Tests | ||
needs: formatting | ||
strategy: | ||
matrix: | ||
os: ['ubuntu-22.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 }} | ||
|
||
docs: | ||
needs: tests | ||
uses: ./.github/workflows/docs.yml | ||
with: | ||
publish: false | ||
linkcheck: ${{ contains(matrix.variant.os, 'ubuntu') && github.ref == 'refs/heads/main' }} | ||
branch: ${{ github.head_ref == '' && github.ref_name || github.head_ref }} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
# Copyright (c) 2023 Scipp contributors (https://github.com/scipp) | ||
|
||
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-22.04' | ||
steps: | ||
- run: sudo apt install --yes graphviz pandoc | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ inputs.branch == '' && github.ref_name || inputs.branch }} | ||
fetch-depth: 0 # history required so cmake can determine version | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version-file: '.github/workflows/python-version-ci' | ||
- 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@v3 | ||
with: | ||
name: docs_html | ||
path: html/ | ||
|
||
- uses: JamesIves/[email protected] | ||
if: ${{ inputs.publish }} | ||
with: | ||
branch: gh-pages | ||
folder: html | ||
single-commit: true |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
# Copyright (c) 2023 Scipp contributors (https://github.com/scipp) | ||
|
||
name: Nightly test at main branch | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '30 1 * * 1-5' | ||
|
||
jobs: | ||
setup: | ||
name: Setup variables | ||
runs-on: 'ubuntu-22.04' | ||
outputs: | ||
min_python: ${{ steps.vars.outputs.min_python }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Get Python version for other CI jobs | ||
id: vars | ||
run: echo "min_python=$(cat .github/workflows/python-version-ci)" >> $GITHUB_OUTPUT | ||
|
||
tests: | ||
name: Tests | ||
needs: setup | ||
strategy: | ||
matrix: | ||
os: ['ubuntu-22.04'] | ||
python: | ||
- version: '${{needs.setup.outputs.min_python}}' | ||
tox-env: 'nightly' | ||
uses: ./.github/workflows/test.yml | ||
with: | ||
os-variant: ${{ matrix.os }} | ||
python-version: ${{ matrix.python.version }} | ||
tox-env: ${{ matrix.python.tox-env }} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
# Copyright (c) 2023 Scipp contributors (https://github.com/scipp) | ||
|
||
name: Nightly tests at latest release | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: '0 1 * * 1-5' | ||
|
||
jobs: | ||
setup: | ||
name: Setup variables | ||
runs-on: 'ubuntu-22.04' | ||
outputs: | ||
min_python: ${{ steps.vars.outputs.min_python }} | ||
release_tag: ${{ steps.release.outputs.release_tag }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # history required so we can determine latest release tag | ||
- name: Get last release tag from git | ||
id: release | ||
run: echo "release_tag=$(git describe --tags --abbrev=0 --match '[0-9]*.[0-9]*.[0-9]*')" >> $GITHUB_OUTPUT | ||
- name: Get Python version for other CI jobs | ||
id: vars | ||
run: echo "min_python=$(cat .github/workflows/python-version-ci)" >> $GITHUB_OUTPUT | ||
|
||
tests: | ||
name: Tests | ||
needs: setup | ||
strategy: | ||
matrix: | ||
os: ['ubuntu-22.04'] | ||
python: | ||
- version: '${{needs.setup.outputs.min_python}}' | ||
tox-env: 'nightly' | ||
uses: ./.github/workflows/test.yml | ||
with: | ||
os-variant: ${{ matrix.os }} | ||
python-version: ${{ matrix.python.version }} | ||
tox-env: ${{ matrix.python.tox-env }} | ||
checkout_ref: ${{ needs.setup.outputs.release_tag }} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.10 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
# Copyright (c) 2023 Scipp contributors (https://github.com/scipp) | ||
|
||
name: Release | ||
|
||
on: | ||
release: | ||
types: [published] | ||
workflow_dispatch: | ||
|
||
defaults: | ||
run: | ||
shell: bash -l {0} # required for conda env | ||
|
||
jobs: | ||
build_conda: | ||
name: Conda build | ||
runs-on: 'ubuntu-22.04' | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: true | ||
fetch-depth: 0 # history required so setuptools_scm can determine version | ||
|
||
- uses: mamba-org/setup-micromamba@v1 | ||
with: | ||
environment-name: build-env | ||
create-args: >- | ||
conda-build | ||
boa | ||
- run: conda mambabuild --channel conda-forge --channel scipp --no-anaconda-upload --override-channels --output-folder conda/package conda | ||
|
||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: conda-package-noarch | ||
path: conda/package/noarch/*.tar.bz2 | ||
|
||
build_wheels: | ||
name: Wheels | ||
runs-on: 'ubuntu-22.04' | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 # history required so setuptools_scm can determine version | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version-file: '.github/workflows/python-version-ci' | ||
|
||
- run: python -m pip install --upgrade pip | ||
- run: python -m pip install -r requirements/wheels.txt | ||
|
||
- name: Build wheels | ||
run: python -m build | ||
|
||
- name: Upload wheels | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: dist | ||
path: dist | ||
|
||
upload_pypi: | ||
name: Deploy PyPI | ||
needs: [build_wheels, build_conda] | ||
runs-on: 'ubuntu-22.04' | ||
environment: release | ||
permissions: | ||
id-token: write | ||
if: github.event_name == 'release' && github.event.action == 'published' | ||
steps: | ||
- uses: actions/download-artifact@v3 | ||
- uses: pypa/[email protected] | ||
|
||
upload_conda: | ||
name: Deploy Conda | ||
needs: [build_wheels, build_conda] | ||
runs-on: 'ubuntu-22.04' | ||
if: github.event_name == 'release' && github.event.action == 'published' | ||
|
||
steps: | ||
- uses: actions/download-artifact@v3 | ||
- uses: mamba-org/setup-micromamba@v1 | ||
with: | ||
environment-name: upload-env | ||
# frozen python due to breaking removal of 'imp' in 3.12 | ||
create-args: >- | ||
anaconda-client | ||
python=3.11 | ||
- run: anaconda --token ${{ secrets.ANACONDATOKEN }} upload --user scipp --label main $(ls conda-package-noarch/*.tar.bz2) | ||
|
||
docs: | ||
needs: [upload_conda, upload_pypi] | ||
uses: ./.github/workflows/docs.yml | ||
with: | ||
publish: ${{ github.event_name == 'release' && github.event.action == 'published' }} | ||
secrets: inherit | ||
|
||
assets: | ||
name: Upload docs | ||
needs: docs | ||
runs-on: 'ubuntu-22.04' | ||
permissions: | ||
contents: write # This is needed so that the action can upload the asset | ||
steps: | ||
- uses: actions/download-artifact@v3 | ||
- name: Zip documentation | ||
run: | | ||
mv docs_html documentation-${{ github.ref_name }} | ||
zip -r documentation-${{ github.ref_name }}.zip documentation-${{ github.ref_name }} | ||
- name: Upload release assets | ||
uses: svenstaro/upload-release-action@v2 | ||
with: | ||
file: ./documentation-${{ github.ref_name }}.zip | ||
overwrite: false |
Oops, something went wrong.