Skip to content

185 calculating price for stored energy in battery and using dynamically for optimization #30

185 calculating price for stored energy in battery and using dynamically for optimization

185 calculating price for stored energy in battery and using dynamically for optimization #30

Workflow file for this run

name: feature - build image and push
# This workflow builds and pushes a Docker image to GitHub Container Registry.
# It is triggered on pushes to branches other than "main" and "develop", and can also be triggered manually.
# The image is tagged with the branch name of the push event.
# The workflow uses the GITHUB_TOKEN secret for authentication with GitHub Container Registry.
on:
push:
branches-ignore:
- "main"
- "develop"
pull_request:
branches: ["develop"]
workflow_dispatch: # allows manual triggering of the workflow
jobs:
pytest:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest
- name: Run unit and regression tests
run: python -m pytest -v tests/
build_image:
needs: pytest
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Convert repository owner to lowercase
run: echo "owner=$(echo '${{ github.repository_owner }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- name: Sanitize ref name for Docker tag
run: echo "clean_ref=$(echo '${{ github.ref_name }}' | sed 's/\//_/g')" >> $GITHUB_ENV
# 1. Setup QEMU for ARM64 emulation
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: all
# 2. Setup Buildx
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# 3. Log in to GitHub Container Registry
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# 4. Build & Push Multi-Arch Image
- name: Build and push multi-platform Docker image
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
tags: |
ghcr.io/${{ env.owner }}/eos_connect:feature_dev_${{ env.clean_ref }}
push: true