Skip to content

Commit

Permalink
Merge branch 'main' into ci-test-multi-python
Browse files Browse the repository at this point in the history
  • Loading branch information
nhoening committed Sep 14, 2023
2 parents 9d95ad8 + d2aed6a commit dda2a1a
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
name: build-docker-image

on:
pull_request:
types:
- opened
- synchronize
push:
branches:
- main

jobs:
build:
name: Build Docker Image
runs-on: ubuntu-latest
services:
postgres:
env:
POSTGRES_DB: flexmeasures_test
POSTGRES_PASSWORD: flexmeasures_test
POSTGRES_USER: flexmeasures_test
image: postgres:latest
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build Docker Image
run: docker build -t flexmeasures:latest -f Dockerfile .
- name: Generate random secret key
run: echo "SECRET_KEY=$(python3 -c 'import secrets; print(secrets.token_hex(24))')"
>> .env
- name: Export SQLALCHEMY_DATABASE_URI
run: echo "SQLALCHEMY_DATABASE_URI=postgresql://flexmeasures_test:flexmeasures_test@127.0.0.1:5432/flexmeasures_test"
>> .env
- name: Keep running flexmeasures container in background
run: docker run -t -d --env-file .env --network=host --name fm-container flexmeasures:latest
- name: Execute database upgrade
run: docker exec --env-file .env fm-container flexmeasures
db upgrade
- name: Add toy user
run: docker exec --env-file .env fm-container flexmeasures
add toy-account
- name: Generate prices dummy data
run: .github/workflows/generate-dummy-price.sh
- name: Copy prices dummy data
run: docker cp prices-tomorrow.csv fm-container:/app/prices-tomorrow.csv
- name: Add beliefs
run: docker exec --env-file .env fm-container flexmeasures
add beliefs --sensor-id 1 --source toy-user prices-tomorrow.csv --timezone Europe/Amsterdam
- name: Export TOMORROW
run: echo "TOMORROW=$(date --date="next day" '+%Y-%m-%d')"
>> $GITHUB_ENV
- name: Add schedule
run: docker exec --env-file .env fm-container flexmeasures
add schedule for-storage --sensor-id 2 --consumption-price-sensor 1
--start ${TOMORROW}T07:00+01:00 --duration PT12H
--soc-at-start 50% --roundtrip-efficiency 90%
32 changes: 32 additions & 0 deletions .github/workflows/generate-dummy-price.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

set -e
set -x

TOMORROW=$(date --date="next day" '+%Y-%m-%d')

echo "Hour,Price
${TOMORROW}T00:00:00,10
${TOMORROW}T01:00:00,11
${TOMORROW}T02:00:00,12
${TOMORROW}T03:00:00,15
${TOMORROW}T04:00:00,18
${TOMORROW}T05:00:00,17
${TOMORROW}T06:00:00,10.5
${TOMORROW}T07:00:00,9
${TOMORROW}T08:00:00,9.5
${TOMORROW}T09:00:00,9
${TOMORROW}T10:00:00,8.5
${TOMORROW}T11:00:00,10
${TOMORROW}T12:00:00,8
${TOMORROW}T13:00:00,5
${TOMORROW}T14:00:00,4
${TOMORROW}T15:00:00,4
${TOMORROW}T16:00:00,5.5
${TOMORROW}T17:00:00,8
${TOMORROW}T18:00:00,12
${TOMORROW}T19:00:00,13
${TOMORROW}T20:00:00,14
${TOMORROW}T21:00:00,12.5
${TOMORROW}T22:00:00,10
${TOMORROW}T23:00:00,7" > prices-tomorrow.csv
1 change: 1 addition & 0 deletions documentation/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Infrastructure / Support

* Allow additional datetime conversions to quantitative time units, specifically, from timezone-naive and/or dayfirst datetimes, which can be useful when importing data [see `PR #831 <https://github.com/FlexMeasures/flexmeasures/pull/831>`_]
* Add a new tutorial to explain the use of the `AggregatorReporter` to compute the headroom and the `ProfitOrLossReporter` to compute the cost of running a process [see `PR #825 <https://github.com/FlexMeasures/flexmeasures/pull/825>`_]
* Have our CI pipeline (GitHub Actions) build the Docker image and make a schedule [see `PR #800 <https://github.com/FlexMeasures/flexmeasures/pull/800>`_]

v0.15.1 | August 28, 2023
============================
Expand Down

0 comments on commit dda2a1a

Please sign in to comment.