Skip to content

Commit ad9b2c6

Browse files
authored
Merge pull request #1722 from open-contracting/profile-template
build: Update to latest profile template
2 parents 0871878 + b7aaa4b commit ad9b2c6

File tree

10 files changed

+118
-188
lines changed

10 files changed

+118
-188
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2,46 +2,15 @@ name: CI
22
on: [push, pull_request]
33
jobs:
44
build:
5-
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
6-
runs-on: ubuntu-latest
7-
steps:
8-
- uses: actions/checkout@v4
9-
with:
10-
submodules: true
11-
- uses: actions/setup-python@v5
12-
with:
13-
python-version: '3.10'
14-
cache: pip
15-
cache-dependency-path: '**/requirements*.txt'
16-
# Don't install editable projects in the current working directory.
17-
# https://pip.pypa.io/en/latest/reference/pip_install/#install-src
18-
- run: pip install --src $GITHUB_WORKSPACE/../src -r requirements.txt
19-
- if: github.repository == 'open-contracting/standard_profile_template'
20-
run: make update extract
21-
- run: make
22-
# Disable linkcheck as it is too slow for development.
23-
# - run: |
24-
# make linkcheck
25-
# rm -f output.json output.txt
5+
uses: open-contracting/.github/.github/workflows/ci-profile.yml@main
6+
secrets:
7+
private-key: ${{ secrets.PRIVATE_KEY }}
8+
elasticsearch-password: ${{ secrets.ELASTICSEARCH_PASSWORD }}
9+
with:
10+
path-prefix: ''
11+
version: '1.1'
12+
production-refs: '["refs/heads/1.0", "refs/heads/1.1"]'
13+
# Linkcheck is slow for development.
14+
linkcheck: false
2615
# "ResourceWarning: unclosed file <_io.BufferedWriter name='/dev/null'>"
27-
- run: pytest -W error -W ignore::ResourceWarning
28-
# Deploy the built documentation to the staging directory.
29-
- if: github.event_name == 'push'
30-
uses: shimataro/ssh-key-action@v2
31-
with:
32-
key: ${{ secrets.PRIVATE_KEY }}
33-
known_hosts: standard.open-contracting.org ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGveFGTJ9yyObNGDUCUyzyFkm6Kzh3YqIt1qB7B/KU6E
34-
- if: github.event_name == 'push'
35-
uses: bcomnes/netrc-creds@v3
36-
with:
37-
machine: standard.open-contracting.org
38-
login: manage
39-
password: ${{ secrets.ELASTICSEARCH_PASSWORD }}
40-
- if: github.event_name == 'push' && success() && github.repository != 'open-contracting/standard_profile_template'
41-
env:
42-
PATH_PREFIX: ""
43-
PRODUCTION: ${{ startsWith(github.ref, 'refs/tags') || github.ref == 'refs/heads/latest' || github.ref == 'refs/heads/1.0' || github.ref == 'refs/heads/1.1' }}
44-
RELEASE: ${{ startsWith(github.ref, 'refs/tags') }}
45-
VERSION: "1.1"
46-
shell: bash
47-
run: curl -sS https://raw.githubusercontent.com/open-contracting/deploy/main/deploy-docs.sh | bash -
16+
pytest-options: -W ignore::ResourceWarning

.github/workflows/js.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
name: Lint JavaScript
22
on: [push, pull_request]
33
jobs:
4-
build:
5-
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
6-
runs-on: ubuntu-latest
7-
steps:
8-
- uses: actions/checkout@v4
9-
- uses: biomejs/setup-biome@v2
10-
- run: biome ci --indent-style=space --line-width=119 docs/_static/script.js
4+
lint:
5+
uses: open-contracting/.github/.github/workflows/js.yml@main
6+
with:
7+
filenames: docs/_static/script.js

.github/workflows/lint.yml

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,9 @@
11
name: Lint
22
on: [push, pull_request]
3-
env:
4-
BASEDIR: https://raw.githubusercontent.com/open-contracting/standard-maintenance-scripts/main
53
jobs:
6-
build:
7-
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
8-
runs-on: ubuntu-latest
9-
env:
10-
PAT: ${{ secrets.PAT }}
11-
steps:
12-
- uses: actions/checkout@v4
13-
with:
14-
token: ${{ secrets.PAT || github.token }}
15-
- uses: actions/setup-python@v5
16-
with:
17-
python-version: '3.10'
18-
cache: pip
19-
cache-dependency-path: '**/requirements*.txt'
20-
- id: changed-files
21-
uses: tj-actions/changed-files@v45
22-
- uses: pre-commit/action@v3.0.1
23-
continue-on-error: true
24-
with:
25-
extra_args: pip-compile --files ${{ steps.changed-files.outputs.all_changed_files }}
26-
- if: ${{ env.PAT }}
27-
uses: stefanzweifel/git-auto-commit-action@v5
28-
with:
29-
commit_message: '[github-actions] pre-commit autoupdate'
30-
- shell: bash
31-
run: curl -s -S --retry 3 $BASEDIR/tests/install.sh | bash -
32-
- shell: bash
33-
run: curl -s -S --retry 3 $BASEDIR/tests/script.sh | bash -
4+
lint:
5+
uses: open-contracting/.github/.github/workflows/lint.yml@main
6+
permissions:
7+
contents: write
8+
with:
9+
python-version: '3.10'

