Merge pull request #2 from jasminabrar/main #9
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: Run Layout Verification | |
on: | |
workflow_dispatch: | |
push: | |
paths: | |
- 'submissions/**.gds' | |
- 'submissions/**.oas' | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
verification: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout repo content | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
# can also specify python version if needed | |
- name: setup python | |
uses: actions/setup-python@v4 | |
- name: install python packages | |
run: | | |
python -m pip install --upgrade pip | |
pip install klayout SiEPIC siepic_ebeam_pdk | |
python -m pip install --upgrade SiEPIC | |
- name: get .gds and .oas files, run example layout verification | |
id: run-script | |
run: | | |
#locate the changed / added .gds and .oas files in the submission folder | |
export FILES=$(git diff --name-status --diff-filter=ACM --relative=submissions ${{ github.event.before }} ${{ github.sha }} submissions | grep -E '\.(gds|oas)$' | awk '{print $2}') | |
# print the names of the files | |
echo "Files for verification: $FILES" | |
files_with_errors="" | |
IFS=$'\n' | |
# run verification on all files | |
for file in $FILES; do | |
echo "Running verification on $file" | |
output=$(python run_verification.py "submissions/$file") | |
# get number of errors | |
errors_from_output=$(echo "$output" | tail -n 1) | |
echo "$errors_from_output errors detected for $file" | |
# if file results in verification errors add to string files_with_errors | |
if [[ "$errors_from_output" -ge 1 ]]; then | |
files_with_errors+="$file, $errors_from_output errors. " | |
fi | |
echo "Done verification on $file" | |
done | |
echo "files_with_errors=$files_with_errors" >> $GITHUB_ENV | |
- name: move output files to new folder | |
run: | | |
export OUTPUT_FILES=$(find /home/runner/work/openEBL-2024-02/openEBL-2024-02/submissions -name "*.lyrdb") | |
echo "Output files: $OUTPUT_FILES" | |
mkdir -p verification_output | |
for file in $OUTPUT_FILES; do | |
cp "$file" verification_output/ | |
done | |
- name: upload artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: layout-errors | |
path: verification_output/ | |
- name: fail if there are errors from layout verification | |
run: | | |
if [ -z "$files_with_errors" ]; then | |
echo "No errors detected." | |
else | |
echo "Errors detected: $files_with_errors" | |
exit 1 | |
fi | |