Skip to content

Commit

Permalink
Merge pull request #2 from ckvsoft/main
Browse files Browse the repository at this point in the history
workflows
  • Loading branch information
ckvsoft authored Jan 28, 2024
2 parents 5e9ca07 + 135c623 commit 59e4c38
Show file tree
Hide file tree
Showing 3 changed files with 149 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/increase_main_version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Increase Version on Main Branch

on:
pull_request:
branches:
- main

jobs:
increase_version:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Determine version increment
id: determine_increment
run: echo "::set-output name=increment::$(if [ "${{ github.event_name }}" == 'push' ]; then echo 'patch'; else echo 'minor'; fi)"

- name: Increase version
run: |
# Erhalte die aktuelle Version aus der core/version.py-Datei
CURRENT_VERSION=$(sed -n "s/__version__ = \"\([^']\+\)\"/\1/p" core/version.py)
# Bestimme den Inkrementtyp basierend auf dem Ereignis
INCREMENT_TYPE=$(echo ${{ steps.determine_increment.outputs.increment }})
# Inkrementiere die Version
if [ "$INCREMENT_TYPE" == 'patch' ]; then
IFS='.' read -r major minor patch <<< "$CURRENT_VERSION"
NEW_VERSION="$major.$minor.$((patch + 1))"
elif [ "$INCREMENT_TYPE" == 'minor' ]; then
IFS='.' read -r major minor patch <<< "$CURRENT_VERSION"
NEW_VERSION="$major.$((minor + 1)).0"
else
echo "Fehler: Ungültiger Inkrementtyp."
exit 1
fi
# Aktualisiere die core/version.py-Datei
if [ -n "$CURRENT_VERSION" ] && [ -n "$NEW_VERSION" ]; then
sed -i "s/$CURRENT_VERSION/$NEW_VERSION/" core/version.py
git diff --exit-code || {
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git commit -am "Update version to ${NEW_VERSION}"
git push origin main
}
else
echo "Fehler: CURRENT_VERSION oder NEW_VERSION ist leer."
fi
35 changes: 35 additions & 0 deletions .github/workflows/increase_version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Increase Version on Dev Branch

on:
push:
branches:
- dev

jobs:
increase_version:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Increase version
run: |
# Erhalte die aktuelle Version aus der core/version.py-Datei
CURRENT_VERSION=$(sed -n "s/__version__ = \"\([^']\+\)\"/\1/p" core/version.py)
# Erhöhe die Version
NEW_VERSION=$(python -c "major, minor, patch = map(int, '$CURRENT_VERSION'.split('.')); patch += 1; print(f'{major}.{minor}.{patch}')")
# Aktualisiere die core/version.py-Datei
if [ -n "$CURRENT_VERSION" ] && [ -n "$NEW_VERSION" ]; then
sed -i "s/$CURRENT_VERSION/$NEW_VERSION/" core/version.py
git diff --exit-code || {
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git commit -am "Update version to ${NEW_VERSION}"
git push origin dev
}
else
echo "Fehler: CURRENT_VERSION oder NEW_VERSION ist leer."
fi
63 changes: 63 additions & 0 deletions .github/workflows/venus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: venus
on:
workflow_dispatch:
pull_request:
push:

jobs:
docker:
runs-on: ubuntu-latest
container:
image: victronenergy/venus-docker
options: --cpus 1
steps:
- name: Set branch name
id: set_branch
run: echo "BRANCH_NAME=${GITHUB_HEAD_REF}" >> $GITHUB_ENV
- name: Checkout code
uses: actions/checkout@v3
- name: Check for dockerenv file
run: (ls /.dockerenv && echo Found dockerenv) || (echo No dockerenv)
- name: Install more UNIX tools
run: |
if which apt > /dev/null
then
apt update
apt -y install wget curl unzip
elif which opkg > /dev/null
then
opkg update
opkg install wget
opkg install curl
opkg install unzip
else
echo "W: Tests limited because of non-avail of wget and curl"
fi
- name: Set script permissions
run: chmod +x ./scripts/seuss_install.sh
- name: Execute Installation under Venus OS
run: |
echo pwd
pwd
echo ls
ls
echo "BRANCH = ${{ env.BRANCH_NAME }}"
echo seuss_install.sh
if ./scripts/seuss_install.sh ; then
echo "[OK]"
else
echo "[FAIL]"
pwd
HEAD_PATH=$(which head)
find . | $HEAD_PATH -n 30
exit 1
fi
env:
github_branch: ${{ env.BRANCH_NAME }}
NOSUDO: 1
ACTOR: ${{ github.actor }}
- name: Execute SEUSS under Venus OS
run: |
. /data/seuss/venv/bin/activate && python3 seuss.py
env:
TESTRUN: 1

0 comments on commit 59e4c38

Please sign in to comment.