Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix GA pipeline #156

Merged
merged 4 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 11 additions & 19 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ on:
pull_request: # PR
workflow_dispatch: # manual

env:
PYENV_ROOT: /home/runner/.pyenv

jobs:
build:
runs-on: ubuntu-latest
env:
TRAVIS: 'true' # Skip tests requiring data
ROOT_DIR_SRC: ${{github.workspace}}/..
strategy:
fail-fast: false
matrix:
Expand All @@ -23,20 +25,15 @@ jobs:
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
if: matrix.python-version != '2.7'
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Set up Python 2.7
if: matrix.python-version == '2.7'
- name: Install pyenv
run: |
curl https://pyenv.run | bash
echo "$PYENV_ROOT/bin" >> $GITHUB_PATH
echo "$PYENV_ROOT/shims" >> $GITHUB_PATH
- name: Install Python ${{ matrix.python-version }}
run: |
sudo apt-get update
sudo apt-get install -y python2.7 python2.7-dev
sudo ln -sf python2.7 /usr/bin/python
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py
python get-pip.py
rm get-pip.py
pyenv install ${{ matrix.python-version }}
pyenv global ${{ matrix.python-version }}
pip install --upgrade pip setuptools wheel
- name: Start MongoDB
uses: supercharge/[email protected]
Expand All @@ -45,17 +42,12 @@ jobs:
mongodb-replica-set: test-rs
- name: Install dependencies
run: |
cd $ROOT_DIR_SRC
pip install virtualenv
virtualenv venv
. $ROOT_DIR_SRC/venv/bin/activate
pip install https://files.pythonhosted.org/packages/3e/5c/2867e46f03d2fcc3d014a02eeb11ec55f3f8d9eddddcc5578ae8457f84f8/ERPpeek-1.7.1-py2.py3-none-any.whl
pip install pytest-cov pytest coveralls plantmeter
cd ${{github.workspace}}
pip install -e .
- name: Unit tests
run: |
. $ROOT_DIR_SRC/venv/bin/activate
pytest
- name: Coveralls
uses: AndreMiras/coveralls-python-action@develop
Expand Down
7 changes: 3 additions & 4 deletions som_generationkwh/res_partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,12 @@ def _hourly_rights_generationkwh(self, cursor, uid, partner_id, start_date=None,

@staticmethod
def _prepare_datetime_value_www_response(dict_with_data):
# https://stackoverflow.com/questions/8777753/converting-datetime-date-to-utc-timestamp-in-python/8778548#8778548
cet = pytz.timezone('CET')
utc = pytz.timezone('UTC')
cet = pytz.timezone('Europe/Madrid')
utc = pytz.utc
return [
{
'date': (
datetime.strptime(k, '%Y-%m-%d %H:%M:%S').replace(tzinfo=cet)
cet.localize(datetime.strptime(k, '%Y-%m-%d %H:%M:%S'))
- datetime(1970, 1, 1, tzinfo=utc)
).total_seconds()*1000, # javascript works with 3 more 0 than python
'value': dict_with_data[k]
Expand Down
Loading