workaround for inf loop issue with garbo #99
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
# This is a workflow to perform basic verification for KoLmafia ASH scripts | |
name: CI | |
env: | |
SCRIPT_NAMES: "blackpudding.ash dpills.ash getmu.ash greygoo.ash guzzlr.ash plevel.ash aftercore.ash tt_display.ash tt_fortune.ash tt_kingliberated.ash tt_login.ash tt_logout.ash tt_preascension.ash tt_quickconfig.ash" | |
on: [push, pull_request] | |
jobs: | |
verify: | |
name: Verify | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Java 17 | |
uses: actions/setup-java@v2 | |
with: | |
distribution: "temurin" | |
java-version: "17" | |
- name: Determine KoLmafia version | |
id: mafia | |
run: | | |
set -o pipefail | |
export GITHUB_RELEASE=$(curl --fail --silent --globoff 'https://api.github.com/repos/kolmafia/kolmafia/releases/latest') | |
if [[ -z "$GITHUB_RELEASE" ]]; then | |
echo "Could not get KoLmafia latst release from GitHub!" | |
exit 1 | |
fi | |
export GITHUB_BUILD=$(echo $GITHUB_RELEASE | jq --raw-output '.name') | |
export GITHUB_URL=$(echo $GITHUB_RELEASE | jq --raw-output '.assets[] | select(.browser_download_url | contains(".jar")).browser_download_url') | |
echo "::set-output name=github::$GITHUB_URL" | |
echo "GitHub URL = ${GITHUB_URL}" | |
echo "::set-output name=build::$GITHUB_BUILD" | |
echo "GitHub Mafia Build = ${GITHUB_BUILD}" | |
- name: Cache KoLmafia | |
id: cache | |
uses: actions/cache@v2 | |
with: | |
path: .github/kolmafia.jar | |
key: kolmafia-${{steps.mafia.outputs.build}} | |
- name: Download KoLmafia | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
curl -L "${{steps.mafia.outputs.github}}" --output .github/kolmafia.jar | |
- name: Install and verify | |
run: | | |
cd RELEASE | |
if [[ -f "dependencies.txt" ]]; then | |
# Install dependencies | |
echo "Installing dependencies..." | |
output_file="scripts/_ci_dependencies.ash" | |
while read -r line || [ -n "$line" ]; do | |
echo "cli_execute('svn checkout ${line}');" >> "$output_file" | |
done < "dependencies.txt" | |
echo "cli_execute('exit');" >> "$output_file" | |
java -DuseCWDasROOT=true -jar ../.github/kolmafia.jar --CLI _ci_dependencies | |
fi | |
errors=0 | |
for ashfile in ${SCRIPT_NAMES}; do | |
# Run the verification | |
echo "Verifying ${ashfile}..." | |
echo "try { cli_execute('verify ${ashfile}'); } finally { cli_execute('exit'); }" > scripts/_ci_verify.ash | |
output=$(java -DuseCWDasROOT=true -jar ../.github/kolmafia.jar --CLI _ci_verify) | |
if [[ $output == *"Script verification complete." ]]; then | |
echo "Verified ${ashfile}!" | |
else | |
echo $output | |
errors=$((errors+1)) | |
fi | |
done | |
exit ${errors} |