Skip to content

Commit

Permalink
Merge pull request #148 from NOWUM/fix-deployment
Browse files Browse the repository at this point in the history
Fix deployment
  • Loading branch information
maurerle authored Aug 14, 2023
2 parents 856d660 + fc2b782 commit 1347d1b
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 39 deletions.
40 changes: 1 addition & 39 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,46 +148,8 @@ jobs:
report_individual_runs: true



# Test if project still runs on every os
test_build:
needs: [test, lint]
runs-on: ${{ matrix.os }}
name: Build Python ${{ matrix.py }} @ ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
py: ["3.9", "3.10"]
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
architecture: 'x64'

- name: Cache pip
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{matrix.os}}-${{ matrix.py }}-${{ hashFiles('pyproject.toml') }}-${{ hashFiles('requirements**.txt') }}

- name: Install requirements
run: |
pip install --upgrade --upgrade-strategy eager -r requirements-dev.txt -e .
- name: Run tests
run: |
pytest ./tests
build_dev_image:
needs: [ test, lint, test_build ]
needs: [ test, lint ]
runs-on: ubuntu-latest
name: "Build dev image"
if: ${{ success() && github.actor != 'dependabot[bot]' }}
Expand Down
35 changes: 35 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
default:
tags:
- nowum

stages:
- deploy-dev
- deploy-release

deploy-dev:
image: alpine:latest
stage: deploy-dev
script:
- chmod og= $SSH_ED25519
- apk update && apk add openssh-client
- ssh -p 8080 -i $SSH_ED25519 -o StrictHostKeyChecking=no $SERVER_USER@$SERVER_IP "cd EnSysMod && docker-compose pull ensysmod-dev && docker-compose down ensysmod-dev && docker-compose up ensysmod-dev -d && docker system prune -f"
only:
- main
environment:
url: https://$SERVER_IP
name: development

deploy-release:
image: alpine:latest
stage: deploy-release
script:
- chmod og= $SSH_ED25519
- apk update && apk add openssh-client
- ssh -p 9000 -i $SSH_ED25519 -o StrictHostKeyChecking=no $SERVER_USER@$SERVER_IP "cd EnSysMod && docker-compose pull && docker-compose down && docker-compose up -d && docker system prune -f"
only:
- tags
except:
- branches
environment:
url: https://$SERVER_IP
name: release
10 changes: 10 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
services:
ensysmod-dev:
image: "ghcr.io/nowum/ensysmod:main"
ports:
- 8080:8080

ensysmod-release:
image: "ghcr.io/nowum/ensysmod:latest"
ports:
- 9000:8080
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ addopts = [
]
markers = [
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
"require_solver: marks tests that require solver to be installed (deselect with '-m \"not require_solver\"')",
]

[tool.coverage.report]
Expand Down
1 change: 1 addition & 0 deletions tests/api/test_energy_model_optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@


@pytest.mark.slow
@pytest.mark.require_solver
@pytest.mark.parametrize("data_folder", ["1node_Example", "Multi-regional_Example"])
def test_optimize_model(client: TestClient, normal_user_headers: Dict[str, str], db: Session, data_folder: str):
"""
Expand Down

0 comments on commit 1347d1b

Please sign in to comment.