Skip to content

Commit

Permalink
Merge branch 'github-update' into 'main'
Browse files Browse the repository at this point in the history
Update deploytools for GitHub

See merge request controls/python3/deploytools!3
  • Loading branch information
MJGaughran committed Aug 27, 2024
2 parents 19ef149 + 75b6d81 commit 8053101
Show file tree
Hide file tree
Showing 64 changed files with 167 additions and 402 deletions.
17 changes: 8 additions & 9 deletions .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
# Changes here will be overwritten by Copier
_commit: 2.1.0
_commit: 2.2.0
_src_path: gh:DiamondLightSource/python-copier-template
author_email: [email protected]
author_name: Martin Gaughran
component_owner: ''
description: A collection of tools used for deploying applications at Diamond Light
Source
distribution_name: deploytools
component_owner: group:default/sscc
description: A set of tools used for deploying applications to a shared filesystem.
distribution_name: dls-deploy-tools
docker: false
docs_type: README
git_platform: github.com
github_org: MJGaughran
package_name: deploytools
pypi: false
repo_name: deploytools
github_org: DiamondLightSource
package_name: deploy_tools
pypi: true
repo_name: deploy-tools
type_checker: pyright
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@
"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"
}
}
6 changes: 3 additions & 3 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Contribute to the project

