Skip to content

Update controller.sh #783

Update controller.sh

Update controller.sh #783

Workflow file for this run

name: basic
on:
push:
pull_request:
jobs:
yamllint:
runs-on: ubuntu-latest
steps:
- name: Set BRANCH_NAME from github.ref
id: extract_branch
run: echo "BRANCH_NAME=${GITHUB_HEAD_REF}" >> $GITHUB_ENV
- name: Checkout code
uses: actions/checkout@v3
- name: Install yamllint
run: sudo apt-get install yamllint
- name: Yamllint all YAML files
run: |
yamllint .github/workflows/*.yml | \
grep -v line-length | \
grep error && failure || echo "No errors found."
shellcheck:
runs-on: ubuntu-latest
container:
image: koalaman/shellcheck-alpine
options: --cpus 1
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Check for dockerenv file
run: |
(ls /.dockerenv && echo Found dockerenv) || (echo No dockerenv)
- name: Show shellcheck version
run: |
shellcheck --version
- name: Lint all shell scripts
run: |
# https://github.com/koalaman/shellcheck/blob/master/shellcheck.1.md
if ! shellcheck \
victron-venus-os-install.sh scripts/controller.sh scripts/run
then
ret=$?
if [ "0" = "$ret" ]; then
echo "$ret: All files successfully scanned with no issues."
echo " Well done, just maybe the return code is not processed properly?!"
elif [ "1" = "$ret" ]; then
echo "1: All files successfully scanned with some issues."
echo " Good enough!"
elif [ "2" = "$ret" ]; then
echo "2: Some files could not be processed."
exit $ret
elif [ "3" = "$ret" ]; then
echo "3: ShellCheck was invoked with bad syntax."
exit $ret
elif [ "4" = "$ret" ]; then
echo "4: ShellCheck was invoked with bad options."
exit $ret
else
echo "E: SpellCheck exited with unexpected return code '$ret'."
exit $ret
fi
else
echo "$ret: All files successfully scanned with no issues."
echo " Well done!"
fi
execute:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- name: Set branch name
id: set_branch
run: |
if [[ $GITHUB_HEAD_REF ]]; then
echo "BRANCH_NAME=$GITHUB_HEAD_REF" >> $GITHUB_ENV
else
echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
fi
- name: Checkout code
uses: actions/checkout@v3
- name: Extend default set of UNIX tools
run: |
echo "BRANCH = ${{ env.BRANCH_NAME }}"
if [ "ubuntu-latest" = ${{ matrix.os }} ]; then
sudo apt-get install wget curl dbus sed gawk
else
echo "I: Nothing to install for ${{ matrix.os }}"
fi
- name: Set script permissions
run: chmod +x ./victron-venus-os-install.sh
- name: Install
run: echo 'y' | sh ./victron-venus-os-install.sh
env:
DEBUG: 1
DESTDIR: /tmp/testing
BRANCH: ${{ env.BRANCH_NAME }}
ACTOR: ${{ github.actor }}
- name: Execute Run-Script
run: /tmp/testing//data/etc/Spotmarket-Switcher/service/run
env:
DEBUG: 1
rc_local_file: /tmp/testing_rc.local
- name: Execute Control-Script
run: bash scripts/controller.sh # /tmp/testing//data/etc/Spotmarket-Switcher/controller.sh
env:
DEBUG: 1
LOG_FILE: /tmp/testing_controller.log
CONFIG: sample.config.txt