From 445c47c8731470c19e92bfbe17cb85be19148760 Mon Sep 17 00:00:00 2001 From: Alexis Montoison Date: Tue, 27 Aug 2024 20:15:22 -0400 Subject: [PATCH] Add a CI script sif_batabase.yml --- .github/workflows/sif_database.yml | 58 ++++++++++++++++++++++++++++++ .github/workflows/sifdecoder.yml | 17 +++------ 2 files changed, 63 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/sif_database.yml diff --git a/.github/workflows/sif_database.yml b/.github/workflows/sif_database.yml new file mode 100644 index 0000000..a5dc556 --- /dev/null +++ b/.github/workflows/sif_database.yml @@ -0,0 +1,58 @@ +name: CLASS.DB +on: + push: + branches: + - master + pull_request: + types: [opened, synchronize, reopened] +jobs: + build: + name: Verify SIF Files and CLASSF.DB Consistency + runs-on: ubuntu-latest + steps: + - name: Checkout SIFDecode + uses: actions/checkout@v4 + + - name: Download the CUTEst NLP test set + shell: bash + run: | + cd $GITHUB_WORKSPACE/../ + git clone https://bitbucket.org/optrove/sif + + - name: Check entries in CLASSF.DB and SIF files + shell: bash + run: | + cd $GITHUB_WORKSPACE/../sif + + # Read the CLASSF.DB file and store the problem names in an array + mapfile -t db_problems < <(awk '{print $1}' CLASSF.DB) + + # Initialize counters for missing files and missing DB entries + missing_sif_count=0 + missing_db_count=0 + + # Check if each SIF file has an entry in CLASSF.DB + for file in *.SIF; do + problem_name="${file%.SIF}" + if [[ " ${db_problems[*]} " != *" ${problem_name} "* ]]; then + echo "${problem_name} is ABSENT from CLASSF.DB" + ((missing_db_count++)) + fi + done + + # Check if each entry in CLASSF.DB has a corresponding SIF file + for problem in "${db_problems[@]}"; do + if [[ ! -f "${problem}.SIF" ]]; then + echo "SIF file for ${problem} is MISSING" + ((missing_sif_count++)) + fi + done + + echo "Total number of SIF files without DB entries: ${missing_db_count}" + echo "Total number of DB entries without SIF files: ${missing_sif_count}" + + # Exit with error if any issues were found + if [ "${missing_db_count}" -ne 0 ] || [ "${missing_sif_count}" -ne 0 ]; then + echo "Error: Mismatch between CLASSF.DB entries and SIF files" + exit 1 + fi diff --git a/.github/workflows/sifdecoder.yml b/.github/workflows/sifdecoder.yml index afcf395..c06862f 100644 --- a/.github/workflows/sifdecoder.yml +++ b/.github/workflows/sifdecoder.yml @@ -44,22 +44,15 @@ jobs: run: | cd $GITHUB_WORKSPACE/../ if [[ "${{ matrix.problems }}" == "sifcollection" ]]; then - # https://bitbucket.org/optrove/sif/downloads/?tab=branches - wget https://bitbucket.org/optrove/sif/get/c71425cc7f54ddda53ab57c11290a1cbf53aaf17.tar.gz - tar -xvzf c71425cc7f54ddda53ab57c11290a1cbf53aaf17.tar.gz - mv optrove-sif-c71425cc7f54 sif + git clone https://bitbucket.org/optrove/sif fi if [[ "${{ matrix.problems }}" == "maros-meszaros" ]]; then - # https://bitbucket.org/optrove/maros-meszaros/downloads/?tab=branches - wget https://bitbucket.org/optrove/maros-meszaros/get/9adfb5707b1e0b83a2e0a26cc8310704ff01b7c1.tar.gz - tar -xvzf 9adfb5707b1e0b83a2e0a26cc8310704ff01b7c1.tar.gz - mv optrove-maros-meszaros-9adfb5707b1e sif + git clone https://bitbucket.org/optrove/maros-meszaros + mv maros-meszaros sif fi if [[ "${{ matrix.problems }}" == "netlib-lp" ]]; then - # https://bitbucket.org/optrove/netlib-lp/downloads/?tab=branches - wget https://bitbucket.org/optrove/netlib-lp/get/f83996fca9370b23d8896f134c4dfe7adbaca0ec.tar.gz - tar -xvzf f83996fca9370b23d8896f134c4dfe7adbaca0ec.tar.gz - mv optrove-netlib-lp-f83996fca937 sif + git clone https://bitbucket.org/optrove/netlib-lp + mv netlib-lp sif fi - name: SIFDecode