From e1f63e3874a2241c6cfbae5f1efe621b960b3d89 Mon Sep 17 00:00:00 2001 From: Danila Danko Date: Fri, 9 Feb 2024 14:42:24 +0300 Subject: [PATCH] refactor: pipeline script --- pipeline.sh | 134 ++++++++++++++-------------------------------------- 1 file changed, 36 insertions(+), 98 deletions(-) diff --git a/pipeline.sh b/pipeline.sh index f1ad7e70b..57579c7b6 100755 --- a/pipeline.sh +++ b/pipeline.sh @@ -1,117 +1,55 @@ set -euo pipefail +if ! [ -d node_modules ]; then npm i; fi + shopt -s expand_aliases EO="0.34.1" alias eo="npx eoc --parser=${EO}" -# generate EO test files +printf "\nGenerate EO test files\n\n" + stack run transform-eo-tests -# convert EO to PHI +printf "\nConvert EO to PHI\n\n" + +mkdir -p phi cd pipeline/eo eo clean eo phi +cp .eoc/phi/*.phi ../phi cd .. -mkdir -p phi -cp eo/.eoc/phi/*.phi phi +printf "\nNormalize PHI\n\n" +mkdir -p phi-normalized cd phi -# TODO #100:15min run normalizer -# normalizer should create phi-normalized +for f in $(ls); do + stack run -- \ + -s \ + --rules-yaml \ + ../../eo-phi-normalizer/test/eo/phi/rules/yegor.yaml \ + "$f" \ + > "../phi-normalized/$f" +done cd .. -# TODO #100:15min run unphi -# cd phi-normalized -# eo unphi -# cd .. -# mkdir -p eo-normalized -# copy normalized files to eo-normalized - -# TODO #100:15min run tests -# cd eo-normalized -# eo test - - - -# TODO #100:15min remove old code -# eo phi - -# IO=".eoc/phi/app.phi" -# I=".eoc/phi/app.bk.phi" -# mv "$IO" "$I" - -# stack run normalize-phi < "$I" > "$IO" \ -# || { -# cat < after.txt - -# # Check dataization with and without the normalizer -# # produces the same results +cd phi-normalized +cp -r ../eo/.eoc . +eo unphi +cp .eoc/unphi/*.xmir ".eoc/2-optimize" +cd .. -# if [ "$(cat before.txt)" == "$(cat after.txt)" ]; then -# echo 'SUCCESS' -# else -# echo 'FAILURE' -# exit 1 -# fi +printf "\nTest EO\n\n" + +mkdir -p eo-normalized +cd eo-normalized +cp ../phi-normalized/.eoc/print/*.eo . +for f in $(ls *.eo); do + if ! [ -s "${f}" ]; then + rm $f + fi +done +eo test +cd ..