diff --git a/.github/lint-scripts.sh b/.github/lint-scripts.sh new file mode 100755 index 0000000..194b74d --- /dev/null +++ b/.github/lint-scripts.sh @@ -0,0 +1,23 @@ +#!/bin/sh +# +# lint bash scripts +# + +set -o errexit + +CONFIG_DIR=".github" +HOOKS_DIR="hooks" +CONTAINER_DIR="containers" + +TMP_FILE="$(mktemp)" + +find "${CONFIG_DIR}" -type f -name "*.sh" > "${TMP_FILE}" +find "${HOOKS_DIR}" -type f -name "*.sh" >> "${TMP_FILE}" +find "${CONTAINER_DIR}" -type f -name "*.sh" >> "${TMP_FILE}" + +while read -r FILE; do + echo lint "${FILE}" + shellcheck -x "${FILE}" +done < "${TMP_FILE}" + +rm "${TMP_FILE}" diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..2ea4e55 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,27 @@ +name: ci + +on: + pull_request: + +jobs: + lint-bash-scripts: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v1 + - name: Lint Bash scripts + uses: docker://koalaman/shellcheck-alpine:v0.7.0 + with: + args: .github/lint-scripts.sh + + install-docker-compose: + name: install-docker-compose + runs-on: ubuntu-latest + needs: lint-bash-scripts + steps: + - name: Checkout + uses: actions/checkout@v1 + - name: get containers + run: docker-compose pull + - name: install + run: docker-compose up