.github/workflows/shell.yml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
name: Lint Shell
22
on: [push, pull_request]
33
jobs:
4-
build:
5-
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
6-
runs-on: ubuntu-latest
7-
steps:
8-
- uses: actions/checkout@v4
9-
- run: |
10-
sudo apt update
11-
sudo apt install devscripts shellcheck shfmt
12-
- run: checkbashisms $(shfmt -f .)
13-
- run: shellcheck $(shfmt -f .)
14-
- run: shfmt -d -i 4 -sr $(shfmt -f .)
4+
lint:
5+
uses: open-contracting/.github/.github/workflows/shell.yml@main

.github/workflows/spellcheck.yml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
name: Spell-check
22
on: [push, pull_request]
33
jobs:
4-
build:
5-
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
6-
runs-on: ubuntu-latest
7-
steps:
8-
- uses: actions/checkout@v4
9-
- uses: actions/setup-python@v5
10-
with:
11-
python-version: '3.10'
12-
- run: pip install codespell
13-
- run: codespell -S .git,docson,locale,examples,country.csv,currency.csv,language.csv,mediaType.csv -L fo,sme,zar,SME .
4+
lint:
5+
uses: open-contracting/.github/.github/workflows/spellcheck.yml@main
6+
with:
7+
ignore: fo,sme,zar
8+
skip: docson,locale,examples,country.csv,currency.csv,language.csv,mediaType.csv

common-requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ sphinxcontrib-qthelp==1.0.3
158158
# via sphinx
159159
sphinxcontrib-serializinghtml==1.1.5
160160
# via sphinx
161-
standard-theme @ git+https://github.com/open-contracting/standard_theme.git@07ca0e39979a244656dd6df0658f2ead428184b9#egg=standard_theme
161+
standard-theme @ git+https://github.com/open-contracting/standard_theme.git@c3cbd1b8ba6db24624e5d838ed18147db63f5d1b#egg=standard_theme
162162
# via -r common-requirements.in
163163
starlette==0.40.0
164164
# via sphinx-autobuild

docs/conf.py

Lines changed: 73 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@
66

77
# -- Path setup --------------------------------------------------------------
88

9-
# If extensions (or modules to document with autodoc) are in another directory,
10-
# add these directories to sys.path here. If the directory is relative to the
11-
# documentation root, use os.path.abspath to make it absolute, like shown here.
12-
139
import csv
1410
import json
1511
import os
@@ -24,12 +20,12 @@
2420

2521
# -- Project information -----------------------------------------------------
2622

27-
project = 'Open Contracting Data Standard'
28-
copyright = 'Open Contracting Partnership'
29-
author = 'Open Contracting Partnership'
23+
project = "Open Contracting Data Standard"
24+
copyright = "Open Contracting Partnership"
25+
author = "Open Contracting Partnership"
3026

31-
version = '1.1'
32-
release = '1.1.5'
27+
version = "1.1"
28+
release = "1.1.5"
3329

3430

3531
# -- General configuration ---------------------------------------------------
@@ -38,137 +34,143 @@
3834
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3935
# ones.
4036
extensions = [
41-
'myst_parser',
42-
'sphinx.ext.ifconfig',
43-
'sphinxcontrib.jsonschema',
44-
'sphinxcontrib.opencontracting',
45-
'sphinxcontrib.opendataservices',
46-
'sphinx_design',
37+
"myst_parser",
38+
"sphinx.ext.ifconfig",
39+
"sphinxcontrib.jsonschema",
40+
"sphinxcontrib.opencontracting",
41+
"sphinxcontrib.opendataservices",
42+
"sphinx_design",
4743
]
4844

4945
# Add any paths that contain templates here, relative to this directory.
50-
templates_path = ['_templates']
46+
templates_path = ["_templates"]
5147

