Skip to content

Commit

Permalink
Merge pull request #200 from ral-facilities/feature/remove-sql-depend…
Browse files Browse the repository at this point in the history
…ency-from-backends-#154

Recreate SQL Dependency PR
  • Loading branch information
MRichards99 authored Jan 21, 2021
2 parents d5ea7ba + c84eccf commit 89b9d19
Show file tree
Hide file tree
Showing 100 changed files with 8,388 additions and 4,400 deletions.
10 changes: 10 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# .flake8
[flake8]
select = A,B,B9,BLK,C,E,F,I,N,S,W
ignore = E203,W503,E501
max-complexity = 17
max-line-length = 80
application-import-names = datagateway_api,test,util
import-order-style = google
per-file-ignores = test/*:S101,util/icat_db_generator.py:S311
enable-extensions=G
8 changes: 4 additions & 4 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ This PR will close #{issue number}
## Description
Enter a description of the changes here

## Testing instructions
## Testing Instructions
Add a set up instructions describing how the reviewer should test the code

- [ ] Review code
- [ ] Check Travis build
- [ ] Check GitHub Actions build
- [ ] Review changes to test coverage
- [ ] {more steps here}

## Agile board tracking
connect to #{issue number}
## Agile Board Tracking
Connect to #{issue number}
157 changes: 157 additions & 0 deletions .github/workflows/ci-build.yml
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ venv/
logs.log
config.json
.vscode/
.nox/
.python-version
.coverage
coverage.xml
18 changes: 18 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.3.0
hooks:
- id: check-docstring-first
- id: check-json
- id: check-toml
- id: check-yaml
- id: detect-private-key
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: local
hooks:
- id: black
name: black
entry: poetry run black
language: system
types: [python]
Loading

0 comments on commit 89b9d19

Please sign in to comment.