Contributions and issues are most welcome! All issues and pull requests are
handled through [GitHub](https://github.com/MJGaughran/deploytools/issues). Also, please check for any existing issues before
handled through [GitHub](https://github.com/DiamondLightSource/deploy-tools/issues). Also, please check for any existing issues before
filing a new one. If you have a great idea but it involves big changes, please
file a ticket before making a pull request! We want to make sure you don't spend
your time coding something that might not fit the scope of the project.

## Issue or Discussion?

Github also offers [discussions](https://github.com/MJGaughran/deploytools/discussions) as a place to ask questions and share ideas. If
Github also offers [discussions](https://github.com/DiamondLightSource/deploy-tools/discussions) as a place to ask questions and share ideas. If
your issue is open ended and it is not obvious when it can be "closed", please
raise it as a discussion instead.

Expand All @@ -24,4 +24,4 @@ It is recommended that developers use a [vscode devcontainer](https://code.visua

This project was created using the [Diamond Light Source Copier Template](https://github.com/DiamondLightSource/python-copier-template) for Python projects.

For more information on common tasks like setting up a developer environment, running the tests, and setting a pre-commit hook, see the template's [How-to guides](https://diamondlightsource.github.io/python-copier-template/2.1.0/how-to.html).
For more information on common tasks like setting up a developer environment, running the tests, and setting a pre-commit hook, see the template's [How-to guides](https://diamondlightsource.github.io/python-copier-template/2.2.0/how-to.html).
21 changes: 21 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
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
13 changes: 13 additions & 0 deletions .github/ISSUE_TEMPLATE/issue.md
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
8 changes: 8 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/pull_request_template.md
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
2 changes: 1 addition & 1 deletion .github/pages/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
<link rel="canonical" href="main/index.html">
</head>

</html>
</html>
11 changes: 5 additions & 6 deletions .github/pages/make_switcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,27 @@
from argparse import ArgumentParser
from pathlib import Path
from subprocess import CalledProcessError, check_output
from typing import List, Optional


def report_output(stdout: bytes, label: str) -> List[str]:
def report_output(stdout: bytes, label: str) -> list[str]:
ret = stdout.decode().strip().split("\n")
print(f"{label}: {ret}")
return ret


def get_branch_contents(ref: str) -> List[str]:
def get_branch_contents(ref: str) -> list[str]:
"""Get the list of directories in a branch."""
stdout = check_output(["git", "ls-tree", "-d", "--name-only", ref])
return report_output(stdout, "Branch contents")


def get_sorted_tags_list() -> List[str]:
def get_sorted_tags_list() -> list[str]:
"""Get a list of sorted tags in descending order from the repository."""
stdout = check_output(["git", "tag", "-l", "--sort=-v:refname"])
return report_output(stdout, "Tags list")


def get_versions(ref: str, add: Optional[str]) -> List[str]:
def get_versions(ref: str, add: str | None) -> list[str]:
"""Generate the file containing the list of all GitHub Pages builds."""
# Get the directories (i.e. builds) from the GitHub Pages branch
try:
Expand All @@ -41,7 +40,7 @@ def get_versions(ref: str, add: Optional[str]) -> List[str]:
tags = get_sorted_tags_list()

# Make the sorted versions list from main branches and tags
versions: List[str] = []
versions: list[str] = []
for version in ["master", "main"] + tags:
if version in builds:
versions.append(version)
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/_pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
on:
workflow_call:

jobs:
upload:
runs-on: ubuntu-latest
environment: release

steps:
- name: Download dist artifact
uses: actions/download-artifact@v4
with:
name: dist
path: dist

- name: Publish to PyPI using trusted publishing
uses: pypa/gh-action-pypi-publish@release/v1
2 changes: 1 addition & 1 deletion .github/workflows/_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Create GitHub Release
# We pin to the SHA, not the tag, for security reasons.
# https://docs.github.com/en/actions/learn-github-actions/security-hardening-for-github-actions#using-third-party-actions
uses: softprops/action-gh-release@9d7c94cfd0a1f3ed45544c887983e9fa900f0564 # v2.0.4
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # v2.0.8
with:
prerelease: ${{ contains(github.ref_name, 'a') || contains(github.ref_name, 'b') || contains(github.ref_name, 'rc') }}
files: "*"
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
strategy:
matrix:
runs-on: ["ubuntu-latest"] # can add windows-latest, macos-latest
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.10", "3.11", "3.12"]
include:
# Include one that runs in the dev environment
- runs-on: "ubuntu-latest"
Expand All @@ -39,6 +39,13 @@ jobs:
if: needs.check.outputs.branch-pr == ''
uses: ./.github/workflows/_dist.yml

pypi:
if: github.ref_type == 'tag'
needs: dist
uses: ./.github/workflows/_pypi.yml
permissions:
id-token: write

release:
if: github.ref_type == 'tag'
needs: [dist]
Expand Down
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ repos:
- id: check-added-large-files
- id: check-yaml
- id: check-merge-conflict
- id: end-of-file-fixer

- repo: local
hooks:
Expand Down
2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
"recommendations": [
"ms-vscode-remote.remote-containers",
]
}
}
12 changes: 6 additions & 6 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"type": "debugpy",
"request": "launch",
"justMyCode": false,
"program": "/venv/bin/deploytools",
"program": "/venv/bin/deploy-tools",
"args": "schema ${input:schema-folder}",
"console": "integratedTerminal",
"env": {
Expand All @@ -37,7 +37,7 @@
"type": "debugpy",
"request": "launch",
"justMyCode": false,
"program": "/venv/bin/deploytools",
"program": "/venv/bin/deploy-tools",
"args": "validate ${input:deploy-folder} ${input:config-folder}",
"console": "integratedTerminal",
"env": {
Expand All @@ -50,7 +50,7 @@
"type": "debugpy",
"request": "launch",
"justMyCode": false,
"program": "/venv/bin/deploytools",
"program": "/venv/bin/deploy-tools",
"args": "sync ${input:deploy-folder} ${input:config-folder}",
"console": "integratedTerminal",
"env": {
Expand All @@ -63,7 +63,7 @@
{
"id": "schema-folder",
"description": "Schema output folder",
"default": "${workspaceFolder}/src/deploytools/models/schemas/",
"default": "${workspaceFolder}/src/deploy_tools/models/schemas/",
"type": "promptString"
},
{
Expand All @@ -75,8 +75,8 @@
{
"id": "config-folder",
"description": "Configuration folder",
"default": "${workspaceFolder}/src/deploytools/demo_configuration/",
"default": "${workspaceFolder}/src/deploy_tools/demo_configuration/",
"type": "promptString"
},
]
}
}
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit"
},
"files.insertFinalNewline": true,
"[python]": {
"editor.defaultFormatter": "charliermarsh.ruff",
},
"terminal.integrated.env.linux": {
"MODULEPATH": "${workspaceFolder}/demo-output/modulefiles/"
},
}
}
12 changes: 6 additions & 6 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
{
"label": "Generate schema",
"type": "shell",
"command": "deploytools schema ${input:schema-folder}",
"command": "deploy-tools schema ${input:schema-folder}",
"problemMatcher": []
},
{
"label": "Sync modules",
"type": "shell",
"command": "deploytools sync ${input:deploy-folder} ${input:config-folder}",
"command": "deploy-tools sync ${input:deploy-folder} ${input:config-folder}",
"problemMatcher": []
},
{
Expand All @@ -33,15 +33,15 @@
{
"label": "Validate deployment",
"type": "shell",
"command": "deploytools validate ${input:deploy-folder} ${input:config-folder}",
"command": "deploy-tools validate ${input:deploy-folder} ${input:config-folder}",
"problemMatcher": []
},
],
"inputs": [
{
"id": "schema-folder",
"description": "Schema output folder",
"default": "${workspaceFolder}/src/deploytools/models/schemas/",
"default": "${workspaceFolder}/src/deploy_tools/models/schemas/",
"type": "promptString"
},
{
Expand All @@ -53,8 +53,8 @@
{
"id": "config-folder",
"description": "Configuration folder",
"default": "${workspaceFolder}/src/deploytools/demo_configuration/",
"default": "${workspaceFolder}/src/deploy_tools/demo_configuration/",
"type": "promptString"
},
]
}
}
27 changes: 15 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
[![CI](https://github.com/MJGaughran/deploytools/actions/workflows/ci.yml/badge.svg)](https://github.com/MJGaughran/deploytools/actions/workflows/ci.yml)
[![Coverage](https://codecov.io/gh/MJGaughran/deploytools/branch/main/graph/badge.svg)](https://codecov.io/gh/MJGaughran/deploytools)

[![CI](https://github.com/DiamondLightSource/deploy-tools/actions/workflows/ci.yml/badge.svg)](https://github.com/DiamondLightSource/deploy-tools/actions/workflows/ci.yml)
[![Coverage](https://codecov.io/gh/DiamondLightSource/deploy-tools/branch/main/graph/badge.svg)](https://codecov.io/gh/DiamondLightSource/deploy-tools)
[![PyPI](https://img.shields.io/pypi/v/dls-deploy-tools.svg)](https://pypi.org/project/dls-deploy-tools)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

# deploytools
# deploy_tools

A set of tools used for deploying applications to a shared filesystem.

A collection of tools used for deploying applications to the shared filesystem at
Diamond Light Source.
This is used for deploying containerised desktop applications to many users who have
access to a shared filesystem.

Source | <https://github.com/MJGaughran/deploytools>
Source | <https://github.com/DiamondLightSource/deploy-tools>
:---: | :---:
Releases | <https://github.com/MJGaughran/deploytools/releases>
PyPI | `pip install dls-deploy-tools`
Releases | <https://github.com/DiamondLightSource/deploy-tools/releases>

The demo_configuration folder can be passed as the config_folder to the deploytools
The demo_configuration folder can be passed as the config_folder to the deploy-tools
commands. The deployment_root just needs to be a writeable location for all files to get
deployed under.

Expand All @@ -28,14 +31,14 @@ config_folder = /path/to/config/folder
schema_folder = /path/to/schema/folder
# Generate the schema for configuration yaml files
python -m deploytools schema $schema_folder
python -m deploy_tools schema $schema_folder
# Validate the deployment configuration files, also ensuring that the required updates
# are compatible with the previous deployments.
python -m deploytools validate $deployment_root $config_folder
python -m deploy_tools validate $deployment_root $config_folder
# Synchronise the deployment area with the configuration files. This will first run
# validation
python -m deploytools sync $deployment_root $config_folder
python -m deploy_tools sync $deployment_root $config_folder
```
8 changes: 4 additions & 4 deletions catalog-info.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: deploytools
title: deploytools
description: A collection of tools used for deploying applications at Diamond Light Source
name: dls-deploy-tools
title: deploy-tools
description: A set of tools used for deploying applications to a shared filesystem.
spec:
type: documentation
lifecycle: experimental
owner:
owner: group:default/sscc
Loading

0 comments on commit 8053101

Please sign in to comment.