Skip to content

Commit

Permalink
Add lint to the project
Browse files Browse the repository at this point in the history
  • Loading branch information
deniscostadsc committed Sep 27, 2023
1 parent 13d7552 commit 849ed27
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 1 deletion.
8 changes: 8 additions & 0 deletions .docker/lint-sh.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM alpine:latest

RUN apk -U upgrade && apk add shellcheck bash

RUN mkdir /code
WORKDIR /code

CMD ./scripts/lint-sh.sh
33 changes: 33 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CI

on: [push]

jobs:
build:

runs-on: ubuntu-latest

steps:
- name: Clear up some space on runner
run: |
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n | tail -n 100
df -h
sudo apt-get remove -y '^dotnet-.*'
sudo apt-get remove -y '^libclang.*'
sudo apt-get remove -y '^llvm-.*'
sudo apt-get remove -y '^mongodb-.*'
sudo apt-get remove -y '^mysql-.*'
sudo apt-get remove -y '^postgresql-.*'
sudo apt-get remove -y 'php.*'
sudo apt-get remove -y azure-cli google-cloud-sdk google-chrome-stable firefox powershell mono-devel
sudo apt-get autoremove -y
sudo apt-get clean
rm -rf /usr/share/dotnet/
df -h
- name: Checkout code
uses: actions/checkout@v2

- name: run lint
run: |
make lint
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: run
.PHONY: lint run

run:
ansible-playbook \
Expand All @@ -7,3 +7,7 @@ run:
--extra-vars "current_user=$$USER home_folder=$$HOME" \
-vv \
provisioning.yml -i hosts

lint:
docker build -q -f .docker/lint-sh.Dockerfile -t lint-sh .
docker run -v $$(pwd):/code lint-sh
13 changes: 13 additions & 0 deletions scripts/lint-sh.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

set -euo pipefail

SH_SCRIPTS="$(find . -name '*.sh' -o -name '.bashrc' -o -name '.bash_profile')"
EXIT_STATUS=0

for script in ${SH_SCRIPTS}; do
shellcheck "${script}" && continue
EXIT_STATUS=1
done

exit "${EXIT_STATUS}"

0 comments on commit 849ed27

Please sign in to comment.