-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into bugfix/improve-db-sessions
Conflicts: datagateway_api/src/main.py poetry.lock
- Loading branch information
Showing
19 changed files
with
565 additions
and
297 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
name: CI | ||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
jobs: | ||
tests: | ||
runs-on: ubuntu-16.04 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ['3.6', '3.7', '3.8', '3.9'] | ||
name: Python ${{ matrix.python-version }} Build & Tests | ||
steps: | ||
- name: Add apt repo | ||
run: sudo add-apt-repository universe | ||
|
||
# Setup Java & Python | ||
- name: Setup Java | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 8 | ||
java-package: jdk | ||
- name: Setup Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
architecture: x64 | ||
|
||
# ICAT Ansible clone and install dependencies | ||
- name: Checkout icat-ansible | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: icatproject-contrib/icat-ansible | ||
ref: change-payara-setup-script-url | ||
path: icat-ansible | ||
- name: Install Ansible | ||
run: pip install -r icat-ansible/requirements.txt | ||
|
||
# Prep for running the playbook | ||
- name: Create hosts file | ||
run: echo -e "[icatdb-minimal-hosts]\nlocalhost ansible_connection=local" > icat-ansible/hosts | ||
- name: Prepare vault pass | ||
run: echo -e "icattravispw" > icat-ansible/vault_pass.txt | ||
- name: Move vault to directory it'll get detected by Ansible | ||
run: mv icat-ansible/vault.yml icat-ansible/group_vars/all | ||
- name: Replace default payara user with Actions user | ||
run: | | ||
sed -i -e "s/^payara_user: \"glassfish\"/payara_user: \"runner\"/" icat-ansible/group_vars/all/vars.yml | ||
# Create local instance of ICAT | ||
- name: Run ICAT Ansible Playbook | ||
run: | | ||
ansible-playbook icat-ansible/icatdb-minimal-hosts.yml -i icat-ansible/hosts --vault-password-file icat-ansible/vault_pass.txt -vv | ||
- name: Checkout DataGateway API | ||
uses: actions/checkout@v2 | ||
with: | ||
path: datagateway-api | ||
|
||
# Prep for using the API for tests | ||
- name: Create log file | ||
run: touch logs.log | ||
- name: Configure log file location | ||
run: echo "`jq -r --arg REPO_DIR "$GITHUB_WORKSPACE/logs.log" \ | ||
'.log_location=$REPO_DIR' datagateway-api/config.json.example`" > datagateway-api/config.json.example | ||
- name: Create config.json | ||
run: cp datagateway-api/config.json.example datagateway-api/config.json | ||
|
||
# Install Nox, Poetry and API's dependencies | ||
- name: Install Nox | ||
run: pip install nox==2020.8.22 | ||
- name: Install Poetry | ||
run: pip install poetry==1.1.4 | ||
- name: Install dependencies | ||
run: cd datagateway-api/ && poetry install | ||
|
||
- name: Add dummy data to icatdb | ||
run: | | ||
cd datagateway-api && poetry run python -m util.icat_db_generator -s 4 -y 3 | ||
# Run Nox tests session, saves and uploads a coverage report to codecov | ||
- name: Run Nox tests session | ||
run: nox -s tests -f datagateway-api/noxfile.py -- --cov=datagateway_api --cov-report=xml | ||
- name: Upload code coverage report | ||
if: matrix.python-version == '3.6' | ||
uses: codecov/codecov-action@v1 | ||
with: | ||
directory: ./datagateway-api | ||
|
||
linting: | ||
runs-on: ubuntu-16.04 | ||
name: Linting | ||
steps: | ||
- name: Setup Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.6' | ||
architecture: x64 | ||
- name: Checkout DataGateway API | ||
uses: actions/checkout@v2 | ||
with: | ||
path: datagateway-api | ||
|
||
- name: Install Nox | ||
run: pip install nox==2020.8.22 | ||
- name: Install Poetry | ||
run: pip install poetry==1.1.4 | ||
|
||
- name: Run Nox lint session | ||
run: nox -s lint -f datagateway-api/noxfile.py | ||
|
||
formatting: | ||
runs-on: ubuntu-16.04 | ||
name: Code Formatting | ||
steps: | ||
- name: Setup Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.6' | ||
architecture: x64 | ||
- name: Checkout DataGateway API | ||
uses: actions/checkout@v2 | ||
with: | ||
path: datagateway-api | ||
|
||
- name: Install Nox | ||
run: pip install nox==2020.8.22 | ||
- name: Install Poetry | ||
run: pip install poetry==1.1.4 | ||
|
||
- name: Run Nox black session | ||
run: nox -s black -f datagateway-api/noxfile.py | ||
|
||
safety: | ||
runs-on: ubuntu-16.04 | ||
name: Dependency Safety | ||
steps: | ||
- name: Setup Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.6' | ||
architecture: x64 | ||
- name: Checkout DataGateway API | ||
uses: actions/checkout@v2 | ||
with: | ||
path: datagateway-api | ||
|
||
- name: Install Nox | ||
run: pip install nox==2020.8.22 | ||
- name: Install Poetry | ||
run: pip install poetry==1.1.4 | ||
|
||
- name: Run Nox safety session | ||
run: nox -s safety -f datagateway-api/noxfile.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ config.json | |
.nox/ | ||
.python-version | ||
.coverage | ||
coverage.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.