5248
# List of patterns, relative to source directory, that match files and
5349
# directories to ignore when looking for source files.
5450
# This pattern also affects html_static_path and html_extra_path.
55-
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '**/docson/[!p]**', '**/docson/package*.json']
51+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", "**/docson/[!p]**", "**/docson/package*.json"]
5652

5753

5854
# -- Options for HTML output -------------------------------------------------
5955

6056
# The theme to use for HTML and HTML Help pages. See the documentation for
6157
# a list of builtin themes.
6258
#
63-
html_theme = 'standard_theme' # 'pydata_sphinx_theme'
59+
html_theme = "standard_theme" # 'pydata_sphinx_theme'
6460
html_theme_path = [standard_theme.get_html_theme_path()]
65-
html_favicon = '_static/favicon-16x16.ico'
61+
html_favicon = "_static/favicon-16x16.ico"
6662

6763
# Add any paths that contain custom static files (such as style sheets) here,
6864
# relative to this directory. They are copied after the builtin static files,
6965
# so a file named "default.css" will overwrite the builtin "default.css".
70-
html_static_path = ['_static']
66+
html_static_path = ["_static"]
7167

7268

7369
# -- Local configuration -----------------------------------------------------
7470

75-
_ = get_translation('theme')
71+
_ = get_translation("theme")
7672

77-
profile_identifier = ''
78-
repository_url = 'https://github.com/open-contracting/standard'
73+
profile_identifier = ""
74+
repository_url = "https://github.com/open-contracting/standard"
7975

8076
# Internationalization.
8177
gettext_compact = False
8278
# `DOMAIN_PREFIX` from `config.mk`.
83-
gettext_domain_prefix = f'{profile_identifier}-' if profile_identifier else ''
84-
locale_dirs = ['locale/', os.path.join(standard_theme.get_html_theme_path(), 'locale')]
79+
gettext_domain_prefix = f"{profile_identifier}-" if profile_identifier else ""
80+
locale_dirs = ["locale/", os.path.join(standard_theme.get_html_theme_path(), "locale")]
8581
# We use single quotes for codes, which docutils will change to double quotes.
8682
# https://sourceforge.net/p/docutils/code/HEAD/tree/trunk/docutils/docutils/utils/smartquotes.py
8783
smartquotes = False
8884

8985
# MyST configuration.
90-
myst_enable_extensions = ['linkify']
86+
myst_enable_extensions = ["linkify"]
9187
myst_heading_anchors = 6
9288
myst_heading_slug_func = make_id
9389
# https://github.com/executablebooks/MyST-Parser/issues/357
94-
suppress_warnings = ['myst.anchor']
90+
suppress_warnings = ["myst.anchor"]
9591

9692
# Theme customization.
9793
navigation_with_keys = False # restore the Sphinx default
9894
html_context = {
99-
'analytics_id': 'HTWZHRIZ',
95+
"analytics_id": "HTWZHRIZ",
10096
}
10197
html_theme_options = {
102-
'analytics_id': 'HTWZHRIZ',
103-
'display_version': True,
104-
'root_url': f'/profiles/{profile_identifier}' if profile_identifier else '',
105-
'short_project': project.replace('Open Contracting Data Standard', 'OCDS'),
106-
'copyright': copyright,
107-
'license_name': 'Apache License 2.0',
108-
'license_url': f'{repository_url}/blob/HEAD/LICENSE',
109-
'repository_url': repository_url,
98+
"analytics_id": "HTWZHRIZ",
99+
"display_version": True,
100+
"root_url": f"/profiles/{profile_identifier}" if profile_identifier else "",
101+
"short_project": project.replace("Open Contracting Data Standard", "OCDS"),
102+
"copyright": copyright,
103+
"license_name": "Apache License 2.0",
104+
"license_url": f"{repository_url}/blob/HEAD/LICENSE",
105+
"repository_url": repository_url,
110106
}
111-
html_short_title = f'{html_theme_options["short_project"]} v{release}'
107+
html_short_title = f"{html_theme_options['short_project']} v{release}"
112108

113109
# List the extension identifiers and versions that should be part of this specification. The extensions must be in
114110
# the extension registry: https://github.com/open-contracting/extension_registry/blob/main/extension_versions.csv
115-
default_extension_version = f'v{release}'
111+
default_extension_version = f"v{release}"
116112
extension_versions = {
117-
'bids': default_extension_version,
118-
'enquiries': default_extension_version,
119-
'location': default_extension_version,
120-
'lots': default_extension_version,
121-
'milestone_documents': default_extension_version,
122-
'participation_fee': default_extension_version,
123-
'process_title': default_extension_version,
113+
"bids": default_extension_version,
114+
"enquiries": default_extension_version,
115+
"location": default_extension_version,
116+
"lots": default_extension_version,
117+
"milestone_documents": default_extension_version,
118+
"participation_fee": default_extension_version,
119+
"process_title": default_extension_version,
124120
}
125121

