diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9905a9d..a98e7f9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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]' }} diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..1a6fb3e --- /dev/null +++ b/.gitlab-ci.yml @@ -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 diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 0000000..e0cf702 --- /dev/null +++ b/compose.yaml @@ -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 diff --git a/pyproject.toml b/pyproject.toml index 627acfe..94643dc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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] diff --git a/tests/api/test_energy_model_optimization.py b/tests/api/test_energy_model_optimization.py index 3be3509..727326c 100644 --- a/tests/api/test_energy_model_optimization.py +++ b/tests/api/test_energy_model_optimization.py @@ -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): """