13 changed files with 0 additions and 195 deletions
@ -1,3 +0,0 @@ |
|||||
[submodule "build"] |
|
||||
path = build |
|
||||
url = https://github.com/caarlos0/shell-ci-build.git |
|
@ -1,8 +0,0 @@ |
|||||
language: ruby |
|
||||
install: |
|
||||
- ./install.sh |
|
||||
script: |
|
||||
- ./build.sh |
|
||||
notifications: |
|
||||
email: false |
|
||||
sudo: required |
|
@ -1,8 +0,0 @@ |
|||||
language: bash |
|
||||
install: |
|
||||
- ./install.sh |
|
||||
script: |
|
||||
- ./build.sh |
|
||||
notifications: |
|
||||
email: false |
|
||||
sudo: required |
|
@ -1,22 +0,0 @@ |
|||||
The MIT License (MIT) |
|
||||
|
|
||||
Copyright (c) 2014 Carlos Alexandro Becker |
|
||||
|
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy |
|
||||
of this software and associated documentation files (the "Software"), to deal |
|
||||
in the Software without restriction, including without limitation the rights |
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
||||
copies of the Software, and to permit persons to whom the Software is |
|
||||
furnished to do so, subject to the following conditions: |
|
||||
|
|
||||
The above copyright notice and this permission notice shall be included in all |
|
||||
copies or substantial portions of the Software. |
|
||||
|
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
|
||||
SOFTWARE. |
|
||||
|
|
@ -1,75 +0,0 @@ |
|||||
shell-ci-build [](https://travis-ci.org/caarlos0/shell-ci-build) |
|
||||
================== |
|
||||
|
|
||||
A submodule to lint your shell projects with shellcheck in travis.ci builds. |
|
||||
|
|
||||
## Build |
|
||||
|
|
||||
- The `install.sh` script will install shellckeck. |
|
||||
- The `build.sh` will lint all executable files with shellcheck, avoiding |
|
||||
Ruby, compdef and the like files. It will also ignore all files inside `.git` |
|
||||
directory and files of your `gitmodules`, if any. |
|
||||
|
|
||||
## Usage |
|
||||
|
|
||||
```sh |
|
||||
git submodule add https://github.com/caarlos0/shell-ci-build.git build |
|
||||
cp build/travis.yml.example .travis.yml |
|
||||
``` |
|
||||
|
|
||||
We also support Shippable: |
|
||||
|
|
||||
``` |
|
||||
cp build/shippable.yml.example .shippable.yml |
|
||||
``` |
|
||||
|
|
||||
Or tweak your `.travis.yml` to be like this: |
|
||||
|
|
||||
```yml |
|
||||
language: bash |
|
||||
install: |
|
||||
- ./build/install.sh |
|
||||
script: |
|
||||
- ./build/build.sh |
|
||||
``` |
|
||||
|
|
||||
## Customizing |
|
||||
|
|
||||
You might want to lint other files, to do that, you need your own |
|
||||
`build.sh` and a slight change in `.travis.yml` file. |
|
||||
|
|
||||
Example (from my [dotfiles](https://github.com/caarlos0/dotfiles)): |
|
||||
|
|
||||
```sh |
|
||||
#!/usr/bin/env bash |
|
||||
set -eo pipefail |
|
||||
source ./build/build.sh |
|
||||
check "./zsh/zshrc.symlink" |
|
||||
``` |
|
||||
|
|
||||
```yml |
|
||||
language: bash |
|
||||
install: |
|
||||
- ./build/install.sh |
|
||||
script: |
|
||||
- ./build.sh |
|
||||
notifications: |
|
||||
email: false |
|
||||
``` |
|
||||
|
|
||||
This will make travis ran the `build.sh` from this project first, |
|
||||
then, lint your custom files. |
|
||||
|
|
||||
You can also override the `find_cmd` function, which returns a string |
|
||||
containing the `find` command to `eval`. Check the source or open an |
|
||||
issue if you have any problems. |
|
||||
|
|
||||
## Updating |
|
||||
|
|
||||
Update your projects is easy. Just run this: |
|
||||
|
|
||||
```sh |
|
||||
git submodule update --remote --merge && \ |
|
||||
git commit -am 'updated shell-ci-build version' && \ |
|
||||
git push |
|
||||
``` |
|
@ -1,45 +0,0 @@ |
|||||
#!/usr/bin/env bash |
|
||||
set -eo pipefail |
|
||||
[[ "${DEBUG:-}" ]] && set -x |
|
||||
|
|
||||
success() { |
|
||||
printf "\r\033[2K [ \033[00;32mOK\033[0m ] Linting %s...\n" "$1" |
|
||||
} |
|
||||
|
|
||||
fail() { |
|
||||
printf "\r\033[2K [\033[0;31mFAIL\033[0m] Linting %s...\n" "$1" |
|
||||
exit 1 |
|
||||
} |
|
||||
|
|
||||
check() { |
|
||||
local script="$1" |
|
||||
shellcheck "$script" || fail "$script" |
|
||||
success "$script" |
|
||||
} |
|
||||
|
|
||||
find_prunes() { |
|
||||
local prunes="! -path './.git/*'" |
|
||||
if [ -f .gitmodules ]; then |
|
||||
while read module; do |
|
||||
prunes="$prunes ! -path './$module/*'" |
|
||||
done < <(grep path .gitmodules | awk '{print $3}') |
|
||||
fi |
|
||||
echo "$prunes" |
|
||||
} |
|
||||
|
|
||||
find_cmd() { |
|
||||
echo "find . -type f -and \( -perm +111 -or -name '*.sh' \) $(find_prunes)" |
|
||||
} |
|
||||
|
|
||||
check_all_executables() { |
|
||||
echo "Linting all executables and .sh files, ignoring files inside git modules..." |
|
||||
eval "$(find_cmd)" | while read script; do |
|
||||
head=$(head -n1 "$script") |
|
||||
[[ "$head" =~ .*ruby.* ]] && continue |
|
||||
[[ "$head" =~ .*zsh.* ]] && continue |
|
||||
[[ "$head" =~ ^#compdef.* ]] && continue |
|
||||
check "$script" |
|
||||
done |
|
||||
} |
|
||||
|
|
||||
check_all_executables |
|
@ -1,10 +0,0 @@ |
|||||
#!/bin/bash |
|
||||
set -eo pipefail |
|
||||
|
|
||||
main() { |
|
||||
local filename="shellcheck_0.3.7-1_amd64.deb" |
|
||||
wget "http://ftp.debian.org/debian/pool/main/s/shellcheck/$filename" |
|
||||
sudo dpkg -i "$filename" |
|
||||
} |
|
||||
|
|
||||
main |
|
@ -1,8 +0,0 @@ |
|||||
language: ruby |
|
||||
install: |
|
||||
- ./build/install.sh |
|
||||
script: |
|
||||
- ./build/build.sh |
|
||||
notifications: |
|
||||
email: false |
|
||||
sudo: required |
|
@ -1,2 +0,0 @@ |
|||||
#!/bin/bash |
|
||||
echo "hi" |
|
@ -1,2 +0,0 @@ |
|||||
#!/bin/ksh |
|
||||
echo "hi" |
|
@ -1,2 +0,0 @@ |
|||||
#!/bin/sh |
|
||||
echo "hi" |
|
@ -1,2 +0,0 @@ |
|||||
#!/bin/zsh |
|
||||
echo "hi" |
|
@ -1,8 +0,0 @@ |
|||||
language: bash |
|
||||
install: |
|
||||
- ./build/install.sh |
|
||||
script: |
|
||||
- ./build/build.sh |
|
||||
notifications: |
|
||||
email: false |
|
||||
sudo: required |
|
Loading…
Reference in new issue