Add data_normalisation_test and load_postgres_test #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI Pipeline | |
| on: | |
| push: | |
| branches: | |
| - dev | |
| pull_request: | |
| branches: | |
| - staging | |
| - main | |
| env: | |
| NIFIPULSE_AUTO_ENV: "1" | |
| PGUSER: postgres | |
| PGPASSWORD: postgres | |
| PGHOST: localhost | |
| PGPORT: "5432" | |
| PGDATABASE: metrics_db | |
| jobs: | |
| build-test-dev: | |
| if: github.ref == 'refs/heads/dev' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # Install dependencies (change this depending on your stack) | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install dependencies | |
| run: | | |
| pip install -U pip | |
| pip install -e . | |
| pip install flake8 | |
| - name: Lint | |
| run: | | |
| pip install flake8 | |
| flake8 . | |
| - name: Docker build (dev) | |
| run: | | |
| docker build -t nifipulse-dev . | |
| integration-test-staging: | |
| if: github.event.pull_request.base.ref == 'staging' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Docker build | |
| run: docker build -t nifipulse-staging . | |
| - name: Docker compose up | |
| run: docker compose -f docker-compose.yml up -d | |
| - name: Wait for services | |
| run: sleep 15 | |
| - name: Integration tests | |
| run: | | |
| pip install -r tests/requirements.txt | |
| pytest tests/integration | |
| release-main: | |
| if: github.event.pull_request.base.ref == 'main' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Docker build (prod) | |
| run: docker build -t nifipulse-prod . | |
| - name: Tag release | |
| run: | | |
| VERSION="v1.${{ github.run_number }}" | |
| echo "Tagging version: $VERSION" | |
| git tag $VERSION | |
| git push origin $VERSION | |
| - name: Push to container registry | |
| run: | | |
| echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin | |
| docker tag nifipulse-prod myregistry/nifipulse:$VERSION | |
| docker push myregistry/nifipulse:$VERSION |