Skip to content

Commit e241d32

Browse files
authored
Final improvements to make tests pass on GitHub CI (#86)
* Update more test artifacts * Update .gitignore * Update draft filter * Update default-article-info.yaml * Update draft.lua * Add notes on running locally * Update entrypoint.sh * Update Makefile * Use source date epoch for draft publication time * Update CHANGELOG.md
1 parent c430b5b commit e241d32

File tree

7 files changed

+51
-12
lines changed

7 files changed

+51
-12
lines changed

.gitignore

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,13 @@ example/paper.tex
1111
/test/JATS-Publishing-1-2-MathML2-XSD.zip
1212
/test/JATS-journalpublishing1-elements.xsd
1313
/test/JATS-journalpublishing1.xsd
14-
/test/standard-modules
14+
/test/standard-modules
15+
16+
# If you copy the resources into the base directory to
17+
# make the Makefile work, don't accidentally commit these
18+
apa.csl
19+
default-article-info.yaml
20+
footer.csl
21+
/joss
22+
/jose
23+
/resciencec

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22

33
`Inara` uses [SemVer][] (semantic versioning).
44

5-
## Inara v1.1.2
5+
## UNRELEASED
66

77
- Fix bug in application of `prepare-affiliations.lua` filter (Charles Tapley Hoyt)
8+
- Fix a bug in the injection of `SOURCE_DATE_EPOCH` (https://github.com/openjournals/inara/pull/86) in tests
9+
- Fix test files (https://github.com/openjournals/inara/pull/86, https://github.com/openjournals/inara/pull/85)
10+
- Switch testing to work on tex instead of pdf (https://github.com/openjournals/inara/pull/82)
11+
- Refactor testing folders (https://github.com/openjournals/inara/pull/84)
812

913
## Inara v1.1.1
1014

Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ ARTICLE_INFO_FILE = $(OPENJOURNALS_PATH)/default-article-info.yaml
1717

1818
IMAGE = openjournals/inara:edge
1919

20+
MAKEFILE_DIR := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
21+
2022
.PHONY: all
2123
all: cff pdf tex html jats crossref native preprint
2224

@@ -92,13 +94,23 @@ clean:
9294

9395
## Tests
9496

97+
# Note that SOURCE_DATE_EPOCH=1234567890 corresponds to 1234567890 seconds
98+
# from the unix epoch (January 1, 1970), which is in 2009
99+
95100
# Command used to invoke Inara. Sets an environment variable that makes the
96101
# program ignore the real date.
97102
INARA_TEST_CMD = docker run --rm \
98103
--user $(shell id -u):$(shell id -g) \
99104
--env SOURCE_DATE_EPOCH=1234567890 \
100105
-v $${PWD}:/data $(IMAGE)
101106

107+
# Uncomment this if you want to run tests locally instead of inside docker,
108+
# though note that there might be non-trivial differences that are hard to explain.
109+
# You also have to run `cp -r resources/* .` to copy all of the resource files
110+
# into the root directory, since this makefile relies on this directory structure
111+
# which the dockerfile creates
112+
# INARA_TEST_CMD = SOURCE_DATE_EPOCH=1234567890 JOURNAL=joss OPENJOURNALS_PATH=$(MAKEFILE_DIR) sh scripts/entrypoint.sh
113+
102114
.PHONY: test test-golden-draft test-golden-pub
103115
test: test-golden-draft test-golden-pub
104116
test-golden-draft: \

data/filters/draft.lua

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
--- Removes and alters metadata for draft output
2+
3+
--- If you change this, please keep it in sync with
4+
--- resources/default-article-info.yaml
25
function Meta (meta)
36
if meta.draft and meta.draft ~= '' then
7+
local epoch = os.getenv 'SOURCE_DATE_EPOCH'
8+
and os.time { year = 1970, month = 1, day = 1, hour = 0, min = 0,
9+
sec = tonumber(os.getenv 'SOURCE_DATE_EPOCH') }
10+
or os.time()
411
meta.article.doi = '10.xxxxxx/draft'
5-
meta.article.issue = '0'
6-
meta.article.volume = '0'
12+
meta.article.issue = '¿ISSUE?'
13+
meta.article.volume = '¿VOL?'
714
meta.published = 'unpublished'
8-
meta.published_parts = os.date('*t')
15+
meta.published_parts = os.date('*t', epoch)
916
return meta
1017
end
1118
end

resources/default-article-info.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# If you change this, please keep it in sync with
2+
# data/filters/draft.lua
3+
14
metadata:
25
archive_doi: 'DOI unavailable'
36
editor_url: 'https://example.com'
@@ -7,7 +10,7 @@ metadata:
710
editor_name: 'Pending Editor'
811
issue: '¿ISSUE?'
912
page: '¿PAGE?'
10-
published_at: '1970-01-01'
13+
published_at: 'unpublished'
1114
reviewers:
1215
- 'Pending Reviewers'
1316
submitted_at: '1970-01-01'

scripts/entrypoint.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ for format in $(printf "%s" "$outformats" | sed -e 's/,/ /g'); do
111111
# inara git repo that is created in Docker, in which the contents of
112112
# the resources/ directory is copied into the root directory
113113
# 3. assumes pandoc is in a certain location. Switch `/usr/local/bin/pandoc`
114-
# to just `pandoc` locally
114+
# to just `pandoc` locally, or symlink with
115+
# sudo ln -s $which(pandoc) /usr/local/bin/pandoc
115116
/usr/local/bin/pandoc \
116117
--data-dir="$OPENJOURNALS_PATH"/data \
117118
--defaults=shared \

test/expected-draft/paper.tex

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
pdfpubtype={journal},
2222
pdfvolumenum={},
2323
pdfissuenum={},
24-
pdfdoi={N/A},
24+
pdfdoi={10.xxxxxx/draft},
2525
pdfcopyright={Copyright (c) 1970, Albert Krewinkel, Juanjo Bazán,
2626
Arfon M. Smith},
2727
pdflicenseurl={http://creativecommons.org/licenses/by/4.0/},
@@ -136,9 +136,9 @@
136136
\renewcommand{\footrulewidth}{0.25pt}
137137

138138
\fancyfoot[L]{\parbox[t]{0.98\headwidth}{\footnotesize{\sffamily Krewinkel
139-
et al. (1970). Article Writing with Markdown and the Open Journals
139+
et al. (2009). Article Writing with Markdown and the Open Journals
140140
publishing pipeline. \emph{Journal of Open Source Software},
141-
\emph{¿VOL?}(¿ISSUE?), ¿PAGE? \url{https://doi.org/N/A}}.}}
141+
\emph{¿VOL?}(¿ISSUE?), ¿PAGE? \url{https://doi.org/10.xxxxxx/draft}}.}}
142142

143143

144144
\fancyfoot[R]{\sffamily \thepage}
@@ -316,6 +316,9 @@
316316
\newcommand{\VerbatimStringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{#1}}
317317
\newcommand{\WarningTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{#1}}}}
318318
\usepackage{longtable,booktabs,array}
319+
\usepackage{lineno}
320+
\linenumbers
321+
\usepackage{draftwatermark}
319322

320323
\usepackage{graphicx,grffile}
321324
\makeatletter
@@ -394,7 +397,7 @@
394397
%\hrule
395398
\sffamily\small
396399

397-
{\bfseries DOI:} \href{https://doi.org/N/A}{\color{linky}{N/A}}
400+
{\bfseries DOI:} \href{https://doi.org/10.xxxxxx/draft}{\color{linky}{10.xxxxxx/draft}}
398401

399402
\vspace{2mm}
400403
{\bfseries Software}
@@ -423,7 +426,7 @@
423426
\vspace{2mm}
424427

425428
{\bfseries Submitted:} 01 January 1970\\
426-
{\bfseries Published:} 01 January 1970
429+
{\bfseries Published:} unpublished
427430

428431
\vspace{2mm}
429432
{\bfseries License}\\

0 commit comments

Comments
 (0)