mirror of https://github.com/gitwatch/gitwatch
straight conversion to bats-core, added super-linter checking
parent
a56ae1c4b2
commit
ad9b4b9c9f
@ -0,0 +1,11 @@
|
||||
[{*.sh,*.bats,*.bash}]
|
||||
# like -i=2
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
shell_variant = auto # like -ln=auto
|
||||
binary_next_line = true # like -bn
|
||||
switch_case_indent = true # like -ci
|
||||
space_redirects = true # like -sr
|
||||
#keep_padding = true # like -kp
|
||||
#function_next_line = true # like -fn
|
@ -0,0 +1,78 @@
|
||||
name: Gitwatch QA
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
branches: [master]
|
||||
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
#-----------------------------------------------------------------------------
|
||||
super-lint:
|
||||
name: Lint Code Base
|
||||
|
||||
# Don't run action if commit message has #noaction in it.
|
||||
if: "! contains(github.event.head_commit.message, '#noaction')"
|
||||
|
||||
# I don't think running lint on multiple os' will do any good.
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Run Super-Linter
|
||||
uses: github/super-linter@v3
|
||||
env:
|
||||
DEFAULT_BRANCH: master
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
bats:
|
||||
name: BATS Tests
|
||||
|
||||
# Don't run action if commit message has #noaction in it.
|
||||
if: "! contains(github.event.head_commit.message, '#noaction')"
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macOS-latest]
|
||||
|
||||
# The type of runner that the job will run on
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
timeout-minutes: 5
|
||||
|
||||
steps:
|
||||
- name: Setup BATS
|
||||
# Even though this says 1.2.0,it's actually using 1.2.1
|
||||
uses: mig4/setup-bats@v1.2.0
|
||||
|
||||
- name: Install gitwatch dependencies
|
||||
shell: bash
|
||||
run: |
|
||||
if [ "$RUNNER_OS" == "Linux" ]; then
|
||||
sudo apt-get -y install inotify-tools
|
||||
|
||||
elif [ "$RUNNER_OS" == "macOS" ]; then
|
||||
brew install fswatch
|
||||
brew install coreutils # in order to get readlink
|
||||
|
||||
else
|
||||
echo "Unsupported OS: $RUNNER_OS"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Run tests
|
||||
shell: bash
|
||||
run: |
|
||||
git config --global user.email "test@email.com"
|
||||
git config --global user.name "test user"
|
||||
bashcov bats -rt tests
|
@ -1,26 +1,32 @@
|
||||
setup() {
|
||||
# Time to wait for gitwatch to respond
|
||||
WAITTIME=4
|
||||
# Set up directory structure and initialize remote
|
||||
testdir=$(mktemp -d)
|
||||
cd $testdir
|
||||
mkdir remote
|
||||
cd remote
|
||||
git init -q --bare
|
||||
cd ..
|
||||
mkdir local
|
||||
cd local
|
||||
git clone -q ../remote
|
||||
# Time to wait for gitwatch to respond
|
||||
# shellcheck disable=SC2034
|
||||
WAITTIME=4
|
||||
# Set up directory structure and initialize remote
|
||||
testdir=$(mktemp -d)
|
||||
# shellcheck disable=SC2164
|
||||
cd "$testdir"
|
||||
mkdir remote
|
||||
# shellcheck disable=SC2164
|
||||
cd remote
|
||||
git init -q --bare
|
||||
# shellcheck disable=SC2103
|
||||
cd ..
|
||||
# shellcheck disable=SC2164
|
||||
mkdir local
|
||||
# shellcheck disable=SC2164
|
||||
cd local
|
||||
git clone -q ../remote
|
||||
}
|
||||
|
||||
|
||||
teardown() {
|
||||
# Remove testing directories
|
||||
cd /tmp
|
||||
# Remove testing directories
|
||||
# shellcheck disable=SC2164
|
||||
cd /tmp
|
||||
|
||||
# rm -rf $testdir
|
||||
# rm -rf $testdir
|
||||
|
||||
# Make sure gitwatch script gets killed if script stopped background
|
||||
# Must kill the entire tree of processes generated
|
||||
pkill -15 -P $GITWATCH_PID
|
||||
# Make sure gitwatch script gets killed if script stopped background
|
||||
# Must kill the entire tree of processes generated
|
||||
pkill -15 -P "$GITWATCH_PID"
|
||||
}
|
||||
|
Loading…
Reference in New Issue