Skip to content

Commit 302bf2d

Browse files
authored
Add check for uncommitted changes to autogenerated files (#4281)
* Remove the unconventional image caching behaviour from team.ini because the URL is only accessed once. * Add author photo * Update AUTHORS.rst and do not autogenerate the citations file
1 parent 97724b9 commit 302bf2d

File tree

8 files changed

+49
-102
lines changed

8 files changed

+49
-102
lines changed

.github/workflows/core.yml

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -106,41 +106,41 @@ jobs:
106106
# Make sure the current directory is empty
107107
run: find . -delete
108108

109+
# Git is needed for actions/checkout and Python for firedrake-configure
110+
- name: Install system dependencies (1)
111+
run: |
112+
apt-get update
113+
apt-get -y install git python3
114+
109115
- uses: actions/checkout@v4
110116
with:
111117
path: firedrake-repo
112118
ref: ${{ inputs.source_ref }}
113119

114-
- name: Install Python
115-
run: |
116-
apt-get update
117-
apt-get -y install python3 python3-venv
118-
119120
- name: Validate single source of truth
120121
run: ./firedrake-repo/scripts/check-config
121122

122-
- name: Install system dependencies
123-
run: |
124-
apt-get -y install \
125-
$(python3 ./firedrake-repo/scripts/firedrake-configure --arch ${{ matrix.arch }} --show-system-packages)
126-
: # Dependencies needed to run the test suite
127-
apt-get -y install parallel
128-
: # Dependencies needed to build the documentation
129-
apt-get -y install inkscape texlive-full
130-
131123
# Raise an error if any 'TODO RELEASE' comments remain
132124
- name: Check no 'TODO RELEASE' comments (release only)
133125
if: inputs.target_branch == 'release'
126+
working-directory: firedrake-repo
134127
run: |
135-
cd firedrake-repo
136-
if [ -z "$( git grep 'TODO RELEASE' )" ]; then
128+
if [ -z "$( grep -r --exclude-dir='.*' 'TODO RELEASE' )" ]; then
137129
exit 0
138130
else
139131
exit 1
140132
fi
141133
142-
# TODO: is there a 'blessed commit' or do we just point to 'main'?
143-
# I prefer the latter because then failures are everyone's problem, not just mine!
134+
- name: Install system dependencies (2)
135+
run: |
136+
apt-get -y install \
137+
$(python3 ./firedrake-repo/scripts/firedrake-configure --arch ${{ matrix.arch }} --show-system-packages)
138+
apt-get -y install python3-venv
139+
: # Dependencies needed to run the test suite
140+
apt-get -y install parallel
141+
: # Dependencies needed to build the documentation
142+
apt-get -y install inkscape texlive-full
143+
144144
- name: Install PETSc
145145
run: |
146146
if [ ${{ inputs.target_branch }} = 'release' ]; then
@@ -398,6 +398,23 @@ jobs:
398398
if: success() || steps.upload_docs.conclusion == 'success'
399399
run: echo "conclusion=success" >> "$GITHUB_OUTPUT"
400400

401+
# Some files are automatically generated when we install or build the
402+
# docs (e.g. AUTHORS.rst). These files are committed to the repository
403+
# so uncommitted changes at this point reflect changes in the automatically
404+
# generated files that ought to be committed.
405+
- name: Check no untracked files
406+
if: always()
407+
working-directory: firedrake-repo
408+
run: |
409+
if [ -z "$( git status --porcelain )" ]; then
410+
exit 0
411+
else
412+
echo Error: there are untracked files in the repository
413+
echo The output from 'git status' is:
414+
git status
415+
exit 1
416+
fi
417+
401418
- name: Post-run cleanup
402419
if: always()
403420
run: find . -delete

AUTHORS.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@ Thomas H. Gibson
8080

8181
Tim Greaves
8282

83-
Thomas J. Gregory.............<https://www.imperial.ac.uk/people/t.gregory18>
84-
8583
Alastair Gregory
8684

8785
David A. Ham..................<https://www.imperial.ac.uk/people/david.ham>

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ actionlint:
3939
@docker pull rhysd/actionlint:latest
4040
@# Exclude SC2046 so it doesn't complain about unquoted $ characters (the
4141
@# quoting can prevent proper parsing)
42-
@docker run -e SHELLCHECK_OPTS='--exclude=SC2046,SC2078' --rm -v $$(pwd):/repo --workdir /repo rhysd/actionlint -color
42+
@docker run -e SHELLCHECK_OPTS='--exclude=SC2046,SC2078,SC2143' --rm -v $$(pwd):/repo --workdir /repo rhysd/actionlint -color
4343

4444
.PHONY: dockerlint
4545
dockerlint:

docs/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ source/element_list.csv: source/element_list.py
8282
cd source; python element_list.py
8383

8484
source/team.rst: source/team2.py
85-
cd source; python team2.py; mv AUTHORS.rst CITATION.rst ../..
85+
cd source; python team2.py; mv AUTHORS.rst ../..
8686

8787
source/firedrake_citations.rst:
8888
sphinx-apidoc -f -T -o source/ ../firedrake_citations

docs/source/citation.rst_t

Lines changed: 0 additions & 37 deletions
This file was deleted.
21.7 KB
Loading

docs/source/team.ini

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,27 +32,28 @@ Applied Physics Laboratory: https://www.apl.washington.edu/
3232

3333
[active-team]
3434
# Use format
35-
# name : personal-webpage, image-link
35+
# name : personal-webpage
36+
# Note that if you add your name here you should also add a picture of yourself
37+
# in /docs/source/images.
3638
David A. Ham: https://www.imperial.ac.uk/people/david.ham
3739
Paul H. J. Kelly: https://www.imperial.ac.uk/people/p.kelly
38-
Lawrence Mitchell: https://www.wence.uk/
3940
Colin J. Cotter: https://www.imperial.ac.uk/people/colin.cotter
4041
Robert C. Kirby: https://www.baylor.edu/math/index.php?id=90540
4142
Koki Sagiyama: https://www.imperial.ac.uk/people/k.sagiyama
42-
Nacime Bouziani: https://www.imperial.ac.uk/people/n.bouziani18
43-
Thomas J. Gregory: https://www.imperial.ac.uk/people/t.gregory18
44-
Jack Betteridge: https://www.imperial.ac.uk/people/j.betteridge, https://avatars.githubusercontent.com/u/43041811
43+
Jack Betteridge: https://www.imperial.ac.uk/people/j.betteridge
4544
Daniel R. Shapero: https://psc.apl.uw.edu/people/investigators/daniel-shapero/
46-
Reuben W. Nixon-Hill: https://www.imperial.ac.uk/people/reuben.nixon-hill10
4745
Connor J. Ward: https://www.imperial.ac.uk/people/c.ward20
48-
Patrick E. Farrell: https://pefarrell.org, https://pefarrell.org/images/profile.jpg
49-
Pablo D. Brubeck: https://www.maths.ox.ac.uk/people/pablo.brubeckmartinez, https://avatars.githubusercontent.com/u/6486130
50-
India Marsden: https://www.maths.ox.ac.uk/people/india.marsden, https://pefarrell.org/images/marsden.jpg
51-
Daiane I. Dolci: https://www.imperial.ac.uk/people/d.dolci, https://avatars.githubusercontent.com/u/63597005?v=4
46+
Patrick E. Farrell: https://pefarrell.org
47+
Pablo D. Brubeck: https://www.maths.ox.ac.uk/people/pablo.brubeckmartinez
48+
India Marsden: https://www.maths.ox.ac.uk/people/india.marsden
49+
Daiane I. Dolci: https://www.imperial.ac.uk/people/d.dolci
5250
Joshua Hope-Collins: https://www.imperial.ac.uk/people/joshua.hope-collins13
53-
Umberto Zerbinati: https://www.uzerbinati.eu, https://www.uzerbinati.eu/assets/logo.jpeg
51+
Umberto Zerbinati: https://www.uzerbinati.eu
5452

5553
[inactive-team]
54+
Lawrence Mitchell: https://www.wence.uk/
55+
Reuben W. Nixon-Hill: https://www.imperial.ac.uk/people/reuben.nixon-hill10
56+
Nacime Bouziani: https://www.imperial.ac.uk/people/n.bouziani18
5657
Sophia Vorderwuelbecke: https://www.imperial.ac.uk/people/s.vorderwuelbecke18
5758
Thomas H. Gibson:
5859
Miklós Homolya:

docs/source/team2.py

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -39,30 +39,11 @@ def rows(self):
3939
return range(self.nrows)
4040

4141

42-
def cache_web_image(name, url):
43-
img_name = "".join(name.split()).lower().encode("punycode").decode()
44-
img_name = img_name[:-1] if img_name[-1] == "-" else img_name
45-
with urlopen(url) as response:
46-
filetype = response.getheader("Content-Type")
47-
ext = filetype.split("/")[1]
48-
if ext == "jpeg":
49-
ext = "jpg"
50-
with open("images/" + img_name + "." + ext, "wb") as fh:
51-
fh.write(response.read())
52-
53-
5442
# Read the current team information from configuration file
5543
team = ConfigParser(interpolation=ExtendedInterpolation())
5644
team.optionxform = lambda x: x
5745
team.read("team.ini")
5846

59-
# Grab images from provided URLs and cahce them (if necessary)
60-
for name, links in team["active-team"].items():
61-
parts = links.split(",")
62-
if parts[1:]:
63-
website = parts[1]
64-
cache_web_image(name, website)
65-
6647
# Environment for applying templates
6748
env = Environment(
6849
loader=FileSystemLoader("."),
@@ -105,16 +86,3 @@ def cache_web_image(name, url):
10586
institution_set=institution_set,
10687
individual_set=individual_set
10788
))
108-
109-
# Create citations file for the Github repository
110-
citation_rst = env.get_template("citation.rst_t")
111-
institution_list = [inst[0] for inst in team["dev-institution"].items()]
112-
institution = ' and '.join(institution_list)
113-
author_list = list(team['active-team'].keys())
114-
author_list += list(team['inactive-team'].keys())
115-
author = ' and '.join(author_list)
116-
with open("CITATION.rst", "w") as fh:
117-
fh.write(citation_rst.render(
118-
author=author,
119-
institution=institution
120-
))

0 commit comments

Comments
 (0)