norduniclient/.github/workflows/ci.yml
Benedith Mulongo 28661250bb
Some checks are pending
Python CI / test (push) Waiting to run
Python CI / build (push) Blocked by required conditions
Python CI / publish (push) Blocked by required conditions
Update github actions
2024-10-18 14:52:15 +02:00

90 lines
2 KiB
YAML

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
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
- name: Publish artifacts
if: github.ref == 'refs/tags/v*'
run: |
poetry publish --build
echo "Artifacts published successfully"
publish:
runs-on: ubuntu-latest
needs: build
steps:
- name: 'Upload Artifact'
uses: actions/upload-artifact@v4
with:
name: ${{ github.event.release.tag_name }}-build
path: dist/
retention-days: 5