-
Notifications
You must be signed in to change notification settings - Fork 32
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 #320 from bluesky/adopt-copier-template
Adopt copier template
- Loading branch information
Showing
108 changed files
with
1,242 additions
and
1,355 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,15 @@ | ||
# Changes here will be overwritten by Copier | ||
_commit: 2.3.0 | ||
_src_path: gh:DiamondLightSource/python-copier-template | ||
author_email: [email protected] | ||
author_name: Brookhaven National Lab | ||
description: Data model used by the bluesky ecosystem. | ||
distribution_name: event-model | ||
docker: false | ||
docs_type: sphinx | ||
git_platform: github.com | ||
github_org: bluesky | ||
package_name: event_model | ||
pypi: true | ||
repo_name: event-model | ||
type_checker: mypy |
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,46 @@ | ||
// For format details, see https://containers.dev/implementors/json_reference/ | ||
{ | ||
"name": "Python 3 Developer Container", | ||
"build": { | ||
"dockerfile": "../Dockerfile", | ||
"target": "developer" | ||
}, | ||
"remoteEnv": { | ||
// Allow X11 apps to run inside the container | ||
"DISPLAY": "${localEnv:DISPLAY}" | ||
}, | ||
"customizations": { | ||
"vscode": { | ||
// Set *default* container specific settings.json values on container create. | ||
"settings": { | ||
"python.defaultInterpreterPath": "/venv/bin/python" | ||
}, | ||
// Add the IDs of extensions you want installed when the container is created. | ||
"extensions": [ | ||
"ms-python.python", | ||
"github.vscode-github-actions", | ||
"tamasfe.even-better-toml", | ||
"redhat.vscode-yaml", | ||
"ryanluker.vscode-coverage-gutters", | ||
"charliermarsh.ruff", | ||
"ms-azuretools.vscode-docker" | ||
] | ||
} | ||
}, | ||
"features": { | ||
// Some default things like git config | ||
"ghcr.io/devcontainers/features/common-utils:2": { | ||
"upgradePackages": false | ||
} | ||
}, | ||
"runArgs": [ | ||
// Allow the container to access the host X11 display and EPICS CA | ||
"--net=host", | ||
// Make sure SELinux does not disable with access to host filesystems like tmp | ||
"--security-opt=label=disable" | ||
], | ||
// Mount the parent as /workspaces so we can pip install peers as editable | ||
"workspaceMount": "source=${localWorkspaceFolder}/..,target=/workspaces,type=bind", | ||
// After the container is created, install the python project in editable form | ||
"postCreateCommand": "pip install $([ -f dev-requirements.txt ] && echo '-c dev-requirements.txt') -e '.[dev]' && pre-commit install" | ||
} |
This file was deleted.
Oops, something went wrong.
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,21 @@ | ||
--- | ||
name: Bug Report | ||
about: The template to use for reporting bugs and usability issues | ||
title: " " | ||
labels: 'bug' | ||
assignees: '' | ||
|
||
--- | ||
|
||
Describe the bug, including a clear and concise description of the expected behavior, the actual behavior and the context in which you encountered it (ideally include details of your environment). | ||
|
||
## Steps To Reproduce | ||
Steps to reproduce the behavior: | ||
1. Go to '...' | ||
2. Click on '....' | ||
3. Scroll down to '....' | ||
4. See error | ||
|
||
|
||
## Acceptance Criteria | ||
- Specific criteria that will be used to judge if the issue is fixed |
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 @@ | ||
--- | ||
name: Issue | ||
about: The standard template to use for feature requests, design discussions and tasks | ||
title: " " | ||
labels: '' | ||
assignees: '' | ||
|
||
--- | ||
|
||
A brief description of the issue, including specific stakeholders and the business case where appropriate | ||
|
||
## Acceptance Criteria | ||
- Specific criteria that will be used to judge if the issue is fixed |
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,8 @@ | ||
Fixes #ISSUE | ||
|
||
### Instructions to reviewer on how to test: | ||
1. Do thing x | ||
2. Confirm thing y happens | ||
|
||
### Checks for reviewer | ||
- [ ] Would the PR title make sense to a user on a set of release notes |
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 |
---|---|---|
@@ -1,62 +1,34 @@ | ||
name: Install requirements | ||
description: Run pip install with requirements and upload resulting requirements | ||
description: Install a version of python then call pip install and report what was installed | ||
inputs: | ||
requirements_file: | ||
description: Name of requirements file to use and upload | ||
required: true | ||
install_options: | ||
python-version: | ||
description: Python version to install, default is from Dockerfile | ||
default: "dev" | ||
pip-install: | ||
description: Parameters to pass to pip install | ||
required: true | ||
python_version: | ||
description: Python version to install | ||
default: "3.x" | ||
jsonschema_version: | ||
description: version of the jsonschema pip package to install | ||
default: 4 | ||
default: "$([ -f dev-requirements.txt ] && echo '-c dev-requirements.txt') -e .[dev]" | ||
|
||
runs: | ||
using: composite | ||
|
||
steps: | ||
- name: Setup python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ inputs.python_version }} | ||
|
||
- name: Pip install | ||
run: | | ||
touch ${{ inputs.requirements_file }} | ||
# -c uses requirements.txt as constraints, see 'Validate requirements file' | ||
pip install -c ${{ inputs.requirements_file }} ${{ inputs.install_options }} | ||
pip install --upgrade "jsonschema==${{inputs.jsonschema_version}}.*" | ||
shell: bash | ||
|
||
- name: Create lockfile | ||
- name: Get version of python | ||
run: | | ||
mkdir -p lockfiles | ||
pip freeze --exclude-editable > lockfiles/${{ inputs.requirements_file }} | ||
# delete the self referencing line and make sure it isn't blank | ||
sed -i '/file:/d' lockfiles/${{ inputs.requirements_file }} | ||
PYTHON_VERSION="${{ inputs.python-version }}" | ||
if [ $PYTHON_VERSION == "dev" ]; then | ||
PYTHON_VERSION=$(sed -n "s/ARG PYTHON_VERSION=//p" Dockerfile) | ||
fi | ||
echo "PYTHON_VERSION=$PYTHON_VERSION" >> "$GITHUB_ENV" | ||
shell: bash | ||
|
||
- name: Upload lockfiles | ||
uses: actions/upload-artifact@v3 | ||
- name: Setup python | ||
uses: actions/setup-python@v5 | ||
with: | ||
name: lockfiles | ||
path: lockfiles | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
|
||
# This eliminates the class of problems where the requirements being given no | ||
# longer match what the packages themselves dictate. E.g. In the rare instance | ||
# where I install some-package which used to depend on vulnerable-dependency | ||
# but now uses good-dependency (despite being nominally the same version) | ||
# pip will install both if given a requirements file with -r | ||
- name: If requirements file exists, check it matches pip installed packages | ||
run: | | ||
if [ -s ${{ inputs.requirements_file }} ]; then | ||
if ! diff -u ${{ inputs.requirements_file }} lockfiles/${{ inputs.requirements_file }}; then | ||
echo "Error: ${{ inputs.requirements_file }} need the above changes to be exhaustive" | ||
exit 1 | ||
fi | ||
fi | ||
- name: Install packages | ||
run: pip install ${{ inputs.pip-install }} | ||
shell: bash | ||
|
||
- name: Report what was installed | ||
run: pip freeze | ||
shell: bash |
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
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 |
---|---|---|
|
@@ -8,4 +8,4 @@ | |
<link rel="canonical" href="main/index.html"> | ||
</head> | ||
|
||
</html> | ||
</html> |
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
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,27 @@ | ||
on: | ||
workflow_call: | ||
outputs: | ||
branch-pr: | ||
description: The PR number if the branch is in one | ||
value: ${{ jobs.pr.outputs.branch-pr }} | ||
|
||
jobs: | ||
pr: | ||
runs-on: "ubuntu-latest" | ||
outputs: | ||
branch-pr: ${{ steps.script.outputs.result }} | ||
steps: | ||
- uses: actions/github-script@v7 | ||
id: script | ||
if: github.event_name == 'push' | ||
with: | ||
script: | | ||
const prs = await github.rest.pulls.list({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
head: context.repo.owner + ':${{ github.ref_name }}' | ||
}) | ||
if (prs.data.length) { | ||
console.log(`::notice ::Skipping CI on branch push as it is already run in PR #${prs.data[0]["number"]}`) | ||
return prs.data[0]["number"] | ||
} |
Oops, something went wrong.