Skip to content

Commit 2ec8f89

Browse files
committed
chore: merge branch
2 parents 407f62a + 13c3a33 commit 2ec8f89

File tree

9 files changed

+110
-36
lines changed

9 files changed

+110
-36
lines changed

.github/workflows/archive-github-pages.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
# =============================================================================
21
# @file archive-github-pages.yml
32
# @brief Save the Github pages in the Internet Archive
43
# @author Michael Hucka <[email protected]>
54
# @license Please see the file named LICENSE in the repository
6-
# @repo https://github.com/caltechlibrary/foliage
7-
# =============================================================================
5+
# @repo https://github.com/caltechlibrary/iga
86

97
name: Archive latest GitHub Pages in IA
108
on:

.github/workflows/build-sphinx.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
1-
# =============================================================================
21
# @file build-myst.yml
32
# @brief GitHub Actions workflow to build IGA docs using MyST
43
# @author Michael Hucka <[email protected]>
54
# @license Please see the file named LICENSE in the project directory
65
# @website https://github.com/caltechlibrary/iga
76
#
87
# This workflow file was originally based on work by GitHub user "peaceiris":
9-
# https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-static-site-generators-with-python
10-
# =============================================================================
8+
# https://github.com/peaceiris/actions-gh-pages
119

1210
name: Update docs on GitHub
1311

1412
on:
1513
push:
16-
branches:
17-
- develop
18-
- main
14+
branches: ['main']
15+
paths: ['docs/**']
1916

2017
jobs:
2118
deploy:

.github/workflows/lint.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# @file lint.yml
2+
# @brief GitHub Actions workflow to run flake8 on codebase
3+
# @author Michael Hucka <[email protected]>
4+
# @license Please see the file named LICENSE in the repository
5+
# @repo https://github.com/caltechlibrary/iga
6+
7+
name: Run linters on codebase
8+
run-name: Lint code after ${{github.event_name}} by ${{github.actor}}
9+
10+
on: [push, pull_request]
11+
12+
jobs:
13+
flake8-lint:
14+
name: Run flake8
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Check out source repository
18+
uses: actions/checkout@v3
19+
20+
- name: Set up Python environment
21+
uses: actions/setup-python@v4
22+
with:
23+
python-version: "3.11"
24+
cache: 'pip'
25+
26+
- name: Install dependencies
27+
run: |
28+
python -m pip install --upgrade pip
29+
python -m pip install -r requirements-lint.txt
30+
31+
- name: Run flake8
32+
uses: TrueBrain/actions-flake8@v2
33+
with:
34+
only_warn: 1
35+
extra_arguments: "--show-source --config=./.flake8 --extend-exclude=iga/vendor/,dev/,docs/,tests/"
36+
plugins: flake8>=4.0.1 flake8-bugbear>=22.4.25 flake8-builtins>=1.5.3 flake8-comprehensions>=3.8.0 flake8-executable>=2.1.1 flake8_implicit_str_concat>=0.3.0 flake8-pie>=0.15.0 flake8-simplify>=0.19.2

CHANGES.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Change log for IGA
22

3+
## Version 1.2.1 (2023-07-24)
4+
5+
Changes in this release:
6+
* Fixed `setup.cfg`, which had some garbled content.
7+
* Fixed the GitHub Action for building the IGA documentation pages to avoid needlessly running it on every push.
8+
* The GitHub Actions workflow (`action.yml`) for IGA now caches Python package dependencies for a slight speed up in run times on GitHub.
9+
* Added a GitHub Actions workflow to lint the code on pushes & pull requests.
10+
11+
312
## Version 1.2.0 (2023-07-18)
413

