Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Python3.11 to tests, README detail and bump dependencies #87

Merged
merged 11 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ci_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ auth:
private_key_path: /home/runner/work/operationsgateway-api/id_rsa
public_key_path: /home/runner/work/operationsgateway-api/id_rsa.pub
jwt_algorithm: RS256
access_token_validity_mins: 60
access_token_validity_mins: 120
refresh_token_validity_days: 7
fedid_server_url: ldap://fed.cclrc.ac.uk:389
fedid_server_ldap_realm: FED.CCLRC.AC.UK
Expand Down
20 changes: 14 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,21 @@ on:

jobs:
tests:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9"]
os: [ubuntu-20.04, ubuntu-22.04]
python-version: ["3.8", "3.9", "3.10", "3.11"]
exclude:
- os: ubuntu-22.04
python-version: "3.8"
- os: ubuntu-22.04
python-version: "3.9"
- os: ubuntu-20.04
python-version: "3.10"
- os: ubuntu-20.04
python-version: "3.11"
runs-on: ${{ matrix.os }}

name: Python ${{ matrix.python-version }} Tests
steps:
Expand Down Expand Up @@ -48,9 +58,6 @@ jobs:
- name: Get database name from ci_config.yml
run: echo "DATABASE_NAME=$(grep database_name .github/ci_config.yml | cut -d ':' -f 2 | tr -d '[:space:]')" >> $GITHUB_ENV

- name: Add test users to OperationsGateway database
run: mongoimport --db='${{ env.DATABASE_NAME }}' --collection='users' --file='util/users_for_mongoimport.json'

# Load Poetry virtual environment dependencies and install API dependencies
- name: Load Poetry cache
uses: actions/cache@v3
Expand Down Expand Up @@ -114,8 +121,9 @@ jobs:
repository: ral-facilities/operationsgateway-test-data
path: operationsgateway-test-data
ssh-key: ${{ secrets.SSH_PRIV_OG_TEST_DATA_ACTIONS }}

- name: Run ingestion script
run: poetry run python util/ingest_hdf.py -p operationsgateway-test-data/dev_server -U backend -P back
run: poetry run python util/ingest_hdf.py -p operationsgateway-test-data/dev_server -U backend -P back -j util/users_for_mongoimport.json

- name: Load Poetry cache for Nox tests session
uses: actions/cache@v3
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,14 @@ This is an API built using [FastAPI](https://fastapi.tiangolo.com/) to work with


## Environment Setup
If not already present, you may need to install development tools for the desired Python version using the appropriate package manager for your OS. For example, for Python3.8 on Fedora or RHEL:
```bash
sudo dnf install "@Development Tools" python38 python38-pip python38-setuptools python38-devel openldap-devel git
```

[Poetry](https://python-poetry.org/) is used to manage the dependencies of this API. To install Poetry, follow [the instructions](https://python-poetry.org/docs/master/#installing-with-the-official-installer) from their documentation.

To install the project's dependencies, execute `poetry install`. The dependencies and the code in this repo are compatible with Python 3.6+.
To install the project's dependencies, execute `poetry install`. The dependencies and the code in this repo are compatible with Python >=3.8, <3.12.

## Nox Sessions
Like [DataGateway API](https://github.com/ral-facilities/datagateway-api), this repository contains a [Nox](https://nox.thea.codes) file (`noxfile.py`) which exists in the root level of this repository. There are a handful of sessions which help with repetitive tasks during development To install Nox, use the following command:
Expand Down
2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def safety(session):
session.log("Error: The temporary requirements file could not be closed")


@nox.session(python=["3.8", "3.9", "3.10"], reuse_venv=True)
@nox.session(python=["3.8", "3.9", "3.10", "3.11"], reuse_venv=True)
def tests(session):
args = session.posargs
session.run("poetry", "install", external=True)
Expand Down
Loading
Loading