Skip to content

Commit f570406

Browse files
authored
Merge pull request #47 from DiamondLightSource/copier-update
Update copier template and enable publishing of container: - Updated dockerfile so that running the container with defaults works properly - Stopped using newer pyAT as this is broken for us - Updated to the latest copier version. - Enabled upload of built container - Added --version option to virtac
2 parents d0317c0 + 9f9d36a commit f570406

File tree

18 files changed

+129
-54
lines changed

18 files changed

+129
-54
lines changed

.copier-answers.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Changes here will be overwritten by Copier
2-
_commit: 2.6.0
2+
_commit: 4.0.1
33
_src_path: gh:DiamondLightSource/python-copier-template
44
author_email: [email protected]
55
author_name: Tobyn Nicholls
@@ -8,7 +8,7 @@ component_owner: group:default/high-level-apps
88
component_type: library
99
description: Accelerator Toolbox Interface for Pytac
1010
distribution_name: atip
11-
docker: false
11+
docker: true
1212
docs_type: sphinx
1313
git_platform: github.com
1414
github_org: DiamondLightSource

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
},
3030
"features": {
3131
// add in eternal history and other bash features
32-
"ghcr.io/diamondlightsource/devcontainer-features/bash-config:1.0.0": {}
32+
"ghcr.io/diamondlightsource/devcontainer-features/bash-config:1": {}
3333
},
3434
// Create the config folder for the bash-config feature
3535
"initializeCommand": "mkdir -p ${localEnv:HOME}/.config/bash-config",

.github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ It is recommended that developers use a [vscode devcontainer](https://code.visua
2424

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

27-
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.6.0/how-to.html).
27+
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/4.0.1/how-to.html).

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ assignees: ''
77

88
---
99

10-
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).
10+
Describe the bug, including a clear and concise description of the expected behaviour, the actual behavior and the context in which you encountered it (ideally include details of your environment).
1111

1212
## Steps To Reproduce
1313
Steps to reproduce the behavior:

.github/actions/install_requirements/action.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ runs:
1515
run: |
1616
PYTHON_VERSION="${{ inputs.python-version }}"
1717
if [ $PYTHON_VERSION == "dev" ]; then
18-
PYTHON_VERSION=$(sed -n "s/ARG PYTHON_VERSION=//p" Dockerfile)
18+
# python version from Dockerfile, removing potential pinned sha
19+
PYTHON_VERSION=$(sed -Ene "s/ARG PYTHON_VERSION=([0-9\.]+).*/\1/p" Dockerfile)
1920
fi
2021
echo "PYTHON_VERSION=$PYTHON_VERSION" >> "$GITHUB_ENV"
2122
shell: bash

.github/dependabot.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ updates:
1313
actions:
1414
patterns:
1515
- "*"
16+
commit-message:
17+
prefix: "chore"
1618

1719
- package-ecosystem: "pip"
1820
directory: "/"
@@ -22,3 +24,5 @@ updates:
2224
dev-dependencies:
2325
patterns:
2426
- "*"
27+
commit-message:
28+
prefix: "chore"

.github/workflows/_check.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

.github/workflows/_container.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
on:
2+
workflow_call:
3+
inputs:
4+
publish:
5+
type: boolean
6+
description: If true, pushes image to container registry
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
with:
16+
# Need this to get version number from last tag
17+
fetch-depth: 0
18+
19+
- name: Set up Docker Buildx
20+
id: buildx
21+
uses: docker/setup-buildx-action@v3
22+
23+
- name: Log in to GitHub Docker Registry
24+
if: github.event_name != 'pull_request'
25+
uses: docker/login-action@v3
26+
with:
27+
registry: ghcr.io
28+
username: ${{ github.actor }}
29+
password: ${{ secrets.GITHUB_TOKEN }}
30+
31+
- name: Build and export to Docker local cache
32+
uses: docker/build-push-action@v6
33+
env:
34+
DOCKER_BUILD_RECORD_UPLOAD: false
35+
with:
36+
context: .
37+
# Need load and tags so we can test it below
38+
load: true
39+
tags: tag_for_testing
40+
41+
- name: Test cli works in cached runtime image
42+
run: docker run --rm tag_for_testing --version
43+
44+
- name: Create tags for publishing image
45+
id: meta
46+
uses: docker/metadata-action@v5
47+
with:
48+
images: ghcr.io/${{ github.repository }}
49+
tags: |
50+
type=ref,event=tag
51+
type=raw,value=latest
52+
53+
- name: Push cached image to container registry
54+
if: inputs.publish && github.ref_type == 'tag'
55+
uses: docker/build-push-action@v6
56+
env:
57+
DOCKER_BUILD_RECORD_UPLOAD: false
58+
# This does not build the image again, it will find the image in the
59+
# Docker cache and publish it
60+
with:
61+
context: .
62+
push: true
63+
tags: ${{ steps.meta.outputs.tags }}
64+
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/_docs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
on:
22
workflow_call:
33

4+
45
jobs:
56
build:
67
runs-on: ubuntu-latest

.github/workflows/_release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- name: Create GitHub Release
2424
# We pin to the SHA, not the tag, for security reasons.
2525
# https://docs.github.com/en/actions/learn-github-actions/security-hardening-for-github-actions#using-third-party-actions
26-
uses: softprops/action-gh-release@e7a8f85e1c67a31e6ed99a94b41bd0b71bbee6b8 # v2.0.9
26+
uses: softprops/action-gh-release@da05d552573ad5aba039eaac05058a918a7bf631 # v2.2.2
2727
with:
2828
prerelease: ${{ contains(github.ref_name, 'a') || contains(github.ref_name, 'b') || contains(github.ref_name, 'rc') }}
2929
files: "*"

0 commit comments

Comments
 (0)