514
This version fixes problems with handling Invenio Communities. First, an internal bug in IGA would cause an exception if the user attempted to list communities in an InvenioRDM server that defined more than one community. Second, a bug in InvenioRDM itself meant that community links were broken. (Thanks to @tmorrell for a fix via PR #23.)

Makefile

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -87,21 +87,20 @@ define instructions_text =
8787
1. Run $(color)make lint$(reset), fix any problems, and commit any changes.
8888
2. Run $(color)make tests$(reset) fix any problems, and commit any changes.
8989
3. Update the version number in codemeta.json.
90-
4. Check the output of $(color)make report$(reset) (ignoring current id & DOI).
91-
5. Run $(color)make really-clean$(reset).
92-
6. Run $(color)make packages$(reset) and fix any problems.
93-
7. Check CHANGES.md, update if needed, and commit changes.
94-
8. Run $(color)make release$(reset); after some steps, it will open a file
90+
4. Check CHANGES.md, update if needed, and commit changes.
91+
5. Check the output of $(color)make report$(reset) (ignoring current id & DOI).
92+
6. Run $(color)make really-clean$(reset).
93+
7. Run $(color)make release$(reset); after some steps, it will open a file
9594
in your editor to write GitHub release notes. Copy the notes
9695
from CHANGES.md. Save the opened file to finish the process.
97-
9. Check that everything looks okay with the GitHub release at
96+
8. Check that everything looks okay with the GitHub release at
9897
$(link)$(repo_url)/releases$(reset)
99-
10. Wait for IGA to finish running its GitHub action at
98+
9. Wait for IGA to finish running its GitHub action at
10099
$(link)$(repo_url)/actions$(reset)
101-
11. Run $(color)make post-release$(reset).
102-
12. Run $(color)make test-pypi$(reset).
103-
13. Check $(link)https://test.pypi.org/project/$(progname)$(reset)
104-
14. Run $(color)make pypi$(reset).
100+
10. Run $(color)make post-release$(reset).
101+
11. Run $(color)make test-pypi$(reset).
102+
12. Check $(link)https://test.pypi.org/project/$(progname)$(reset)
103+
13. Run $(color)make pypi$(reset).
105104
endef
106105

107106

action.yml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,30 @@ runs:
8484
script: |
8585
core.setFailed("IGA workflow configuration error: ${{env.error}}")
8686
87-
- name: Install IGA.
87+
- name: Check out copy of repo being archived.
88+
uses: actions/checkout@v3
89+
with:
90+
fetch-depth: 0
91+
92+
- name: Create .git/iga-requirements.txt in the working directory.
93+
shell: bash
94+
run: |
95+
wget -q -O .git/iga-requirements.txt "https://raw.githubusercontent.com/caltechlibrary/iga/${{ github.action_ref || 'main' }}/requirements.txt"
96+
97+
- name: Install Python.
98+
uses: actions/[email protected]
99+
with:
100+
python-version: "3.11.4"
101+
102+
- name: Set up cache for Python dependencies.
103+
uses: actions/[email protected]
104+
id: cache
105+
with:
106+
path: ${{ env.pythonLocation }}
107+
key: ${{ env.pythonLocation }}-${{ hashFiles('.git/iga-requirements.txt') }}
108+
109+
- name: Install IGA and dependencies if not found in cache.
110+
if: steps.cache.outputs.cache-hit != 'true'
88111
shell: bash
89112
run: |
90113
python -m pip install ${{inputs.iga_copy}}

iga/invenio.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -284,18 +284,19 @@ def invenio_community_send(record, community):
284284
}
285285
result = _invenio('put', url=record.review_url, data=data,
286286
msg='get community submission link from InvenioRDM')
287-
submit_url = record.get('review_url','').replace('/review','/actions/submit-review')
287+
submit_url = record.get('review_url', '').replace('/review', '/actions/submit-review')
288288
data = {
289-
'payload': {
290-
'format': 'html',
291-
'content': f'''This record is being submitted automatically using
289+
'payload': {
290+
'format': 'html',
291+
'content': f'''This record is being submitted automatically using
292292
the InvenioRDM GitHub Archiver (IGA) version
293293
{iga.__version__}''',
294-
}
295294
}
295+
}
296296
log(f'submitting the record to community {community}')
297297
result = _invenio('post', url=submit_url, data=data,
298-
msg='submit record to community {community}')
298+
msg='submit record to community {community}')
299+
log(f'result: {result}')
299300

300301

301302
def invenio_publish(record):

requirements-dev.txt

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,12 @@
55
# @website https://github.com/caltechlibrary/iga
66

77
-r requirements.txt
8+
-r requirements-lint.txt
89

910
pytest >= 6.2.5
1011
pytest-cov >= 3.0.0
1112
pytest-mock >= 3.7.0
1213

13-
flake8 >= 4.0.1
14-
flake8-bugbear >= 22.4.25
15-
flake8-builtins >= 1.5.3
16-
flake8-comprehensions >= 3.8.0
17-
flake8-executable >= 2.1.1
18-
flake8_implicit_str_concat >= 0.3.0
19-
flake8-pie >= 0.15.0
20-
flake8-simplify >= 0.19.2
21-
2214
twine
2315
wheel
2416

requirements-lint.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# @file requirements-lint.txt
2+
# @brief Python dependencies for linting the codebase
3+
# @created 2023-07-24
4+
# @license Please see the file named LICENSE in the project directory
5+
# @website https://github.com/caltechlibrary/iga
6+
#
7+
# This set of dependencies is split out from requirements-dev.txt so that
8+
# GitHub Actions can load just this subset and not all the other
9+
# requirements. (IGA has a huge list of requirements and they take a long
10+
# time to install -- a needless waste of time when only running flake8.)
11+
12+
flake8 >= 4.0.1
13+
flake8-bugbear >= 22.4.25
14+
flake8-builtins >= 1.5.3
15+
flake8-comprehensions >= 3.8.0
16+
flake8-executable >= 2.1.1
17+
flake8_implicit_str_concat >= 0.3.0
18+
flake8-pie >= 0.15.0
19+
flake8-simplify >= 0.19.2

0 commit comments

Comments
 (0)