2024-10-10 14:37:08 +00:00
|
|
|
name: Python CI
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [main]
|
|
|
|
pull_request:
|
|
|
|
branches: [main]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
test:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
services:
|
|
|
|
neo4j:
|
|
|
|
image: neo4j:3.5
|
|
|
|
ports:
|
|
|
|
- 7687:7687 # Bolt port
|
|
|
|
- 7474:7474 # Web
|
|
|
|
options: >
|
|
|
|
--env NEO4J_AUTH=neo4j/testpassword
|
|
|
|
--env NEO4J_dbms_memory_heap_initial__size=512m
|
|
|
|
--env NEO4J_dbms_memory_heap_max__size=1G
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Set up Python
|
|
|
|
uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: '3.9'
|
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
|
|
|
curl -sSL https://install.python-poetry.org | python3 -
|
|
|
|
poetry install
|
|
|
|
|
|
|
|
- name: Wait for Neo4j to be ready
|
|
|
|
run: |
|
|
|
|
echo "Waiting for Neo4j to start..."
|
|
|
|
sleep 30
|
|
|
|
|
|
|
|
- name: Run Tests
|
|
|
|
env:
|
|
|
|
NEO4J_HTTP_PORT: 7474
|
|
|
|
NEO4J_BOLT_PORT: 7687
|
|
|
|
NEO4J_HOSTNAME: localhost
|
|
|
|
NEO4J_USER: neo4j
|
|
|
|
NEO4J_PASSWORD: testpassword
|
|
|
|
run: |
|
|
|
|
# Ensure we can connect to Neo4j
|
|
|
|
curl -I http://localhost:7474
|
2024-10-11 14:04:13 +00:00
|
|
|
poetry run python -m unittest discover -s tests
|
|
|
|
build:
|
|
|
|
needs: test # Only run after tests succeed
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Set up Python
|
|
|
|
uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: '3.9'
|
|
|
|
|
|
|
|
- name: Install Poetry
|
|
|
|
run: curl -sSL https://install.python-poetry.org | python3 -
|
|
|
|
|
|
|
|
- name: Install Dependencies
|
|
|
|
run: poetry install
|
|
|
|
|
|
|
|
- name: Build the package
|
|
|
|
run: poetry build
|
2024-10-11 14:12:39 +00:00
|
|
|
|
|
|
|
publish:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: build
|
|
|
|
steps:
|
2024-10-11 14:19:06 +00:00
|
|
|
- name: 'Upload Artifact'
|
|
|
|
uses: actions/upload-artifact@v4
|
|
|
|
with:
|
|
|
|
name: my-artifact
|
2024-10-11 14:31:58 +00:00
|
|
|
path: ${{ github.workspace }}/norduniclient-package.md
|
2024-10-11 14:19:06 +00:00
|
|
|
retention-days: 5
|