Lint fixes #713
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Workflows Lint Check | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
import_syntax_check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Check import syntax | |
run: | | |
EXITCODE=0 | |
shopt -s extglob | |
for file in $(find ./!(template) -name '*.wdl'); do | |
>&2 echo "Checking file $file..." | |
import_lines=$(awk '/import/' "$file" | grep -v '# lint-check: ignore') || true | |
bad_lines=$(echo "$import_lines" | awk '/https:\/\/raw.githubusercontent.com\/stjudecloud\/workflows/') || true | |
if [ -n "$bad_lines" ]; then | |
>&2 echo "Imports from this repo must use relative paths!" | |
>&2 echo "The following lines are bad:" | |
>&2 echo "$bad_lines" | |
>&2 echo "" | |
EXITCODE=1 | |
fi | |
bad_lines=$(echo "$import_lines" | awk '/http/ && (/main/ || /master/)') || true | |
if [ -n "$bad_lines" ]; then | |
>&2 echo "Imports from external repos must use a tagged release!" | |
>&2 echo "The following lines are bad:" | |
>&2 echo "$bad_lines" | |
>&2 echo "" | |
EXITCODE=1 | |
fi | |
done | |
exit $EXITCODE | |
docker_pull_check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Ensure current SemVer'd docker images are being pulled | |
run: | | |
EXITCODE=0 | |
files=$(find docker/ -name Dockerfile) | |
for file in $files; do | |
echo "$file" | awk -F '/' '{print tolower($2) ":" $3}' >> valid_dockerimages.txt | |
done | |
files=$(find . -name '*.wdl') | |
for file in $files; do | |
while IFS= read -r line; do | |
tag=$(echo "$line" | awk -F ':' '{print substr($3, 1, length($3)-1)}') | |
tool=$(echo "$line" | awk -F ':' '{print substr($2, 23, length($2)) ":" substr($3, 1, length($3)-1)}') | |
case `grep -Fx "$tool" valid_dockerimages.txt >/dev/null; echo $?` in | |
0) | |
# valid docker image | |
;; | |
1) | |
>&2 echo "Must use a current Docker image" | |
>&2 echo "Offending line: $line" | |
>&2 echo "In file: $file" | |
EXITCODE=1 | |
;; | |
*) | |
>&2 echo "Something went wrong while checking for current Docker images!" | |
EXITCODE=2 | |
;; | |
esac | |
done < <(awk '/docker: .*stjudecloud/' < "$file") | |
done | |
exit $EXITCODE |