norduniclient/.github/workflows/ci.yml

90 lines
2 KiB
YAML
Raw Normal View History

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
2024-10-18 12:52:15 +00:00
- name: Publish artifacts
if: github.ref == 'refs/tags/v*'
run: |
poetry publish --build
echo "Artifacts published successfully"
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:
2024-10-18 12:52:15 +00:00
name: ${{ github.event.release.tag_name }}-build
path: dist/
2024-10-11 14:19:06 +00:00
retention-days: 5