126122
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-the-linkcheck-builder
127123
# Ignore Google Sheets.
128-
linkcheck_anchors_ignore = [r'^gid=']
124+
linkcheck_anchors_ignore = [r"^gid="]
129125
linkcheck_ignore = [
130126
# Avoid GitHub.com rate limiting.
131-
r'^https://github.com/open-contracting/standard/(?:issues|pull)/\d+$',
127+
r"^https://github.com/open-contracting/standard/(?:issues|pull)/\d+$",
132128
# Ignore irreproducible false positives.
133-
r'^https://www.fcny.org/fcny/$',
134-
r'^http://www.eprocurementtoolkit.org/sites/default/files/2016-11/OCDS_Implemetation_Methodology_0.pdf#page=27$',
129+
r"^https://www.fcny.org/fcny/$",
130+
r"^http://www.eprocurementtoolkit.org/sites/default/files/2016-11/OCDS_Implemetation_Methodology_0.pdf#page=27$",
135131
# Ignore unwanted links created by linkify.
136-
r'^http://vnd\.',
132+
r"^http://vnd\.",
137133
# Ignore expected redirects.
138-
r'^https://docs.google.com/spreadsheets/d/[^/]+/pub?gid=\d+&single=true&output=csv$',
134+
r"^https://docs.google.com/spreadsheets/d/[^/]+/pub?gid=\d+&single=true&output=csv$",
139135
]
140136

141137

142138
def setup(app):
143139
# The root of the repository.
144140
basedir = Path(__file__).resolve().parents[1]
145141
# `LOCALE_DIR` from `config.mk`.
146-
localedir = basedir / 'docs' / 'locale'
142+
localedir = basedir / "docs" / "locale"
147143

148-
language = app.config.overrides.get('language', 'en')
144+
language = app.config.overrides.get("language", "en")
149145

150-
headers = ['Title', 'Description', 'Extension']
146+
headers = ["Title", "Description", "Extension"]
151147
# The gettext domain for schema translations. Should match the domain in the `pybabel compile` command.
152-
schema_domain = f'{gettext_domain_prefix}schema'
148+
schema_domain = f"{gettext_domain_prefix}schema"
153149
# The gettext domain for codelist translations. Should match the domain in the `pybabel compile` command.
154-
codelists_domain = f'{gettext_domain_prefix}codelists'
155-
156-
standard_dir = basedir / 'schema'
157-
standard_build_dir = basedir / 'build' / language
158-
159-
branch = os.getenv('GITHUB_REF_NAME', 'latest')
160-
161-
translate([
162-
# The glob patterns in `babel_ocds_schema.cfg` should match these filenames.
163-
(glob(str(standard_dir / '*-schema.json')), standard_build_dir, schema_domain),
164-
# The glob patterns in `babel_ocds_codelist.cfg` should match these.
165-
(glob(str(standard_dir / 'codelists' / '*.csv')), standard_build_dir / 'codelists', codelists_domain),
166-
], localedir, language, headers, version=branch)
167-
168-
with (standard_build_dir / 'release-schema.json').open() as f:
150+
codelists_domain = f"{gettext_domain_prefix}codelists"
151+
152+
standard_dir = basedir / "schema"
153+
standard_build_dir = basedir / "build" / language
154+
155+
branch = os.getenv("GITHUB_REF_NAME", "latest")
156+
157+
translate(
158+
[
159+
# The glob patterns in `babel_ocds_schema.cfg` should match these filenames.
160+
(glob(str(standard_dir / "*-schema.json")), standard_build_dir, schema_domain),
161+
# The glob patterns in `babel_ocds_codelist.cfg` should match these.
162+
(glob(str(standard_dir / "codelists" / "*.csv")), standard_build_dir / "codelists", codelists_domain),
163+
],
164+
localedir,
165+
language,
166+
headers,
167+
version=branch,
168+
)
169+
170+
with (standard_build_dir / "release-schema.json").open() as f:
169171
fieldnames, rows = mapping_sheet(json.load(f), infer_required=True)
170172

171-
with (standard_build_dir / 'release-schema.csv').open('w') as f:
173+
with (standard_build_dir / "release-schema.csv").open("w") as f:
172174
writer = csv.DictWriter(f, fieldnames)
173175
writer.writeheader()
174176
writer.writerows(rows)

0 commit comments

Comments
 (0)