Skip to content

Commit

Permalink
Merge pull request #541 from metafates/master
Browse files Browse the repository at this point in the history
Fix shell scripts, add shellcheck workflow
  • Loading branch information
yegor256 authored Feb 12, 2024
2 parents 8c603ed + 5669c01 commit 790c6ef
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 9 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/shellcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: shellcheck
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
shellcheck:
name: shellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
2 changes: 1 addition & 1 deletion deploy.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
set -e

cd $(dirname $0)
cd "$(dirname "$0")"
cp /code/cqfn-secrets/jpeek-settings-heroku.xml settings.xml
git add settings.xml
git commit -m 'settings.xml for dokku'
Expand Down
4 changes: 2 additions & 2 deletions ping-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
set -e

while IFS= read -r a; do
curl -s https://i.jpeek.org/${a}/index.html > /dev/null
curl -s "https://i.jpeek.org/${a}/index.html" > /dev/null
echo "${a} pinged"
done < artifacts.csv
done < artifacts.csv
8 changes: 4 additions & 4 deletions research/2018-April/04-collect-metrics/process-artifact.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ jar=$1
output=$3
path=${2//.//}
meta=$(curl --fail --silent "https://repo1.maven.org/maven2/${path}/maven-metadata.xml")
version=$(echo ${meta} | xmllint --xpath '/metadata/versioning/latest/text()' -)
group=$(echo ${meta} | xmllint --xpath '/metadata/groupId/text()' -)
artifact=$(echo ${meta} | xmllint --xpath '/metadata/artifactId/text()' -)
version=$(echo "${meta}" | xmllint --xpath '/metadata/versioning/latest/text()' -)
artifact=$(echo "${meta}" | xmllint --xpath '/metadata/artifactId/text()' -)

home=$(pwd)
dir=$(mktemp -d /tmp/jpeek-XXXX)
# shellcheck disable=SC2064
trap "rm -rf ${dir}" EXIT
curl --fail --silent "https://repo1.maven.org/maven2/${path}/${version}/${artifact}-${version}.jar" > "${dir}/${artifact}.jar"
cd "${dir}"
Expand All @@ -46,4 +46,4 @@ unzip -o -q -d "${artifact}" "${artifact}.jar"
java -jar "${jar}" --sources "${artifact}" --target ./target --quiet
ruby "${home}/collect.rb" target >> "${output}"
cd
rm -rf ${dir}
rm -rf "${dir}"
4 changes: 2 additions & 2 deletions research/2018-April/04-collect-metrics/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ home=$(pwd)
jar=~/.m2/repository/org/jpeek/jpeek/1.0-SNAPSHOT/jpeek-1.0-SNAPSHOT-jar-with-dependencies.jar
if [ ! -e "${jar}" ]; then
echo "${jar} doesn't exist, please run 'mvn clean install' first"
exit -1
exit 1
fi

rm -f "${home}/metrics.txt"

while read line
while read -r line
do
IFS=',' read -ra parts <<< "${line}"
echo "${parts[0]}..."
Expand Down

0 comments on commit 790c6ef

Please sign in to comment.