Skip to content

Commit 35d11d0

Browse files
committed
Added action to check isort
1 parent 1208e61 commit 35d11d0

4 files changed

Lines changed: 39 additions & 0 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Lint and test
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
8+
isort:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Check out code
12+
uses: actions/checkout@v2
13+
14+
- name: Check imports order
15+
uses: sergioteula/pytools
16+
run: ./scripts/check_isort

.shellcheckrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# ~/.shellcheckrc
2+
3+
disable=SC1091

scripts/check_isort

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#! /bin/bash -e
2+
3+
ROOT_DIR="$(git rev-parse --show-toplevel)"
4+
source "${ROOT_DIR}/scripts/helpers"
5+
6+
if [ -n "$(check_if_installed docker)" ]; then
7+
docker run -v "${PWD}:/code" sergioteula/pytools isort -c .
8+
elif [ -n "$(check_if_installed isort)" ]; then
9+
isort -c .
10+
else
11+
echo "Please install Docker or isort"
12+
exit 1
13+
fi

scripts/helpers

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#! /bin/bash -e
2+
3+
check_if_installed() {
4+
if [ -x "$(command -v "${1}")" ]; then
5+
echo "${1} is installed"
6+
fi
7+
}

0 commit comments

Comments
 (0)