Skip to content

Commit e524ffb

Browse files
committed
Add GH Actions workflow
* Add test.yml for GH Actions workflow * Update and shift location of PR template
1 parent 695238b commit e524ffb

File tree

6 files changed

+85
-30
lines changed

6 files changed

+85
-30
lines changed

.github/pull-request-template.md

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#### What does this PR do?
2+
A few sentences describing the overall goals of the pull request's commits.
3+
Why are we making these changes? Is there more work to be done to fully
4+
achieve these goals?
5+
6+
#### Helpful background context
7+
8+
Describe any additional context beyond what the PR accomplishes if it is likely
9+
to be useful to a reviewer.
10+
11+
Delete this section if it isn't applicable to the PR.
12+
13+
#### How can a reviewer manually see the effects of these changes?
14+
15+
Explain how to see the proposed changes in the application if possible.
16+
17+
Delete this section if it isn't applicable to the PR.
18+
19+
#### What are the relevant tickets?
20+
21+
- https://mitlibraries.atlassian.net/browse/DIP-
22+
23+
#### Screenshots (if appropriate)
24+
25+
Delete this section if it isn't applicable to the PR.
26+
27+
#### Requires Database Migrations?
28+
YES | NO
29+
30+
#### Includes new or updated dependencies?
31+
YES | NO

.github/workflows/tests.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Tests
2+
on: push
3+
jobs:
4+
test:
5+
name: Run tests
6+
env:
7+
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v2
11+
- name: Setup python
12+
uses: actions/setup-python@v2
13+
with:
14+
python-version: '3.9'
15+
architecture: x64
16+
- name: Install
17+
run: |
18+
python -m pip install --upgrade pip pipenv
19+
pipenv install --dev
20+
- name: Tests
21+
run: make coveralls
22+
linting:
23+
name: Run linting
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@v2
27+
- name: Setup python
28+
uses: actions/setup-python@v2
29+
with:
30+
python-version: '3.9'
31+
architecture: x64
32+
- name: Install
33+
run: |
34+
python -m pip install --upgrade pip pipenv
35+
pipenv install --dev
36+
- name: Linting
37+
run: make lint

.travis.yml

-7
This file was deleted.

dsaps/models.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,7 @@ def post_items(self, client):
183183
def create_metadata_for_items_from_csv(cls, csv_reader, field_map):
184184
"""Create metadata for the collection's items based on a CSV and a JSON mapping
185185
field map."""
186-
items = [
187-
Item.metadata_from_csv_row(row, field_map) for row in csv_reader
188-
]
186+
items = [Item.metadata_from_csv_row(row, field_map) for row in csv_reader]
189187
return cls(items=items)
190188

191189

pull-request-template.md

-5
This file was deleted.

tests/test_models.py

+16-15
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,13 @@ def test_collection_post_items(client, input_dir, aspace_delimited_csv, aspace_m
110110

111111

112112
def test_item_bitstreams_in_directory(input_dir):
113-
item = models.Item(file_identifier='test')
113+
item = models.Item(file_identifier="test")
114114
item.bitstreams_in_directory(input_dir)
115115
assert 3 == len(item.bitstreams)
116-
assert item.bitstreams[0].name == 'test_01.jpg'
117-
assert item.bitstreams[1].name == 'test_01.pdf'
118-
assert item.bitstreams[2].name == 'test_02.pdf'
119-
item.bitstreams_in_directory(input_dir, 'pdf')
116+
assert item.bitstreams[0].name == "test_01.jpg"
117+
assert item.bitstreams[1].name == "test_01.pdf"
118+
assert item.bitstreams[2].name == "test_02.pdf"
119+
item.bitstreams_in_directory(input_dir, "pdf")
120120
assert 2 == len(item.bitstreams)
121121
assert item.bitstreams[0].name == "test_01.pdf"
122122
assert item.bitstreams[1].name == "test_02.pdf"
@@ -125,14 +125,15 @@ def test_item_bitstreams_in_directory(input_dir):
125125
def test_item_metadata_from_csv_row(aspace_delimited_csv, aspace_mapping):
126126
row = next(aspace_delimited_csv)
127127
item = models.Item.metadata_from_csv_row(row, aspace_mapping)
128-
assert attr.asdict(item)['metadata'] == [
129-
{'key': 'dc.title', 'value': 'Tast Item', 'language': 'en_US'},
130-
{'key': 'dc.contributor.author', 'value': 'Smith, John',
131-
'language': None},
132-
{'key': 'dc.contributor.author', 'value': 'Smith, Jane',
133-
'language': None},
134-
{'key': 'dc.description', 'value': 'More info at /repo/0/ao/456',
135-
'language': 'en_US'},
136-
{'key': 'dc.rights', 'value': 'Totally Free', 'language': 'en_US'},
137-
{'key': 'dc.rights.uri', 'value': 'http://free.gov', 'language': None}
128+
assert attr.asdict(item)["metadata"] == [
129+
{"key": "dc.title", "value": "Tast Item", "language": "en_US"},
130+
{"key": "dc.contributor.author", "value": "Smith, John", "language": None},
131+
{"key": "dc.contributor.author", "value": "Smith, Jane", "language": None},
132+
{
133+
"key": "dc.description",
134+
"value": "More info at /repo/0/ao/456",
135+
"language": "en_US",
136+
},
137+
{"key": "dc.rights", "value": "Totally Free", "language": "en_US"},
138+
{"key": "dc.rights.uri", "value": "http://free.gov", "language": None},
138139
]

0 commit comments

Comments
 (0)