git workflow WIP #286
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: python=3.11 | |
| on: | |
| push: | |
| branches: [ main, master, dev ] | |
| pull_request: | |
| branches: [ main, master ] | |
| jobs: | |
| run-tests: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: [ "3.11" ] # add more if needed | |
| env: | |
| OPENQUAKE_VERSION: "3.15.0" | |
| SETTINGS_MODULE: "egsim.settings_debug" | |
| steps: | |
| # Checkout repository | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install system packages | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| build-essential \ | |
| gfortran \ | |
| libopenblas-dev \ | |
| liblapack-dev \ | |
| cmake \ | |
| pkg-config \ | |
| proj-bin \ | |
| proj-data \ | |
| libproj-dev | |
| # Set up Python | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| # Create and activate virtual environment | |
| - name: Create virtualenv | |
| run: | | |
| python -m venv venv | |
| source venv/bin/activate | |
| python -m pip install --upgrade pip setuptools wheel | |
| # Download openquake.engine source distribution and install editable | |
| - name: Install openquake.engine (editable) | |
| run: | | |
| source venv/bin/activate | |
| mkdir -p /tmp/openquake | |
| cd /tmp/openquake | |
| # Force source distribution download | |
| pip download --no-binary :all: openquake.engine==${OPENQUAKE_VERSION} | |
| # Extract the tar.gz (sdist) | |
| tar -xvf openquake.engine-${OPENQUAKE_VERSION}.tar.gz | |
| cd openquake.engine-${OPENQUAKE_VERSION} | |
| pip install -e . | |
| # Install project dependencies | |
| - name: Install project dependencies | |
| run: | | |
| source venv/bin/activate | |
| if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
| - name: Test lib (smtk) | |
| run: | | |
| source venv/bin/activate | |
| pytest --ignore=./tests/tmp/ -xvvv ./tests/smtk | |
| # Run Django migrations and pytest | |
| - name: Test web app | |
| run: | | |
| source venv/bin/activate | |
| python manage.py migrate | |
| DJANGO_SETTINGS_MODULE=${SETTINGS_MODULE}; pytest --ignore=./tests/tmp/ -xvvv ./tests/django |