Skip to content

Commit

Permalink
ci: switch to GitHub Actions
Browse files Browse the repository at this point in the history
* Adds a file to configure continuous integration with GitHub Actions.
* Adds a pull request template file.
* Adds an issue template file.
* Updates badge for CI in README file.
* Removes useless Travis configuration file.
* Adjusts tests as the embargo date has been reached now.

Co-Authored-by: Sébastien Délèze <sebastien.deleze@rero.ch>
  • Loading branch information
Sébastien Délèze committed Jan 12, 2021
1 parent 754f44d commit 2d42412
Show file tree
Hide file tree
Showing 9 changed files with 112 additions and 85 deletions.
33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Default Issue template
about: Create an issue to help us improve
title: ''
labels: ''
assignees: ''
---

**Describe the issue**
A clear and concise description of what the issue is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '…'
1. Log in as '…'
1. Click on '…'
1. Scroll down to '…'
1. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Software version**
Tell us which version you're using:

* from which server URL do you come from? ils.test or ilsdev?
* checks the version on homepage. Do you see the version as 0.5.0 or a hash as 2493ca6?

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Additional context**
Add any other context about the problem here.
19 changes: 19 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## Why are you opening this PR?

- Which task/US does it implement?
- Which issue does it fix?

## How to test?

- What command should I have to run to test your PR?
- What should I test through the UI?

## Code review check list

- [ ] Commit message template compliance.
- [ ] Commit message without typos.
- [ ] File names.
- [ ] Functions names.
- [ ] Functions docstrings.
- [ ] Unnecessary commited files?
- [ ] Extracted translations?
49 changes: 49 additions & 0 deletions .github/workflows/continuous-integration-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: build
on: [push, pull_request, workflow_dispatch]

env:
TERM: xterm-256color

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Install Libraries
run: |
sudo apt-get install -y libxml2 libxml2-dev libxmlsec1 libxmlsec1-dev xpdf ghostscript imagemagick
sudo sed -i 's/<policy domain="coder" rights="none" pattern="PDF" \/>/<policy domain="coder" rights="read" pattern="PDF" \/>/g' /etc/ImageMagick-6/policy.xml
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: '12'

- name: Docker compose up
run: docker-compose up -d

- name: Setup Python 3.6
uses: actions/setup-python@v2
with:
python-version: 3.6

- name: Install Poetry
uses: snok/install-poetry@v1.1.1
with:
version: 1.0.10

- name: Run Bootstrap
run: |
poetry run ./scripts/bootstrap
poetry run pip install --upgrade coveralls
- name: Run Test
run: poetry run ./scripts/test

- name: Code Coverage
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
pip install --upgrade coveralls
coveralls
76 changes: 0 additions & 76 deletions .travis.yml

This file was deleted.

5 changes: 3 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
Swiss Open Access Repository
==============================

.. image:: https://img.shields.io/travis/rero/sonar.svg
:target: https://travis-ci.org/rero/sonar
.. image:: https://github.com/rero/sonar/workflows/build/badge.svg
:alt: Github actions status
:target: https://github.com/rero/sonar/actions?query=workflow%3Abuild

.. image:: https://img.shields.io/coveralls/rero/sonar.svg
:target: https://coveralls.io/r/rero/sonar
Expand Down
4 changes: 2 additions & 2 deletions tests/api/deposits/test_deposits_rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ def test_file_put(client, deposit):

# With embargo date
response = client.put(url.format(pid=deposit['pid'], key='main.pdf'),
data=json.dumps({'embargoDate': '2021-01-01'}),
data=json.dumps({'embargoDate': '2022-01-01'}),
headers={'Content-Type': 'application/json'})
assert response.status_code == 200
assert response.json['embargoDate'] == '2021-01-01'
assert response.json['embargoDate'] == '2022-01-01'

# With wrong embargo date
response = client.put(url.format(pid=deposit['pid'], key='main.pdf'),
Expand Down
2 changes: 1 addition & 1 deletion tests/api/test_api_simple_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,5 @@ def test_add_files_restrictions(client, document_with_file, superuser):
assert res.status_code == 200
assert res.json['metadata']['_files'][0]['restriction'] == {
'restricted': True,
'date': '01/01/2021'
'date': '01/01/2022'
}
7 changes: 4 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ def _make_document(organisation='org', with_file=False, pid=None):
order=1,
access='coar:c_f1cf',
restricted_outside_organisation=False,
embargo_date='2021-01-01')
embargo_date='2022-01-01')
record.commit()

db.session.commit()
Expand Down Expand Up @@ -525,7 +525,7 @@ def _make_deposit(role='submitter', organisation=None):
record.files['main.pdf']['category'] = 'main'
record.files['main.pdf']['type'] = 'file'
record.files['main.pdf']['embargo'] = True
record.files['main.pdf']['embargoDate'] = '2021-01-01'
record.files['main.pdf']['embargoDate'] = '2022-01-01'
record.files['main.pdf']['exceptInOrganisation'] = True

record.files['additional.pdf'] = BytesIO(content)
Expand Down Expand Up @@ -562,7 +562,7 @@ def deposit(app, db, user, pdf_file, bucket_location, deposit_json):
deposit.files['main.pdf']['category'] = 'main'
deposit.files['main.pdf']['type'] = 'file'
deposit.files['main.pdf']['embargo'] = True
deposit.files['main.pdf']['embargoDate'] = '2021-01-01'
deposit.files['main.pdf']['embargoDate'] = '2022-01-01'
deposit.files['main.pdf']['exceptInOrganisation'] = True

deposit.files['additional.pdf'] = BytesIO(content)
Expand Down Expand Up @@ -680,6 +680,7 @@ def project(app, db, user, organisation, project_json):
def bucket_location(app, db):
"""Create a default location for managing files."""
tmppath = tempfile.mkdtemp()
print(tmppath)
location = Location(name='default', uri=tmppath, default=True)
db.session.add(location)
db.session.commit()
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/deposits/test_deposits_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def test_create_document(app, db, project, client, deposit, user):

assert document.files['main.pdf']['access'] == 'coar:c_f1cf'
assert document.files['main.pdf']['restricted_outside_organisation']
assert document.files['main.pdf']['embargo_date'] == '2021-01-01'
assert document.files['main.pdf']['embargo_date'] == '2022-01-01'
assert len(document.files) == 6

# Test without affiliation
Expand Down

0 comments on commit 2d42412

Please sign in to comment.