From fdd5717dcc54b06d02e311117b24b51726ee2570 Mon Sep 17 00:00:00 2001 From: vincepick Date: Tue, 12 Nov 2024 22:43:07 +0000 Subject: [PATCH 001/100] feat: added a new test script to scan output of AutoIG runs for key lines --- scripts/testScript/check.sh | 54 ++++++++++++++++++++++++++++++++ scripts/testScript/testreadme.md | 21 +++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 scripts/testScript/check.sh create mode 100644 scripts/testScript/testreadme.md diff --git a/scripts/testScript/check.sh b/scripts/testScript/check.sh new file mode 100644 index 00000000..872953d9 --- /dev/null +++ b/scripts/testScript/check.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +# Runs all scripts put in ./tests and makes sure that the run at some point contains a provided line: + +# Lines being checked for +lines=( + "# Best configurations (first number is the configuration ID; listed from best to worst according to the sum of ranks):" + "# Best configurations as commandlines (first number is the configuration ID; same order as above):" +) + +testsPassed=0 +testsRun=0 + +start=$(date +%s) + +# Loop through each script in the tests directory +for file in tests/*; do + ((testsRun++)) + # Check if file + if [[ -f "$file" ]]; then + + # Run contents of file + output=$(bash "$file") + all_lines_found=true + + # Check for each line in the array + for line in "${lines[@]}"; do + if [[ "$output" != *"$line"* ]]; then + all_lines_found=false + echo "Test $testsRun: $file failed, line not found: $line" + fi + done + + # If all lines are found, count as passed + if $all_lines_found; then + echo "Test $testsRun: $file passed, all lines found in output" + ((testsPassed++)) + fi + fi +done + +# Final results +if [[ "$testsRun" -eq "$testsPassed" ]]; then + printf "\e[32mAll tests passed: %d/%d! :D\e[0m\n" "$testsPassed" "$testsRun" +else + printf "\e[31mSome cases failing, only %d/%d passed.\e[0m\n" "$testsPassed" "$testsRun" +fi + +# Record end time and calculate elapsed time +end=$(date +%s) +elapsedTime=$((end - start)) + +# Display time elapsed +echo "Time elapsed: $elapsedTime seconds" diff --git a/scripts/testScript/testreadme.md b/scripts/testScript/testreadme.md new file mode 100644 index 00000000..78e92f14 --- /dev/null +++ b/scripts/testScript/testreadme.md @@ -0,0 +1,21 @@ +# Description + +This is a directory which contains scripts to test various AutoIG runs using regex to test output + +To run this, put the commands to navigate to the AutoIG experiment directory, setup the project, and run it. + +The script will automatically scan the standard output, then output weather the output of each file contained the desired lines specified within the script. The lines need to exist independently in the output, not be sequential. + +After all tests are run, the script also outputs the number of passed tests / the number of failed tests, as well as time taken to run all of them. + +An example contents of a test may look like: + +## Within tests/macc-graded: + +`cd "AutoIG/experiments/macc-graded"` + +`python3 "\$AUTOIG/scripts/setup.py --generatorModel \$AUTOIG/data/models/macc/generator-small.essence --problemModel \$AUTOIG/data/models/macc/problem.mzn --instanceSetting graded --minSolverTime 0 --maxSolverTime 5 --solver chuffed --solverFlags=\"-f\" --maxEvaluations 180 --genSolverTimeLimit 5"` + +`bash "run.sh"` + +`cd "../.."` From 07c4208845e57176e33cc15a96e26c87eafb1d61 Mon Sep 17 00:00:00 2001 From: vincepick Date: Wed, 13 Nov 2024 00:14:09 +0000 Subject: [PATCH 002/100] feat: added functional test script for macc-graded --- scripts/testScript/tests/maccGraded | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 scripts/testScript/tests/maccGraded diff --git a/scripts/testScript/tests/maccGraded b/scripts/testScript/tests/maccGraded new file mode 100644 index 00000000..d30e00ea --- /dev/null +++ b/scripts/testScript/tests/maccGraded @@ -0,0 +1,6 @@ +#!/bin/bash + +cd "$AUTOIG/experiments/macc-graded" +python3 "$AUTOIG/scripts/setup.py" --generatorModel "$AUTOIG/data/models/macc/generator-small.essence" --problemModel "$AUTOIG/data/models/macc/problem.mzn" --instanceSetting graded --minSolverTime 0 --maxSolverTime 5 --solver chuffed --solverFlags="-f" --maxEvaluations 180 --genSolverTimeLimit 3 + +bash "$AUTOIG/experiments/macc-graded/run.sh" From 2014aa66330e5e3495aabf96054af40faf3b1034 Mon Sep 17 00:00:00 2001 From: Vincent Pickering <124732907+vincepick@users.noreply.github.com> Date: Sun, 17 Nov 2024 01:27:39 +0000 Subject: [PATCH 003/100] Create main.yml Starting to create a GitHub action to set up a CI workflow for automatically checking that previous functionalities are not broken by new PRs. --- .github/workflows/main.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..c250d4a2 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,14 @@ +name: Bash Script +on: + workflow_dispatch: + +jobs: + bash-script: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Run Bash script + run: bash scripts/testScript/check.sh From ec85b317fe50d40873db78494e602232bbd8e6dc Mon Sep 17 00:00:00 2001 From: Vincent Pickering <124732907+vincepick@users.noreply.github.com> Date: Sun, 17 Nov 2024 01:42:59 +0000 Subject: [PATCH 004/100] fix: updated check.sh with exit scores for use by github actions --- scripts/testScript/check.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/testScript/check.sh b/scripts/testScript/check.sh index 872953d9..5faeef1d 100644 --- a/scripts/testScript/check.sh +++ b/scripts/testScript/check.sh @@ -42,8 +42,10 @@ done # Final results if [[ "$testsRun" -eq "$testsPassed" ]]; then printf "\e[32mAll tests passed: %d/%d! :D\e[0m\n" "$testsPassed" "$testsRun" + exit 0 else printf "\e[31mSome cases failing, only %d/%d passed.\e[0m\n" "$testsPassed" "$testsRun" + exit 1 fi # Record end time and calculate elapsed time From 148c51e1d52295eb43fc3340e3796e478df7dd0c Mon Sep 17 00:00:00 2001 From: Vincent Pickering <124732907+vincepick@users.noreply.github.com> Date: Sun, 17 Nov 2024 01:44:10 +0000 Subject: [PATCH 005/100] feat: updated main.yml to call check.sh --- .github/workflows/main.yml | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c250d4a2..b7c053b9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,14 +1,35 @@ -name: Bash Script +name: Pull Request Run Test + +# Made partially using guide: https://www.youtube.com/watch?v=dHuksXTLA2k + on: - workflow_dispatch: + pull_request: + types: [opened, synchronize, reopened] jobs: - bash-script: + validate: runs-on: ubuntu-latest steps: + # Checkout the codebase - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v2 # should this be v3? + + # Run check script + - name: Run validation script + run: | + + bash scripts/testScript/check.sh + + # Reject or allow based on exit status + - name: Set PR Status + if: failure() + run: | + echo "Check.sh failed. Rejecting PR." + exit 1 - - name: Run Bash script - run: bash scripts/testScript/check.sh + - name: Allow PR + if: success() + run: | + echo "Check.sh passed. Allowing PR." + exit 0 From c3016cc5e4288a17eeb8e3f3fa393e18e1ae2e7c Mon Sep 17 00:00:00 2001 From: Vincent Pickering <124732907+vincepick@users.noreply.github.com> Date: Sun, 17 Nov 2024 23:53:46 +0000 Subject: [PATCH 006/100] Create testPush.yml --- .github/workflows/testPush.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/testPush.yml diff --git a/.github/workflows/testPush.yml b/.github/workflows/testPush.yml new file mode 100644 index 00000000..c6101b66 --- /dev/null +++ b/.github/workflows/testPush.yml @@ -0,0 +1,21 @@ +name: test seeing push requests + +on: + push: + branches: + - test/maccGradedCase + +jobs: + run-script: + runs-on: ubuntu-latest + + steps: + # Check out code + - name: Check out code + uses: actions/checkout@v3 + + # Run the script + - name: Testing push request recieved + run: | + echo "Push request found" + From 708037914fde4b7f19b9ea42a3b994b763fe7624 Mon Sep 17 00:00:00 2001 From: vincepick Date: Mon, 18 Nov 2024 00:00:48 +0000 Subject: [PATCH 007/100] build: testing ability to make a PR which is picked up by github action --- .github/workflows/main.yml | 8 ++++---- .github/workflows/testPush.yml | 3 +-- scripts/testScript/test.sh | 5 +++++ 3 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 scripts/testScript/test.sh diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b7c053b9..7b0712cc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,4 +1,4 @@ -name: Pull Request Run Test +name: Pull Request Run Test # Made partially using guide: https://www.youtube.com/watch?v=dHuksXTLA2k @@ -13,13 +13,13 @@ jobs: steps: # Checkout the codebase - name: Checkout code - uses: actions/checkout@v2 # should this be v3? + uses: actions/checkout@v4 # Run check script - name: Run validation script run: | - - bash scripts/testScript/check.sh + bash scripts/testScript/test.sh + # bash scripts/testScript/check.sh # Reject or allow based on exit status - name: Set PR Status diff --git a/.github/workflows/testPush.yml b/.github/workflows/testPush.yml index c6101b66..10493086 100644 --- a/.github/workflows/testPush.yml +++ b/.github/workflows/testPush.yml @@ -12,10 +12,9 @@ jobs: steps: # Check out code - name: Check out code - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Run the script - name: Testing push request recieved run: | echo "Push request found" - diff --git a/scripts/testScript/test.sh b/scripts/testScript/test.sh new file mode 100644 index 00000000..5bb013c6 --- /dev/null +++ b/scripts/testScript/test.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +echo "reached the test.sh script" + +exit 0 # exit successful From 610841d8a45548802c256a2fd91f21a0c5d0d90c Mon Sep 17 00:00:00 2001 From: vincepick Date: Mon, 18 Nov 2024 00:13:05 +0000 Subject: [PATCH 008/100] fix: updated branch to not run GitHub action on every PR, instead only those in test/maccGradedCase for now --- .github/workflows/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7b0712cc..869c8fb7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -5,6 +5,8 @@ name: Pull Request Run Test on: pull_request: types: [opened, synchronize, reopened] + branches: + - test/maccGradedCase jobs: validate: From 58f628a0f67cae8d51b22f7e021bb7873808880e Mon Sep 17 00:00:00 2001 From: Vincent Pickering <124732907+vincepick@users.noreply.github.com> Date: Mon, 18 Nov 2024 23:12:33 +0000 Subject: [PATCH 009/100] build: trying to use docker volume within GitHub workflow --- .github/workflows/main.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 869c8fb7..1526af65 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -9,14 +9,27 @@ on: - test/maccGradedCase jobs: - validate: + docker: runs-on: ubuntu-latest + container: + image: node:18 + env: + NODE_ENV: development + ports: + - 80 + volumes: + - my_docker_volume:/vo steps: # Checkout the codebase - name: Checkout code uses: actions/checkout@v4 + # Pull the Docker image from DockerHub + - name: Pull Docker Image + run: | + docker pull vincepick/autoigtemp:latest + # Run check script - name: Run validation script run: | From 8da738fe3cfb8c09fe36b2c79b4b59c0038aaf8b Mon Sep 17 00:00:00 2001 From: Vincent Pickering <124732907+vincepick@users.noreply.github.com> Date: Mon, 18 Nov 2024 23:23:12 +0000 Subject: [PATCH 010/100] fix: trying to directly use desired docker container in workflow --- .github/workflows/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1526af65..620c31a7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,7 +12,7 @@ jobs: docker: runs-on: ubuntu-latest container: - image: node:18 + image: vincepick/autoigtemp:latest env: NODE_ENV: development ports: @@ -26,9 +26,9 @@ jobs: uses: actions/checkout@v4 # Pull the Docker image from DockerHub - - name: Pull Docker Image - run: | - docker pull vincepick/autoigtemp:latest + # - name: Pull Docker Image + # run: | + # docker pull vincepick/autoigtemp:latest # Run check script - name: Run validation script From 66b5ffa17dfb3b2ab64aaf7afcbd02152081a585 Mon Sep 17 00:00:00 2001 From: Vincent Pickering <124732907+vincepick@users.noreply.github.com> Date: Tue, 19 Nov 2024 14:19:29 +0000 Subject: [PATCH 011/100] build: temporary changing CI to always be wrong to check its actually working --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 620c31a7..d9e30d93 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -47,4 +47,4 @@ jobs: if: success() run: | echo "Check.sh passed. Allowing PR." - exit 0 + exit 1 From 6d6bff9cc66351ca84f6e64ce5f7ce88f8ef44a5 Mon Sep 17 00:00:00 2001 From: Vincent Pickering <124732907+vincepick@users.noreply.github.com> Date: Tue, 19 Nov 2024 14:22:15 +0000 Subject: [PATCH 012/100] fix: undoing the intentional break --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d9e30d93..620c31a7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -47,4 +47,4 @@ jobs: if: success() run: | echo "Check.sh passed. Allowing PR." - exit 1 + exit 0 From 36b629a43070ce96f4bdb8476407ef1b56052759 Mon Sep 17 00:00:00 2001 From: Vincent Pickering <124732907+vincepick@users.noreply.github.com> Date: Tue, 19 Nov 2024 14:23:12 +0000 Subject: [PATCH 013/100] build: breaking check script --- scripts/testScript/check.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/testScript/check.sh b/scripts/testScript/check.sh index 5faeef1d..2fe2b907 100644 --- a/scripts/testScript/check.sh +++ b/scripts/testScript/check.sh @@ -42,7 +42,7 @@ done # Final results if [[ "$testsRun" -eq "$testsPassed" ]]; then printf "\e[32mAll tests passed: %d/%d! :D\e[0m\n" "$testsPassed" "$testsRun" - exit 0 + exit 1 else printf "\e[31mSome cases failing, only %d/%d passed.\e[0m\n" "$testsPassed" "$testsRun" exit 1 From d4375f1c1e4dae0b588177d4da937ec15fe821b6 Mon Sep 17 00:00:00 2001 From: Vincent Pickering <124732907+vincepick@users.noreply.github.com> Date: Tue, 19 Nov 2024 14:26:01 +0000 Subject: [PATCH 014/100] fix: undoing intentional break to check.sh --- scripts/testScript/check.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/testScript/check.sh b/scripts/testScript/check.sh index 2fe2b907..ed128ae0 100644 --- a/scripts/testScript/check.sh +++ b/scripts/testScript/check.sh @@ -42,7 +42,7 @@ done # Final results if [[ "$testsRun" -eq "$testsPassed" ]]; then printf "\e[32mAll tests passed: %d/%d! :D\e[0m\n" "$testsPassed" "$testsRun" - exit 1 + exit 0 else printf "\e[31mSome cases failing, only %d/%d passed.\e[0m\n" "$testsPassed" "$testsRun" exit 1 From 885f45622612e7cadfe053809f8fbbcf7a15dfae Mon Sep 17 00:00:00 2001 From: vincepick Date: Wed, 20 Nov 2024 13:14:02 +0000 Subject: [PATCH 015/100] build: changing how docker container is used inside github actions --- .github/workflows/main.yml | 6 +- .github/workflows/pushContainer.yml | 93 +++++++++++++++++++++++++++++ .github/workflows/useContainer.yml | 12 ++++ 3 files changed, 108 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/pushContainer.yml create mode 100644 .github/workflows/useContainer.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 620c31a7..722d5e2e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,7 +17,7 @@ jobs: NODE_ENV: development ports: - 80 - volumes: + volumes: - my_docker_volume:/vo steps: @@ -33,8 +33,8 @@ jobs: # Run check script - name: Run validation script run: | - bash scripts/testScript/test.sh - # bash scripts/testScript/check.sh + # bash scripts/testScript/test.sh + bash scripts/testScript/check.sh # Reject or allow based on exit status - name: Set PR Status diff --git a/.github/workflows/pushContainer.yml b/.github/workflows/pushContainer.yml new file mode 100644 index 00000000..0a737b33 --- /dev/null +++ b/.github/workflows/pushContainer.yml @@ -0,0 +1,93 @@ +name: Pull Request Test for test/maccGradedCase + +# This is a workflow for building and publishing a dokcer container image to GHCR, is something I can work with later +# Not what is needed right now + +# Taken directly from https://github.com/conjure-cp/conjure/blob/main/.github/workflows/publish-ghcr.yml then built off of +on: + workflow_dispatch: # can be triggered manually + workflow_run: # run only when all tests pass + branches: + - test/maccGradedCase + workflows: + - Running all tests + types: + - completed + push: # for pushes to release tags (v*) + tags: + - "v*.*.*" + pull_request: # and for PRs that edit the docker files + paths: + - Dockerfile + - .github/workflows/publish-ghcr.yml + # other branches that want testing must create a PR + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + test-and-build: + if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }} + + runs-on: ubuntu-latest + + permissions: + contents: read + packages: write + id-token: write + + steps: + # Checkout repository + - name: Checkout repository + uses: actions/checkout@v4 + + # Set up buildx + - name: Setup Docker buildx + uses: docker/setup-buildx-action@v3 + + # Log into the registry (not for PRs) + - name: Log into ghcr.io + if: github.event_name != 'pull_request' + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + # Extract metadata for Docker + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + # Build Docker image locally + - name: Build Docker image + uses: docker/build-push-action@v5 + with: + context: . + push: false # Do not push the image for PRs + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max + + # Run tests inside the Docker container + - name: Run tests + run: | + docker run --rm \ + -v ${{ github.workspace }}:/workspace \ + -w /workspace \ + ${{ steps.meta.outputs.tags[0] }} \ + bash scripts/testScript/check.sh + + # Push Docker image (only for non-PR events) + - name: Push Docker image + if: github.event_name != 'pull_request' + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/useContainer.yml b/.github/workflows/useContainer.yml new file mode 100644 index 00000000..e83be6fc --- /dev/null +++ b/.github/workflows/useContainer.yml @@ -0,0 +1,12 @@ +name: Run test using container + +on: push + +jobs: + run-tests: + name: Run container + runs-on: ubuntu-latest + container: + image: composer:latest + volumes: + - my-app From e7345d0f2d28509ef0dc7f4981896bcc776df964 Mon Sep 17 00:00:00 2001 From: vincepick Date: Wed, 20 Nov 2024 13:17:40 +0000 Subject: [PATCH 016/100] build: added updated dockerfile to this branch for use to build container in GH workflow --- dockerfile | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 dockerfile diff --git a/dockerfile b/dockerfile new file mode 100644 index 00000000..a7c5cebd --- /dev/null +++ b/dockerfile @@ -0,0 +1,57 @@ +# Use the Conjure base image +FROM --platform=linux/amd64 ghcr.io/conjure-cp/conjure:main + +# Update atp-get +RUN apt-get update + + +# Doing the default for timezone using frontend=noninteractive +RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \ + bash \ + sudo \ + wget \ + curl \ + gnupg \ + software-properties-common \ + unzip + +# Installing necessary language dependencies for Python +RUN sudo apt-get install -y python3-pip +RUN apt install python3-pandas -y +RUN apt install python3-numpy -y +RUN sudo apt install python-is-python3 + +# Installing R for iRace compatability +RUN sudo apt-get install r-base -y + +# Installing Git +RUN sudo apt-get install git-all -y + +# Set working dir to root +WORKDIR / + +# Clone into AutoIG directory +RUN git clone -b build/update-docker https://github.com/stacs-cp/AutoIG.git + + +RUN bash bin/install-savilerow.sh +RUN bash bin/install-mininzinc.sh +RUN bash bin/install-runsolver.sh + +# Still need to install iRace +RUN bash AutoIG/bin/install-irace.sh +RUN bash bin/install-ortools.sh + + +RUN bash bin/install-yuck.sh +RUN bash bin/install-picat.sh + + +# Move Conjure into AutoIG bin +RUN mv conjure AutoIG/bin + +# Set the working directory +WORKDIR /AutoIG + +RUN apt-get install -y \ + vim From 004803d3101b7a37f6e1c56ca4f87dcc43923b86 Mon Sep 17 00:00:00 2001 From: vincepick Date: Wed, 20 Nov 2024 13:38:31 +0000 Subject: [PATCH 017/100] build: updated yml file for building docker --- .github/workflows/useContainer.yml | 33 ++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/.github/workflows/useContainer.yml b/.github/workflows/useContainer.yml index e83be6fc..07b8bd2d 100644 --- a/.github/workflows/useContainer.yml +++ b/.github/workflows/useContainer.yml @@ -1,12 +1,33 @@ name: Run test using container -on: push +on: + push: + branches: + - test/maccGradedCase jobs: run-tests: - name: Run container + name: Run container and execute script runs-on: ubuntu-latest - container: - image: composer:latest - volumes: - - my-app + + steps: + # Checkout repo + - name: Checkout code + uses: actions/checkout@v4 + + # build container based on local dockerfile + - name: Build Docker image + run: | + docker build -t autoig-image:latest ${{ github.workspace }}/AutoIG + + # try to container with volume + - name: Run container and execute script + run: | + docker run --rm \ + --volume ${{ github.workspace }}/AutoIG:/AutoIG \ + autoig-image:latest \ + bash -c " + cd /AutoIG/scripts && + . bin/set-path.sh && + AUTOIG=\$(pwd) && + ./check.sh" From 080b5ec0e45aab9ab032018ac9295f75b439e560 Mon Sep 17 00:00:00 2001 From: vincepick Date: Wed, 20 Nov 2024 13:49:09 +0000 Subject: [PATCH 018/100] build: updated use of root directory in workflow --- .github/workflows/useContainer.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/useContainer.yml b/.github/workflows/useContainer.yml index 07b8bd2d..f7f840ac 100644 --- a/.github/workflows/useContainer.yml +++ b/.github/workflows/useContainer.yml @@ -18,13 +18,14 @@ jobs: # build container based on local dockerfile - name: Build Docker image run: | - docker build -t autoig-image:latest ${{ github.workspace }}/AutoIG + docker build -t autoig-image:latest ${{ github.workspace }} # try to container with volume + # binding to root directory - name: Run container and execute script run: | docker run --rm \ - --volume ${{ github.workspace }}/AutoIG:/AutoIG \ + --volume ${{ github.workspace }}:/AutoIG \ autoig-image:latest \ bash -c " cd /AutoIG/scripts && From f9e404329a609af546dd04b40be6dc916d228b21 Mon Sep 17 00:00:00 2001 From: Vincent Pickering <124732907+vincepick@users.noreply.github.com> Date: Wed, 20 Nov 2024 14:19:53 +0000 Subject: [PATCH 019/100] fix: commenting out pushcontainer github workflow --- .github/workflows/pushContainer.yml | 160 ++++++++++++++-------------- 1 file changed, 80 insertions(+), 80 deletions(-) diff --git a/.github/workflows/pushContainer.yml b/.github/workflows/pushContainer.yml index 0a737b33..79c4a055 100644 --- a/.github/workflows/pushContainer.yml +++ b/.github/workflows/pushContainer.yml @@ -1,93 +1,93 @@ -name: Pull Request Test for test/maccGradedCase +# name: Pull Request Test for test/maccGradedCase -# This is a workflow for building and publishing a dokcer container image to GHCR, is something I can work with later -# Not what is needed right now +# # This is a workflow for building and publishing a dokcer container image to GHCR, is something I can work with later +# # Not what is needed right now -# Taken directly from https://github.com/conjure-cp/conjure/blob/main/.github/workflows/publish-ghcr.yml then built off of -on: - workflow_dispatch: # can be triggered manually - workflow_run: # run only when all tests pass - branches: - - test/maccGradedCase - workflows: - - Running all tests - types: - - completed - push: # for pushes to release tags (v*) - tags: - - "v*.*.*" - pull_request: # and for PRs that edit the docker files - paths: - - Dockerfile - - .github/workflows/publish-ghcr.yml - # other branches that want testing must create a PR +# # Taken directly from https://github.com/conjure-cp/conjure/blob/main/.github/workflows/publish-ghcr.yml then built off of +# on: +# workflow_dispatch: # can be triggered manually +# workflow_run: # run only when all tests pass +# branches: +# - test/maccGradedCase +# workflows: +# - Running all tests +# types: +# - completed +# push: # for pushes to release tags (v*) +# tags: +# - "v*.*.*" +# pull_request: # and for PRs that edit the docker files +# paths: +# - Dockerfile +# - .github/workflows/publish-ghcr.yml +# # other branches that want testing must create a PR -env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} +# env: +# REGISTRY: ghcr.io +# IMAGE_NAME: ${{ github.repository }} -jobs: - test-and-build: - if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }} +# jobs: +# test-and-build: +# if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }} - runs-on: ubuntu-latest +# runs-on: ubuntu-latest - permissions: - contents: read - packages: write - id-token: write +# permissions: +# contents: read +# packages: write +# id-token: write - steps: - # Checkout repository - - name: Checkout repository - uses: actions/checkout@v4 +# steps: +# # Checkout repository +# - name: Checkout repository +# uses: actions/checkout@v4 - # Set up buildx - - name: Setup Docker buildx - uses: docker/setup-buildx-action@v3 +# # Set up buildx +# - name: Setup Docker buildx +# uses: docker/setup-buildx-action@v3 - # Log into the registry (not for PRs) - - name: Log into ghcr.io - if: github.event_name != 'pull_request' - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} +# # Log into the registry (not for PRs) +# - name: Log into ghcr.io +# if: github.event_name != 'pull_request' +# uses: docker/login-action@v3 +# with: +# registry: ${{ env.REGISTRY }} +# username: ${{ github.actor }} +# password: ${{ secrets.GITHUB_TOKEN }} - # Extract metadata for Docker - - name: Extract Docker metadata - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} +# # Extract metadata for Docker +# - name: Extract Docker metadata +# id: meta +# uses: docker/metadata-action@v5 +# with: +# images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - # Build Docker image locally - - name: Build Docker image - uses: docker/build-push-action@v5 - with: - context: . - push: false # Do not push the image for PRs - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max +# # Build Docker image locally +# - name: Build Docker image +# uses: docker/build-push-action@v5 +# with: +# context: . +# push: false # Do not push the image for PRs +# tags: ${{ steps.meta.outputs.tags }} +# labels: ${{ steps.meta.outputs.labels }} +# cache-from: type=gha +# cache-to: type=gha,mode=max - # Run tests inside the Docker container - - name: Run tests - run: | - docker run --rm \ - -v ${{ github.workspace }}:/workspace \ - -w /workspace \ - ${{ steps.meta.outputs.tags[0] }} \ - bash scripts/testScript/check.sh +# # Run tests inside the Docker container +# - name: Run tests +# run: | +# docker run --rm \ +# -v ${{ github.workspace }}:/workspace \ +# -w /workspace \ +# ${{ steps.meta.outputs.tags[0] }} \ +# bash scripts/testScript/check.sh - # Push Docker image (only for non-PR events) - - name: Push Docker image - if: github.event_name != 'pull_request' - uses: docker/build-push-action@v5 - with: - context: . - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} +# # Push Docker image (only for non-PR events) +# - name: Push Docker image +# if: github.event_name != 'pull_request' +# uses: docker/build-push-action@v5 +# with: +# context: . +# push: true +# tags: ${{ steps.meta.outputs.tags }} +# labels: ${{ steps.meta.outputs.labels }} From 3832c12a92d5e0e214976f78cfc6a098f0ce125e Mon Sep 17 00:00:00 2001 From: Vincent Pickering <124732907+vincepick@users.noreply.github.com> Date: Wed, 20 Nov 2024 14:20:30 +0000 Subject: [PATCH 020/100] fix: commenting out main.yml github workflow --- .github/workflows/main.yml | 100 ++++++++++++++++++------------------- 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 722d5e2e..ffed7a85 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,50 +1,50 @@ -name: Pull Request Run Test - -# Made partially using guide: https://www.youtube.com/watch?v=dHuksXTLA2k - -on: - pull_request: - types: [opened, synchronize, reopened] - branches: - - test/maccGradedCase - -jobs: - docker: - runs-on: ubuntu-latest - container: - image: vincepick/autoigtemp:latest - env: - NODE_ENV: development - ports: - - 80 - volumes: - - my_docker_volume:/vo - - steps: - # Checkout the codebase - - name: Checkout code - uses: actions/checkout@v4 - - # Pull the Docker image from DockerHub - # - name: Pull Docker Image - # run: | - # docker pull vincepick/autoigtemp:latest - - # Run check script - - name: Run validation script - run: | - # bash scripts/testScript/test.sh - bash scripts/testScript/check.sh - - # Reject or allow based on exit status - - name: Set PR Status - if: failure() - run: | - echo "Check.sh failed. Rejecting PR." - exit 1 - - - name: Allow PR - if: success() - run: | - echo "Check.sh passed. Allowing PR." - exit 0 +# name: Pull Request Run Test + +# # Made partially using guide: https://www.youtube.com/watch?v=dHuksXTLA2k + +# on: +# pull_request: +# types: [opened, synchronize, reopened] +# branches: +# - test/maccGradedCase + +# jobs: +# docker: +# runs-on: ubuntu-latest +# container: +# image: vincepick/autoigtemp:latest +# env: +# NODE_ENV: development +# ports: +# - 80 +# volumes: +# - my_docker_volume:/vo + +# steps: +# # Checkout the codebase +# - name: Checkout code +# uses: actions/checkout@v4 + +# # Pull the Docker image from DockerHub +# # - name: Pull Docker Image +# # run: | +# # docker pull vincepick/autoigtemp:latest + +# # Run check script +# - name: Run validation script +# run: | +# # bash scripts/testScript/test.sh +# bash scripts/testScript/check.sh + +# # Reject or allow based on exit status +# - name: Set PR Status +# if: failure() +# run: | +# echo "Check.sh failed. Rejecting PR." +# exit 1 + +# - name: Allow PR +# if: success() +# run: | +# echo "Check.sh passed. Allowing PR." +# exit 0 From faa251732019867626b8003a4c6954c1c284e38f Mon Sep 17 00:00:00 2001 From: vincepick Date: Wed, 20 Nov 2024 14:23:12 +0000 Subject: [PATCH 021/100] fix: updated testPush with more accurate job names --- .github/workflows/testPush.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/testPush.yml b/.github/workflows/testPush.yml index 10493086..1b9366ad 100644 --- a/.github/workflows/testPush.yml +++ b/.github/workflows/testPush.yml @@ -6,7 +6,7 @@ on: - test/maccGradedCase jobs: - run-script: + testing push: runs-on: ubuntu-latest steps: From 21701364b7c2e702731e6de823b66626d9c737cd Mon Sep 17 00:00:00 2001 From: vincepick Date: Wed, 20 Nov 2024 14:25:38 +0000 Subject: [PATCH 022/100] fix: fixed testing push workflow again --- .github/workflows/testPush.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/testPush.yml b/.github/workflows/testPush.yml index 1b9366ad..d55767d8 100644 --- a/.github/workflows/testPush.yml +++ b/.github/workflows/testPush.yml @@ -6,7 +6,7 @@ on: - test/maccGradedCase jobs: - testing push: + testing_push: runs-on: ubuntu-latest steps: From 3b593fb4f1eb1e927fe8892cad426d06925351f4 Mon Sep 17 00:00:00 2001 From: vincepick Date: Wed, 20 Nov 2024 15:02:04 +0000 Subject: [PATCH 023/100] build: added updated dockerfile --- dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dockerfile b/dockerfile index a7c5cebd..f3afc78c 100644 --- a/dockerfile +++ b/dockerfile @@ -33,13 +33,15 @@ WORKDIR / # Clone into AutoIG directory RUN git clone -b build/update-docker https://github.com/stacs-cp/AutoIG.git +WORKDIR /AutoIG + RUN bash bin/install-savilerow.sh RUN bash bin/install-mininzinc.sh RUN bash bin/install-runsolver.sh # Still need to install iRace -RUN bash AutoIG/bin/install-irace.sh +RUN bash bin/install-irace.sh RUN bash bin/install-ortools.sh @@ -47,8 +49,6 @@ RUN bash bin/install-yuck.sh RUN bash bin/install-picat.sh -# Move Conjure into AutoIG bin -RUN mv conjure AutoIG/bin # Set the working directory WORKDIR /AutoIG From 23ca4883a1dd3614a0e4744dae1365e4d10171b6 Mon Sep 17 00:00:00 2001 From: Vincent Pickering <124732907+vincepick@users.noreply.github.com> Date: Mon, 25 Nov 2024 01:56:59 +0000 Subject: [PATCH 024/100] build: updating yaml for using container --- .github/workflows/useContainer.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/useContainer.yml b/.github/workflows/useContainer.yml index f7f840ac..679c7841 100644 --- a/.github/workflows/useContainer.yml +++ b/.github/workflows/useContainer.yml @@ -32,3 +32,17 @@ jobs: . bin/set-path.sh && AUTOIG=\$(pwd) && ./check.sh" + + # if script fails reject PR + - name: Fail + if: ${{ failure() }} + run: | + echo "Check.sh failed, rejecting PR." + exit 1 + + # if script passes approve PR + - name: Pass + if: ${{ success() }} + run: | + echo "Check.sh passed, allowing PR." + exit 0 From 6ce72a07786bdb9d54758915210a7ebcf6ff3f78 Mon Sep 17 00:00:00 2001 From: vincepick Date: Sun, 1 Dec 2024 01:59:10 +0000 Subject: [PATCH 025/100] docs: updated tests readme --- scripts/testScript/testreadme.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/testScript/testreadme.md b/scripts/testScript/testreadme.md index 78e92f14..d4483528 100644 --- a/scripts/testScript/testreadme.md +++ b/scripts/testScript/testreadme.md @@ -2,12 +2,14 @@ This is a directory which contains scripts to test various AutoIG runs using regex to test output -To run this, put the commands to navigate to the AutoIG experiment directory, setup the project, and run it. +To run this, put the commands to navigate to the AutoIG experiment directory, setup the project, and run it. See the general README for further instructions on running. The script will automatically scan the standard output, then output weather the output of each file contained the desired lines specified within the script. The lines need to exist independently in the output, not be sequential. After all tests are run, the script also outputs the number of passed tests / the number of failed tests, as well as time taken to run all of them. +This is one of the same test script which will eventuall be integrated into the automated CI pipeline in GitHub, but is used manually for now. + An example contents of a test may look like: ## Within tests/macc-graded: From ccca4d1df51813e7759f8cf1a5b5a05482058cf6 Mon Sep 17 00:00:00 2001 From: vincepick Date: Sun, 1 Dec 2024 13:13:16 +0000 Subject: [PATCH 026/100] build: updated docker push workflow --- .github/workflows/pushContainer.yml | 152 ++++++++++++++-------------- 1 file changed, 76 insertions(+), 76 deletions(-) diff --git a/.github/workflows/pushContainer.yml b/.github/workflows/pushContainer.yml index 79c4a055..162cc801 100644 --- a/.github/workflows/pushContainer.yml +++ b/.github/workflows/pushContainer.yml @@ -4,90 +4,90 @@ # # Not what is needed right now # # Taken directly from https://github.com/conjure-cp/conjure/blob/main/.github/workflows/publish-ghcr.yml then built off of -# on: -# workflow_dispatch: # can be triggered manually -# workflow_run: # run only when all tests pass -# branches: -# - test/maccGradedCase -# workflows: -# - Running all tests -# types: -# - completed -# push: # for pushes to release tags (v*) -# tags: -# - "v*.*.*" -# pull_request: # and for PRs that edit the docker files -# paths: -# - Dockerfile -# - .github/workflows/publish-ghcr.yml -# # other branches that want testing must create a PR +on: + workflow_dispatch: # can be triggered manually + workflow_run: # run only when all tests pass + branches: + - test/maccGradedCase + workflows: + - Running all tests + types: + - completed + push: # for pushes to release tags (v*) + tags: + - "v*.*.*" + pull_request: # and for PRs that edit the docker files + paths: + - Dockerfile + - .github/workflows/publish-ghcr.yml + # other branches that want testing must create a PR -# env: -# REGISTRY: ghcr.io -# IMAGE_NAME: ${{ github.repository }} +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} -# jobs: -# test-and-build: -# if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }} +jobs: + test-and-build: + if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }} -# runs-on: ubuntu-latest + runs-on: ubuntu-latest -# permissions: -# contents: read -# packages: write -# id-token: write + permissions: + contents: read + packages: write + id-token: write -# steps: -# # Checkout repository -# - name: Checkout repository -# uses: actions/checkout@v4 + steps: + # Checkout repository + - name: Checkout repository + uses: actions/checkout@v4 -# # Set up buildx -# - name: Setup Docker buildx -# uses: docker/setup-buildx-action@v3 + # Set up buildx + - name: Setup Docker buildx + uses: docker/setup-buildx-action@v3 -# # Log into the registry (not for PRs) -# - name: Log into ghcr.io -# if: github.event_name != 'pull_request' -# uses: docker/login-action@v3 -# with: -# registry: ${{ env.REGISTRY }} -# username: ${{ github.actor }} -# password: ${{ secrets.GITHUB_TOKEN }} + # Log into the registry (not for PRs) + - name: Log into ghcr.io + if: github.event_name != 'pull_request' + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} -# # Extract metadata for Docker -# - name: Extract Docker metadata -# id: meta -# uses: docker/metadata-action@v5 -# with: -# images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + # Extract metadata for Docker + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} -# # Build Docker image locally -# - name: Build Docker image -# uses: docker/build-push-action@v5 -# with: -# context: . -# push: false # Do not push the image for PRs -# tags: ${{ steps.meta.outputs.tags }} -# labels: ${{ steps.meta.outputs.labels }} -# cache-from: type=gha -# cache-to: type=gha,mode=max + # Build Docker image locally + - name: Build Docker image + uses: docker/build-push-action@v5 + with: + context: . + push: false # Do not push the image for PRs + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max -# # Run tests inside the Docker container -# - name: Run tests -# run: | -# docker run --rm \ -# -v ${{ github.workspace }}:/workspace \ -# -w /workspace \ -# ${{ steps.meta.outputs.tags[0] }} \ -# bash scripts/testScript/check.sh + # Run tests inside the Docker container + - name: Run tests + run: | + docker run --rm \ + -v ${{ github.workspace }}:/workspace \ + -w /workspace \ + ${{ steps.meta.outputs.tags[0] }} \ + bash scripts/testScript/check.sh -# # Push Docker image (only for non-PR events) -# - name: Push Docker image -# if: github.event_name != 'pull_request' -# uses: docker/build-push-action@v5 -# with: -# context: . -# push: true -# tags: ${{ steps.meta.outputs.tags }} -# labels: ${{ steps.meta.outputs.labels }} + # Push Docker image (only for non-PR events) + - name: Push Docker image + if: github.event_name != 'pull_request' + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} From 0baffb40ad880a9928d35026d6b1d5df9a4dbe81 Mon Sep 17 00:00:00 2001 From: Vincent Pickering <124732907+vincepick@users.noreply.github.com> Date: Sun, 1 Dec 2024 13:17:29 +0000 Subject: [PATCH 027/100] Delete .github/workflows/main.yml --- .github/workflows/main.yml | 50 -------------------------------------- 1 file changed, 50 deletions(-) delete mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index ffed7a85..00000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,50 +0,0 @@ -# name: Pull Request Run Test - -# # Made partially using guide: https://www.youtube.com/watch?v=dHuksXTLA2k - -# on: -# pull_request: -# types: [opened, synchronize, reopened] -# branches: -# - test/maccGradedCase - -# jobs: -# docker: -# runs-on: ubuntu-latest -# container: -# image: vincepick/autoigtemp:latest -# env: -# NODE_ENV: development -# ports: -# - 80 -# volumes: -# - my_docker_volume:/vo - -# steps: -# # Checkout the codebase -# - name: Checkout code -# uses: actions/checkout@v4 - -# # Pull the Docker image from DockerHub -# # - name: Pull Docker Image -# # run: | -# # docker pull vincepick/autoigtemp:latest - -# # Run check script -# - name: Run validation script -# run: | -# # bash scripts/testScript/test.sh -# bash scripts/testScript/check.sh - -# # Reject or allow based on exit status -# - name: Set PR Status -# if: failure() -# run: | -# echo "Check.sh failed. Rejecting PR." -# exit 1 - -# - name: Allow PR -# if: success() -# run: | -# echo "Check.sh passed. Allowing PR." -# exit 0 From 8fe0ba6466f80044384f1ace1b6821ecdc1fa326 Mon Sep 17 00:00:00 2001 From: vincepick Date: Tue, 10 Dec 2024 17:17:15 +0000 Subject: [PATCH 028/100] build: updated the workflow for automatically adding pushContainer to package again --- .github/workflows/pushContainer.yml | 63 +++++++++++++---------------- 1 file changed, 27 insertions(+), 36 deletions(-) diff --git a/.github/workflows/pushContainer.yml b/.github/workflows/pushContainer.yml index 162cc801..15a66769 100644 --- a/.github/workflows/pushContainer.yml +++ b/.github/workflows/pushContainer.yml @@ -1,14 +1,15 @@ -# name: Pull Request Test for test/maccGradedCase +name: Publishing container on ghcr.io -# # This is a workflow for building and publishing a dokcer container image to GHCR, is something I can work with later -# # Not what is needed right now +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. -# # Taken directly from https://github.com/conjure-cp/conjure/blob/main/.github/workflows/publish-ghcr.yml then built off of on: workflow_dispatch: # can be triggered manually workflow_run: # run only when all tests pass branches: - - test/maccGradedCase + - main workflows: - Running all tests types: @@ -16,38 +17,42 @@ on: push: # for pushes to release tags (v*) tags: - "v*.*.*" - pull_request: # and for PRs that edit the docker files + pull_request: # and for PRs that edit the docker files or this workflow paths: - Dockerfile - - .github/workflows/publish-ghcr.yml + - .github/workflows/pushContainer.yml # other branches that want testing must create a PR env: REGISTRY: ghcr.io + # github.repository as / IMAGE_NAME: ${{ github.repository }} jobs: - test-and-build: - if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }} + Job: + # if this was triggered through a completed run of "Running all tests", we check if the run completed successfully + # if it was triggered through a PR, we just run it + if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }} runs-on: ubuntu-latest permissions: contents: read packages: write + # This is used to complete the identity challenge + # with sigstore/fulcio when running outside of PRs. id-token: write steps: - # Checkout repository - name: Checkout repository uses: actions/checkout@v4 - # Set up buildx + # Set up buildx (Docker CLI plugin for extended build capabilities with BuildKit) - name: Setup Docker buildx uses: docker/setup-buildx-action@v3 - # Log into the registry (not for PRs) - - name: Log into ghcr.io + # Login against a Docker registry except on PR + - name: Log into registry if: github.event_name != 'pull_request' uses: docker/login-action@v3 with: @@ -55,39 +60,25 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - # Extract metadata for Docker + # Extract metadata (tags, labels) for Docker - name: Extract Docker metadata id: meta uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - # Build Docker image locally - - name: Build Docker image + - name: Extract git version + shell: bash + run: bash etc/build/version.sh + + # Build and push Docker image with Buildx (don't push on PR) + - name: Build and push Docker image + id: build-and-push uses: docker/build-push-action@v5 with: context: . - push: false # Do not push the image for PRs + push: ${{ github.event_name != 'pull_request' }} # do not push if this was triggered by a PR tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max - - # Run tests inside the Docker container - - name: Run tests - run: | - docker run --rm \ - -v ${{ github.workspace }}:/workspace \ - -w /workspace \ - ${{ steps.meta.outputs.tags[0] }} \ - bash scripts/testScript/check.sh - - # Push Docker image (only for non-PR events) - - name: Push Docker image - if: github.event_name != 'pull_request' - uses: docker/build-push-action@v5 - with: - context: . - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} From 5f34a999b3e07c8334f6b4fb8829864fee05faf2 Mon Sep 17 00:00:00 2001 From: vincepick Date: Tue, 10 Dec 2024 18:14:30 +0000 Subject: [PATCH 029/100] build: updated useContainer for new approach to GHCR --- .github/workflows/useContainer.yml | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/.github/workflows/useContainer.yml b/.github/workflows/useContainer.yml index 679c7841..cac89417 100644 --- a/.github/workflows/useContainer.yml +++ b/.github/workflows/useContainer.yml @@ -7,42 +7,32 @@ on: jobs: run-tests: - name: Run container and execute script + name: Run AutoIG Tests runs-on: ubuntu-latest - + container: + image: ghcr.io/conjure-cp/conjure@sha256:ebff76918718631f099544eed3a808cd16ce8f2c863c8229c7d2e417ba745c56 steps: - # Checkout repo + # Checkout repo: checks out current repo (so AutoIG) - name: Checkout code uses: actions/checkout@v4 - # build container based on local dockerfile - - name: Build Docker image - run: | - docker build -t autoig-image:latest ${{ github.workspace }} - # try to container with volume # binding to root directory - name: Run container and execute script run: | - docker run --rm \ - --volume ${{ github.workspace }}:/AutoIG \ - autoig-image:latest \ - bash -c " - cd /AutoIG/scripts && - . bin/set-path.sh && - AUTOIG=\$(pwd) && - ./check.sh" + echo "Running inside docker container!" + conjure --version # if script fails reject PR - name: Fail if: ${{ failure() }} run: | - echo "Check.sh failed, rejecting PR." + echo "This usecontainer failed, rejecting PR." exit 1 # if script passes approve PR - name: Pass if: ${{ success() }} run: | - echo "Check.sh passed, allowing PR." + echo "This usecontainer passed, allowing PR." exit 0 From 257ebbc54ae74737f45e053927371962fd3d6509 Mon Sep 17 00:00:00 2001 From: vincepick Date: Tue, 10 Dec 2024 18:39:20 +0000 Subject: [PATCH 030/100] build: using older Conjure release version --- .github/workflows/useContainer.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/useContainer.yml b/.github/workflows/useContainer.yml index cac89417..62e1c781 100644 --- a/.github/workflows/useContainer.yml +++ b/.github/workflows/useContainer.yml @@ -10,7 +10,12 @@ jobs: name: Run AutoIG Tests runs-on: ubuntu-latest container: - image: ghcr.io/conjure-cp/conjure@sha256:ebff76918718631f099544eed3a808cd16ce8f2c863c8229c7d2e417ba745c56 + # using a previous version + image: ghcr.io/conjure-cp/conjure@sha256:e959c664d83a08b68a5b31409d56ce82eadf0f0b74f8af1809642b73f652c940 + + # Current version of conjure + # ghcr.io/conjure-cp/conjure@sha256:ebff76918718631f099544eed3a808cd16ce8f2c863c8229c7d2e417ba745c56 + steps: # Checkout repo: checks out current repo (so AutoIG) - name: Checkout code From af0eb746a72f6d3eadc11117f7965c800fd96650 Mon Sep 17 00:00:00 2001 From: vincepick Date: Tue, 10 Dec 2024 18:50:28 +0000 Subject: [PATCH 031/100] build: using older Conjure release version --- .github/workflows/useContainer.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/useContainer.yml b/.github/workflows/useContainer.yml index 62e1c781..a995684a 100644 --- a/.github/workflows/useContainer.yml +++ b/.github/workflows/useContainer.yml @@ -11,7 +11,10 @@ jobs: runs-on: ubuntu-latest container: # using a previous version - image: ghcr.io/conjure-cp/conjure@sha256:e959c664d83a08b68a5b31409d56ce82eadf0f0b74f8af1809642b73f652c940 + image: ghcr.io/conjure-cp/conjure:main + + #previous version + #ghcr.io/conjure-cp/conjure@sha256:e959c664d83a08b68a5b31409d56ce82eadf0f0b74f8af1809642b73f652c940 # Current version of conjure # ghcr.io/conjure-cp/conjure@sha256:ebff76918718631f099544eed3a808cd16ce8f2c863c8229c7d2e417ba745c56 From 914b95d3dd1ec8e84631ddedc9e8e2206c5a5216 Mon Sep 17 00:00:00 2001 From: vincepick Date: Tue, 10 Dec 2024 19:29:22 +0000 Subject: [PATCH 032/100] build: adding test call in AutoIG evnironment in useContainer --- .github/workflows/useContainer.yml | 45 ++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/.github/workflows/useContainer.yml b/.github/workflows/useContainer.yml index a995684a..c7e5cd27 100644 --- a/.github/workflows/useContainer.yml +++ b/.github/workflows/useContainer.yml @@ -10,7 +10,7 @@ jobs: name: Run AutoIG Tests runs-on: ubuntu-latest container: - # using a previous version + # using the main instead of the previous version for now image: ghcr.io/conjure-cp/conjure:main #previous version @@ -26,10 +26,51 @@ jobs: # try to container with volume # binding to root directory + # currently clones a specific branch - name: Run container and execute script run: | echo "Running inside docker container!" - conjure --version + + apt-get update + DEBIAN_FRONTEND=noninteractive apt-get install -y \ + bash \ + sudo \ + wget \ + curl \ + gnupg \ + software-properties-common \ + unzip + + sudo apt-get install -y python3-pip + apt install python3-pandas -y + apt install python3-numpy -y + sudo apt install python-is-python3 + + sudo apt-get install r-base -y + + sudo apt-get install git-all -y + + + git clone -b build/update-docker https://github.com/stacs-cp/AutoIG.git + + bash bin/install-savilerow.sh + bash bin/install-mininzinc.sh + bash bin/install-runsolver.sh + + bash bin/install-irace.sh + bash bin/install-ortools.sh + + bash bin/install-yuck.sh + bash bin/install-picat.sh + + cd /AutoIG + . bin/set-path.sh + + AUTOIG=$(pwd) + + cd /scripts/testScript + + bash check.sh # if script fails reject PR - name: Fail From 494eead6d4c8428a8f8d117191335e7bbb8da641 Mon Sep 17 00:00:00 2001 From: vincepick Date: Tue, 10 Dec 2024 19:39:16 +0000 Subject: [PATCH 033/100] build: adding debug statements --- .github/workflows/useContainer.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/useContainer.yml b/.github/workflows/useContainer.yml index c7e5cd27..44e5333c 100644 --- a/.github/workflows/useContainer.yml +++ b/.github/workflows/useContainer.yml @@ -63,7 +63,8 @@ jobs: bash bin/install-yuck.sh bash bin/install-picat.sh - cd /AutoIG + ls + . bin/set-path.sh AUTOIG=$(pwd) @@ -76,12 +77,12 @@ jobs: - name: Fail if: ${{ failure() }} run: | - echo "This usecontainer failed, rejecting PR." + echo "This useContainer failed, rejecting PR." exit 1 # if script passes approve PR - name: Pass if: ${{ success() }} run: | - echo "This usecontainer passed, allowing PR." + echo "This useContainer passed, allowing PR." exit 0 From e3d39a08c29bb10d60ee9df4baa36119f4c2a963 Mon Sep 17 00:00:00 2001 From: vincepick Date: Tue, 10 Dec 2024 19:46:30 +0000 Subject: [PATCH 034/100] build: testing new push --- .github/workflows/useContainer.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/useContainer.yml b/.github/workflows/useContainer.yml index 44e5333c..cd7245aa 100644 --- a/.github/workflows/useContainer.yml +++ b/.github/workflows/useContainer.yml @@ -65,10 +65,15 @@ jobs: ls + echo "Reached this point" + . bin/set-path.sh AUTOIG=$(pwd) + echo "Environment made :D, path:" + echo $PATH + cd /scripts/testScript bash check.sh From 8db48531b743fc8bbd3953c7cce8af9eed121b4d Mon Sep 17 00:00:00 2001 From: vincepick Date: Tue, 10 Dec 2024 19:54:00 +0000 Subject: [PATCH 035/100] build: added additional debug statement --- .github/workflows/useContainer.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/useContainer.yml b/.github/workflows/useContainer.yml index cd7245aa..00eb7492 100644 --- a/.github/workflows/useContainer.yml +++ b/.github/workflows/useContainer.yml @@ -30,6 +30,7 @@ jobs: - name: Run container and execute script run: | echo "Running inside docker container!" + echo $0 apt-get update DEBIAN_FRONTEND=noninteractive apt-get install -y \ From 4a8a8112934c3cb2457db89a7822bb993fe1218c Mon Sep 17 00:00:00 2001 From: vincepick Date: Tue, 10 Dec 2024 19:56:38 +0000 Subject: [PATCH 036/100] build: added additional debug statement --- .github/workflows/useContainer.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/useContainer.yml b/.github/workflows/useContainer.yml index 00eb7492..ae340615 100644 --- a/.github/workflows/useContainer.yml +++ b/.github/workflows/useContainer.yml @@ -30,7 +30,11 @@ jobs: - name: Run container and execute script run: | echo "Running inside docker container!" - echo $0 + + + echo "Script: $0" + echo "Shell: $SHELL" + ps -p $$ apt-get update DEBIAN_FRONTEND=noninteractive apt-get install -y \ From 259c30a04251db0eb6d78793b43cc23b5b05fc75 Mon Sep 17 00:00:00 2001 From: vincepick Date: Tue, 10 Dec 2024 20:05:43 +0000 Subject: [PATCH 037/100] docs: added flag for potential issue for later reference about the shell used in the GH runner --- bin/set-path.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/set-path.sh b/bin/set-path.sh index 5828ba8e..7366a967 100755 --- a/bin/set-path.sh +++ b/bin/set-path.sh @@ -1,4 +1,6 @@ # get current script's folder + +# Flagvp: this causes some issues with running AutoIG inside the GitHub VM, which uses sh but calls it from a dif script if [ -n "$ZSH_VERSION" ]; then BIN_DIR="$( cd "$( dirname "${(%):-%x}" )" &> /dev/null && pwd )" elif [ -n "$BASH_VERSION" ]; then From 008c3c746b03b19e78f09164731a0e7ffdee5bc3 Mon Sep 17 00:00:00 2001 From: vincepick Date: Tue, 10 Dec 2024 20:09:01 +0000 Subject: [PATCH 038/100] build: specified default shell as bash to be able to run AutoIG --- .github/workflows/useContainer.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/useContainer.yml b/.github/workflows/useContainer.yml index ae340615..64cedcd5 100644 --- a/.github/workflows/useContainer.yml +++ b/.github/workflows/useContainer.yml @@ -9,6 +9,9 @@ jobs: run-tests: name: Run AutoIG Tests runs-on: ubuntu-latest + defaults: + run: + shell: bash container: # using the main instead of the previous version for now image: ghcr.io/conjure-cp/conjure:main @@ -29,6 +32,7 @@ jobs: # currently clones a specific branch - name: Run container and execute script run: | + echo "Running inside docker container!" From b643e0b775106511e47f2fba0aa11abee81cd436 Mon Sep 17 00:00:00 2001 From: vincepick Date: Tue, 10 Dec 2024 20:13:14 +0000 Subject: [PATCH 039/100] build: updated branch to be cloned --- .github/workflows/useContainer.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/useContainer.yml b/.github/workflows/useContainer.yml index 64cedcd5..cf444657 100644 --- a/.github/workflows/useContainer.yml +++ b/.github/workflows/useContainer.yml @@ -60,7 +60,7 @@ jobs: sudo apt-get install git-all -y - git clone -b build/update-docker https://github.com/stacs-cp/AutoIG.git + git clone -b test/maccGradedCase https://github.com/stacs-cp/AutoIG.git bash bin/install-savilerow.sh bash bin/install-mininzinc.sh From f46659839b55c72677a2d21255acc0692c65741d Mon Sep 17 00:00:00 2001 From: vincepick Date: Tue, 10 Dec 2024 20:20:22 +0000 Subject: [PATCH 040/100] build: updated to ensure builds correctly without test --- .github/workflows/useContainer.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/useContainer.yml b/.github/workflows/useContainer.yml index cf444657..07353022 100644 --- a/.github/workflows/useContainer.yml +++ b/.github/workflows/useContainer.yml @@ -60,8 +60,9 @@ jobs: sudo apt-get install git-all -y - git clone -b test/maccGradedCase https://github.com/stacs-cp/AutoIG.git + # git clone -b test/maccGradedCase https://github.com/stacs-cp/AutoIG.git + git clone https://github.com/stacs-cp/AutoIG.git bash bin/install-savilerow.sh bash bin/install-mininzinc.sh bash bin/install-runsolver.sh From 0aacc8c75ff1dd6a4f5cb421d8efc2ddee9422f6 Mon Sep 17 00:00:00 2001 From: vincepick Date: Tue, 10 Dec 2024 20:24:03 +0000 Subject: [PATCH 041/100] build: updated to ensure builds correctly without test --- .github/workflows/useContainer.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/useContainer.yml b/.github/workflows/useContainer.yml index 07353022..c9b779b3 100644 --- a/.github/workflows/useContainer.yml +++ b/.github/workflows/useContainer.yml @@ -82,11 +82,7 @@ jobs: AUTOIG=$(pwd) echo "Environment made :D, path:" - echo $PATH - - cd /scripts/testScript - - bash check.sh + echo $PATH # if script fails reject PR - name: Fail From cfd35ab9ec631e0d011f4116449f9a225b62ab5d Mon Sep 17 00:00:00 2001 From: vincepick Date: Tue, 10 Dec 2024 20:31:22 +0000 Subject: [PATCH 042/100] build: testing ability to run in the test branch --- .github/workflows/useContainer.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/useContainer.yml b/.github/workflows/useContainer.yml index c9b779b3..3f4b4f86 100644 --- a/.github/workflows/useContainer.yml +++ b/.github/workflows/useContainer.yml @@ -60,9 +60,7 @@ jobs: sudo apt-get install git-all -y - # git clone -b test/maccGradedCase https://github.com/stacs-cp/AutoIG.git - - git clone https://github.com/stacs-cp/AutoIG.git + git clone -b test/maccGradedCase https://github.com/stacs-cp/AutoIG.git bash bin/install-savilerow.sh bash bin/install-mininzinc.sh bash bin/install-runsolver.sh @@ -84,6 +82,9 @@ jobs: echo "Environment made :D, path:" echo $PATH + # cd /scripts/testScript + + # bash check.sh # if script fails reject PR - name: Fail if: ${{ failure() }} From b2ebc7394b9305c44643ee0b46ec70f50c6b9669 Mon Sep 17 00:00:00 2001 From: vincepick Date: Tue, 10 Dec 2024 20:35:54 +0000 Subject: [PATCH 043/100] build: testing ability to run test --- .github/workflows/useContainer.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/useContainer.yml b/.github/workflows/useContainer.yml index 3f4b4f86..716adaf2 100644 --- a/.github/workflows/useContainer.yml +++ b/.github/workflows/useContainer.yml @@ -81,6 +81,8 @@ jobs: echo "Environment made :D, path:" echo $PATH + cd scripts + bash testScript/check.sh # cd /scripts/testScript From 2d26c67814e248c0d5e7d34a9fd0d1411b1f113b Mon Sep 17 00:00:00 2001 From: vincepick Date: Tue, 10 Dec 2024 22:52:02 +0000 Subject: [PATCH 044/100] build: trying to run tests again --- .github/workflows/useContainer.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/useContainer.yml b/.github/workflows/useContainer.yml index 716adaf2..9947479a 100644 --- a/.github/workflows/useContainer.yml +++ b/.github/workflows/useContainer.yml @@ -81,8 +81,8 @@ jobs: echo "Environment made :D, path:" echo $PATH - cd scripts - bash testScript/check.sh + cd scripts/testScript + bash check.sh # cd /scripts/testScript From 0cea72c7ac03ee098a5a133a32155303621cba1f Mon Sep 17 00:00:00 2001 From: vincepick Date: Tue, 10 Dec 2024 22:59:04 +0000 Subject: [PATCH 045/100] test: updated testing script --- scripts/testScript/tests/maccGraded | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/testScript/tests/maccGraded b/scripts/testScript/tests/maccGraded index d30e00ea..dc751a36 100644 --- a/scripts/testScript/tests/maccGraded +++ b/scripts/testScript/tests/maccGraded @@ -1,5 +1,6 @@ #!/bin/bash +mkdir "$AUTOIG/experiments/macc-graded" cd "$AUTOIG/experiments/macc-graded" python3 "$AUTOIG/scripts/setup.py" --generatorModel "$AUTOIG/data/models/macc/generator-small.essence" --problemModel "$AUTOIG/data/models/macc/problem.mzn" --instanceSetting graded --minSolverTime 0 --maxSolverTime 5 --solver chuffed --solverFlags="-f" --maxEvaluations 180 --genSolverTimeLimit 3 From 20eab31354f65d94b136f0ae5868b9b9a3ea2801 Mon Sep 17 00:00:00 2001 From: vincepick Date: Tue, 10 Dec 2024 23:04:51 +0000 Subject: [PATCH 046/100] test: updated testing script again --- scripts/testScript/tests/maccGraded | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/testScript/tests/maccGraded b/scripts/testScript/tests/maccGraded index dc751a36..22c742f6 100644 --- a/scripts/testScript/tests/maccGraded +++ b/scripts/testScript/tests/maccGraded @@ -1,6 +1,7 @@ #!/bin/bash -mkdir "$AUTOIG/experiments/macc-graded" +# avoids having an error if directory already exists +mkdir -p "$AUTOIG/experiments/macc-graded" cd "$AUTOIG/experiments/macc-graded" python3 "$AUTOIG/scripts/setup.py" --generatorModel "$AUTOIG/data/models/macc/generator-small.essence" --problemModel "$AUTOIG/data/models/macc/problem.mzn" --instanceSetting graded --minSolverTime 0 --maxSolverTime 5 --solver chuffed --solverFlags="-f" --maxEvaluations 180 --genSolverTimeLimit 3 From 9b4f0c69d50f569bdb0b5ceb666d7f03670a319c Mon Sep 17 00:00:00 2001 From: vincepick Date: Tue, 10 Dec 2024 23:23:57 +0000 Subject: [PATCH 047/100] build(CI-Pipeline): made it run tests on the branch changes are being pushed to dynamically --- .github/workflows/useContainer.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/useContainer.yml b/.github/workflows/useContainer.yml index 9947479a..4fc43906 100644 --- a/.github/workflows/useContainer.yml +++ b/.github/workflows/useContainer.yml @@ -59,9 +59,9 @@ jobs: sudo apt-get install git-all -y + CURRENT_BRANCH="${{ github.ref_name }}" - git clone -b test/maccGradedCase https://github.com/stacs-cp/AutoIG.git - bash bin/install-savilerow.sh + git clone -b "$CURRENT_BRANCH" https://github.com/stacs-cp/AutoIG.git bash bin/install-savilerow.sh bash bin/install-mininzinc.sh bash bin/install-runsolver.sh From c4c44c092488064804dddfe2aa13a0b5ad0b1e3c Mon Sep 17 00:00:00 2001 From: vincepick Date: Tue, 10 Dec 2024 23:27:35 +0000 Subject: [PATCH 048/100] build(CI-Pipeline): update dynamic branch usage --- .github/workflows/useContainer.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/useContainer.yml b/.github/workflows/useContainer.yml index 4fc43906..2b757873 100644 --- a/.github/workflows/useContainer.yml +++ b/.github/workflows/useContainer.yml @@ -61,7 +61,8 @@ jobs: CURRENT_BRANCH="${{ github.ref_name }}" - git clone -b "$CURRENT_BRANCH" https://github.com/stacs-cp/AutoIG.git bash bin/install-savilerow.sh + git clone -b "$CURRENT_BRANCH" https://github.com/stacs-cp/AutoIG.git + bash bin/install-savilerow.sh bash bin/install-mininzinc.sh bash bin/install-runsolver.sh From 463ff81638af8a90b915ab672d5a3fa6a7f7a52e Mon Sep 17 00:00:00 2001 From: vincepick Date: Wed, 11 Dec 2024 00:18:43 +0000 Subject: [PATCH 049/100] docs: added updated comments to useContainer workflow --- .github/workflows/useContainer.yml | 32 ++++++++++-------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/.github/workflows/useContainer.yml b/.github/workflows/useContainer.yml index 2b757873..6387daed 100644 --- a/.github/workflows/useContainer.yml +++ b/.github/workflows/useContainer.yml @@ -23,23 +23,16 @@ jobs: # ghcr.io/conjure-cp/conjure@sha256:ebff76918718631f099544eed3a808cd16ce8f2c863c8229c7d2e417ba745c56 steps: - # Checkout repo: checks out current repo (so AutoIG) + # Checkout repo: checks out current repo (so AutoIG current branch) - name: Checkout code uses: actions/checkout@v4 - # try to container with volume - # binding to root directory - # currently clones a specific branch + # Clones the current branch being pushed from + # Run same commands as in Docker file, this needs to be updated if there are major updates to Docker later on + # The two should be consistent - name: Run container and execute script run: | - echo "Running inside docker container!" - - - echo "Script: $0" - echo "Shell: $SHELL" - ps -p $$ - apt-get update DEBIAN_FRONTEND=noninteractive apt-get install -y \ bash \ @@ -50,6 +43,7 @@ jobs: software-properties-common \ unzip + # Installing Python Dependencies sudo apt-get install -y python3-pip apt install python3-pandas -y apt install python3-numpy -y @@ -59,6 +53,8 @@ jobs: sudo apt-get install git-all -y + + # Getting current branch CURRENT_BRANCH="${{ github.ref_name }}" git clone -b "$CURRENT_BRANCH" https://github.com/stacs-cp/AutoIG.git @@ -71,33 +67,27 @@ jobs: bash bin/install-yuck.sh bash bin/install-picat.sh - ls - - echo "Reached this point" - . bin/set-path.sh - AUTOIG=$(pwd) - echo "Environment made :D, path:" echo $PATH cd scripts/testScript - bash check.sh - # cd /scripts/testScript + # Run the actual test script + bash check.sh # bash check.sh # if script fails reject PR - name: Fail if: ${{ failure() }} run: | - echo "This useContainer failed, rejecting PR." + echo "This tests failed, rejecting PR." exit 1 # if script passes approve PR - name: Pass if: ${{ success() }} run: | - echo "This useContainer passed, allowing PR." + echo "This tests passed! allowing PR." exit 0 From 1e64d58ecf238cebb40b97cbec0e3b73bb2ca488 Mon Sep 17 00:00:00 2001 From: vincepick Date: Wed, 11 Dec 2024 02:37:42 +0000 Subject: [PATCH 050/100] build: trying specific version of Conjure again --- .github/workflows/useContainer.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/useContainer.yml b/.github/workflows/useContainer.yml index 6387daed..c2bf928d 100644 --- a/.github/workflows/useContainer.yml +++ b/.github/workflows/useContainer.yml @@ -14,13 +14,13 @@ jobs: shell: bash container: # using the main instead of the previous version for now - image: ghcr.io/conjure-cp/conjure:main + # image: ghcr.io/conjure-cp/conjure:main #previous version #ghcr.io/conjure-cp/conjure@sha256:e959c664d83a08b68a5b31409d56ce82eadf0f0b74f8af1809642b73f652c940 # Current version of conjure - # ghcr.io/conjure-cp/conjure@sha256:ebff76918718631f099544eed3a808cd16ce8f2c863c8229c7d2e417ba745c56 + image: ghcr.io/conjure-cp/conjure@sha256:ebff76918718631f099544eed3a808cd16ce8f2c863c8229c7d2e417ba745c56 steps: # Checkout repo: checks out current repo (so AutoIG current branch) From b112fa0db018a5f1fe62b697bbf5a1ce9bba0707 Mon Sep 17 00:00:00 2001 From: vincepick Date: Wed, 11 Dec 2024 20:32:02 +0000 Subject: [PATCH 051/100] build: changed back to conjure:main base image for now before the issue is fixed --- .github/workflows/useContainer.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/useContainer.yml b/.github/workflows/useContainer.yml index c2bf928d..4941e06b 100644 --- a/.github/workflows/useContainer.yml +++ b/.github/workflows/useContainer.yml @@ -14,13 +14,13 @@ jobs: shell: bash container: # using the main instead of the previous version for now - # image: ghcr.io/conjure-cp/conjure:main + image: ghcr.io/conjure-cp/conjure:main #previous version #ghcr.io/conjure-cp/conjure@sha256:e959c664d83a08b68a5b31409d56ce82eadf0f0b74f8af1809642b73f652c940 # Current version of conjure - image: ghcr.io/conjure-cp/conjure@sha256:ebff76918718631f099544eed3a808cd16ce8f2c863c8229c7d2e417ba745c56 + # image: ghcr.io/conjure-cp/conjure@sha256:ebff76918718631f099544eed3a808cd16ce8f2c863c8229c7d2e417ba745c56 steps: # Checkout repo: checks out current repo (so AutoIG current branch) From a8f35fd5fa0a3f10a0665db598c62e6e8ec43001 Mon Sep 17 00:00:00 2001 From: vincepick Date: Wed, 11 Dec 2024 21:49:34 +0000 Subject: [PATCH 052/100] build: dockerfile works with existing set-path file --- dockerfile | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/dockerfile b/dockerfile index f3afc78c..6ff5c1f2 100644 --- a/dockerfile +++ b/dockerfile @@ -8,7 +8,6 @@ RUN apt-get update # Doing the default for timezone using frontend=noninteractive RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \ bash \ - sudo \ wget \ curl \ gnupg \ @@ -16,16 +15,16 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \ unzip # Installing necessary language dependencies for Python -RUN sudo apt-get install -y python3-pip +RUN apt install -y python3-pip RUN apt install python3-pandas -y RUN apt install python3-numpy -y -RUN sudo apt install python-is-python3 +RUN apt install python-is-python3 # Installing R for iRace compatability -RUN sudo apt-get install r-base -y +RUN apt install r-base -y # Installing Git -RUN sudo apt-get install git-all -y +RUN apt install git-all -y # Set working dir to root WORKDIR / From 3483d44c5bda576e311559b204f1726771deb44f Mon Sep 17 00:00:00 2001 From: vincepick Date: Wed, 11 Dec 2024 22:25:02 +0000 Subject: [PATCH 053/100] build: removed pushcontainer workflow --- .github/workflows/pushContainer.yml | 84 ----------------------------- 1 file changed, 84 deletions(-) delete mode 100644 .github/workflows/pushContainer.yml diff --git a/.github/workflows/pushContainer.yml b/.github/workflows/pushContainer.yml deleted file mode 100644 index 15a66769..00000000 --- a/.github/workflows/pushContainer.yml +++ /dev/null @@ -1,84 +0,0 @@ -name: Publishing container on ghcr.io - -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - -on: - workflow_dispatch: # can be triggered manually - workflow_run: # run only when all tests pass - branches: - - main - workflows: - - Running all tests - types: - - completed - push: # for pushes to release tags (v*) - tags: - - "v*.*.*" - pull_request: # and for PRs that edit the docker files or this workflow - paths: - - Dockerfile - - .github/workflows/pushContainer.yml - # other branches that want testing must create a PR - -env: - REGISTRY: ghcr.io - # github.repository as / - IMAGE_NAME: ${{ github.repository }} - -jobs: - Job: - # if this was triggered through a completed run of "Running all tests", we check if the run completed successfully - # if it was triggered through a PR, we just run it - if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' }} - - runs-on: ubuntu-latest - - permissions: - contents: read - packages: write - # This is used to complete the identity challenge - # with sigstore/fulcio when running outside of PRs. - id-token: write - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - # Set up buildx (Docker CLI plugin for extended build capabilities with BuildKit) - - name: Setup Docker buildx - uses: docker/setup-buildx-action@v3 - - # Login against a Docker registry except on PR - - name: Log into registry - if: github.event_name != 'pull_request' - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - # Extract metadata (tags, labels) for Docker - - name: Extract Docker metadata - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - - name: Extract git version - shell: bash - run: bash etc/build/version.sh - - # Build and push Docker image with Buildx (don't push on PR) - - name: Build and push Docker image - id: build-and-push - uses: docker/build-push-action@v5 - with: - context: . - push: ${{ github.event_name != 'pull_request' }} # do not push if this was triggered by a PR - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max From 2d4b666b95c41455091c8fa46831ac0689c566fc Mon Sep 17 00:00:00 2001 From: vincepick Date: Thu, 12 Dec 2024 00:20:48 +0000 Subject: [PATCH 054/100] build: updated run_tests.yml to also run on pull requests --- .github/workflows/{useContainer.yml => run_tests.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{useContainer.yml => run_tests.yml} (100%) diff --git a/.github/workflows/useContainer.yml b/.github/workflows/run_tests.yml similarity index 100% rename from .github/workflows/useContainer.yml rename to .github/workflows/run_tests.yml From 7e67ee618a2cbddab12d279c69af89c4693e95f2 Mon Sep 17 00:00:00 2001 From: vincepick Date: Thu, 12 Dec 2024 00:22:37 +0000 Subject: [PATCH 055/100] fix: fixed previous commit --- .github/workflows/run_tests.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 4941e06b..882c1b63 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -5,6 +5,9 @@ on: branches: - test/maccGradedCase + pull_request: + types: [opened, synchronize, reopened, closed] + jobs: run-tests: name: Run AutoIG Tests From 0e44f91ecaee9d18aa9ecd4a2259e63dc96dc569 Mon Sep 17 00:00:00 2001 From: vincepick Date: Thu, 12 Dec 2024 15:45:02 +0000 Subject: [PATCH 056/100] tests(CI Pipeline): added different testing suite for PRs vs just pull requests --- .github/workflows/run_tests.yml | 23 ++++++-- scripts/testScript/check_pr.sh | 56 +++++++++++++++++++ scripts/testScript/pr_tests/maccGradedFullGen | 8 +++ .../tests/{maccGraded => maccGradedSmallGen} | 0 4 files changed, 83 insertions(+), 4 deletions(-) create mode 100644 scripts/testScript/check_pr.sh create mode 100644 scripts/testScript/pr_tests/maccGradedFullGen rename scripts/testScript/tests/{maccGraded => maccGradedSmallGen} (100%) diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 882c1b63..fd340fd5 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -75,22 +75,37 @@ jobs: AUTOIG=$(pwd) echo "Environment made :D, path:" echo $PATH - cd scripts/testScript - # Run the actual test script + - name: Navigate to Test Scripts + run: | + cd AutoIG/scripts/testScript + + # Run script for Push Events + - name: Run Push Tests + if: github.event_name == 'push' + run: | + echo "Running basic tests for Push" bash check.sh + # Run script for Pull Requests + - name: Run Pull Request Tests + if: github.event_name == 'pull_request' + run: | + echo "Running more thorough tests for Pull Request" + bash check.sh + bash check_pr.sh + # bash check.sh # if script fails reject PR - name: Fail if: ${{ failure() }} run: | - echo "This tests failed, rejecting PR." + echo "These tests failed, rejecting PR." exit 1 # if script passes approve PR - name: Pass if: ${{ success() }} run: | - echo "This tests passed! allowing PR." + echo "These tests passed! allowing PR." exit 0 diff --git a/scripts/testScript/check_pr.sh b/scripts/testScript/check_pr.sh new file mode 100644 index 00000000..81858690 --- /dev/null +++ b/scripts/testScript/check_pr.sh @@ -0,0 +1,56 @@ +#!/bin/bash + +# Runs all scripts put in ./tests and makes sure that the run at some point contains a provided line: + +# Lines being checked for +lines=( + "# Best configurations (first number is the configuration ID; listed from best to worst according to the sum of ranks):" + "# Best configurations as commandlines (first number is the configuration ID; same order as above):" +) + +testsPassed=0 +testsRun=0 + +start=$(date +%s) + +# Loop through each script in the tests directory +for file in pr_tests/*; do + ((testsRun++)) + # Check if file + if [[ -f "$file" ]]; then + + # Run contents of file + output=$(bash "$file") + all_lines_found=true + + # Check for each line in the array + for line in "${lines[@]}"; do + if [[ "$output" != *"$line"* ]]; then + all_lines_found=false + echo "Test $testsRun: $file failed, line not found: $line" + fi + done + + # If all lines are found, count as passed + if $all_lines_found; then + echo "Test $testsRun: $file passed, all lines found in output" + ((testsPassed++)) + fi + fi +done + +# Final results +if [[ "$testsRun" -eq "$testsPassed" ]]; then + printf "\e[32mAll tests passed: %d/%d! :D\e[0m\n" "$testsPassed" "$testsRun" + exit 0 +else + printf "\e[31mSome cases failing, only %d/%d passed.\e[0m\n" "$testsPassed" "$testsRun" + exit 1 +fi + +# Record end time and calculate elapsed time +end=$(date +%s) +elapsedTime=$((end - start)) + +# Display time elapsed +echo "Time elapsed: $elapsedTime seconds" diff --git a/scripts/testScript/pr_tests/maccGradedFullGen b/scripts/testScript/pr_tests/maccGradedFullGen new file mode 100644 index 00000000..c817f56c --- /dev/null +++ b/scripts/testScript/pr_tests/maccGradedFullGen @@ -0,0 +1,8 @@ +#!/bin/bash + +# avoids having an error if directory already exists +mkdir -p "$AUTOIG/experiments/macc-graded" +cd "$AUTOIG/experiments/macc-graded" +python3 "$AUTOIG/scripts/setup.py" --generatorModel "$AUTOIG/data/models/macc/generator.essence" --problemModel "$AUTOIG/data/models/macc/problem.mzn" --instanceSetting graded --minSolverTime 0 --maxSolverTime 5 --solver chuffed --solverFlags="-f" --maxEvaluations 180 --genSolverTimeLimit 3 + +bash "$AUTOIG/experiments/macc-graded/run.sh" diff --git a/scripts/testScript/tests/maccGraded b/scripts/testScript/tests/maccGradedSmallGen similarity index 100% rename from scripts/testScript/tests/maccGraded rename to scripts/testScript/tests/maccGradedSmallGen From 578916b90e6baecf29f1e8e34a8415520445a579 Mon Sep 17 00:00:00 2001 From: vincepick Date: Thu, 12 Dec 2024 15:51:36 +0000 Subject: [PATCH 057/100] tests: updated path to test running script --- .github/workflows/run_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index fd340fd5..3b37563d 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -78,7 +78,7 @@ jobs: - name: Navigate to Test Scripts run: | - cd AutoIG/scripts/testScript + cd scripts/testScript # Run script for Push Events - name: Run Push Tests From ad61f0f659cb5feaf2575db53004ecff3995a979 Mon Sep 17 00:00:00 2001 From: vincepick Date: Thu, 12 Dec 2024 15:57:56 +0000 Subject: [PATCH 058/100] tests: update previous commit --- .github/workflows/run_tests.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 3b37563d..91b988c6 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -76,15 +76,13 @@ jobs: echo "Environment made :D, path:" echo $PATH - - name: Navigate to Test Scripts - run: | - cd scripts/testScript - # Run script for Push Events - name: Run Push Tests if: github.event_name == 'push' run: | + cd scripts/testScript echo "Running basic tests for Push" + ls bash check.sh # Run script for Pull Requests From 0a70147617f68806ed67d1ed2016f5c6ffe0775d Mon Sep 17 00:00:00 2001 From: vincepick Date: Thu, 12 Dec 2024 18:06:59 +0000 Subject: [PATCH 059/100] build: added debug statements to run_tests --- .github/workflows/run_tests.yml | 5 ++- dockerfile | 56 --------------------------------- 2 files changed, 4 insertions(+), 57 deletions(-) delete mode 100644 dockerfile diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 91b988c6..bdb7a409 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -80,7 +80,9 @@ jobs: - name: Run Push Tests if: github.event_name == 'push' run: | - cd scripts/testScript + echo "Autoig is" + echo $AUTOIG + cd $AUTOIG/scripts/testScript echo "Running basic tests for Push" ls bash check.sh @@ -89,6 +91,7 @@ jobs: - name: Run Pull Request Tests if: github.event_name == 'pull_request' run: | + cd $AUTOIG/scripts/testScript echo "Running more thorough tests for Pull Request" bash check.sh bash check_pr.sh diff --git a/dockerfile b/dockerfile deleted file mode 100644 index 6ff5c1f2..00000000 --- a/dockerfile +++ /dev/null @@ -1,56 +0,0 @@ -# Use the Conjure base image -FROM --platform=linux/amd64 ghcr.io/conjure-cp/conjure:main - -# Update atp-get -RUN apt-get update - - -# Doing the default for timezone using frontend=noninteractive -RUN DEBIAN_FRONTEND=noninteractive apt-get install -y \ - bash \ - wget \ - curl \ - gnupg \ - software-properties-common \ - unzip - -# Installing necessary language dependencies for Python -RUN apt install -y python3-pip -RUN apt install python3-pandas -y -RUN apt install python3-numpy -y -RUN apt install python-is-python3 - -# Installing R for iRace compatability -RUN apt install r-base -y - -# Installing Git -RUN apt install git-all -y - -# Set working dir to root -WORKDIR / - -# Clone into AutoIG directory -RUN git clone -b build/update-docker https://github.com/stacs-cp/AutoIG.git - -WORKDIR /AutoIG - - -RUN bash bin/install-savilerow.sh -RUN bash bin/install-mininzinc.sh -RUN bash bin/install-runsolver.sh - -# Still need to install iRace -RUN bash bin/install-irace.sh -RUN bash bin/install-ortools.sh - - -RUN bash bin/install-yuck.sh -RUN bash bin/install-picat.sh - - - -# Set the working directory -WORKDIR /AutoIG - -RUN apt-get install -y \ - vim From 33dc913af3529ed925e3295f0029124827b64f74 Mon Sep 17 00:00:00 2001 From: vincepick Date: Thu, 12 Dec 2024 18:28:05 +0000 Subject: [PATCH 060/100] build: added debug statements to run_tests again --- .github/workflows/run_tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index bdb7a409..f1311e72 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -82,6 +82,8 @@ jobs: run: | echo "Autoig is" echo $AUTOIG + ls + echo "just printed ls" cd $AUTOIG/scripts/testScript echo "Running basic tests for Push" ls From 2c82f54491aca8c02014159cfdc4310325fa4b64 Mon Sep 17 00:00:00 2001 From: vincepick Date: Thu, 12 Dec 2024 19:20:24 +0000 Subject: [PATCH 061/100] build: updated workflow with correct path --- .github/workflows/run_tests.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index f1311e72..c4b22f97 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -80,11 +80,7 @@ jobs: - name: Run Push Tests if: github.event_name == 'push' run: | - echo "Autoig is" - echo $AUTOIG - ls - echo "just printed ls" - cd $AUTOIG/scripts/testScript + cd AutoIG/scripts/testScript echo "Running basic tests for Push" ls bash check.sh @@ -93,7 +89,8 @@ jobs: - name: Run Pull Request Tests if: github.event_name == 'pull_request' run: | - cd $AUTOIG/scripts/testScript + + cd AutoIG/scripts/testScript echo "Running more thorough tests for Pull Request" bash check.sh bash check_pr.sh From 5861b92aae29f304d3fb874dced5e15bad29284c Mon Sep 17 00:00:00 2001 From: vincepick Date: Thu, 12 Dec 2024 19:26:29 +0000 Subject: [PATCH 062/100] build: updated workflow with correct path --- .github/workflows/run_tests.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index c4b22f97..deeaa491 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -71,8 +71,7 @@ jobs: bash bin/install-yuck.sh bash bin/install-picat.sh ls - . bin/set-path.sh - AUTOIG=$(pwd) + echo "Environment made :D, path:" echo $PATH @@ -80,7 +79,10 @@ jobs: - name: Run Push Tests if: github.event_name == 'push' run: | - cd AutoIG/scripts/testScript + cd AutoIG + . bin/set-path.sh + AUTOIG=$(pwd) + cd $AUTOIG/scripts/testScript echo "Running basic tests for Push" ls bash check.sh @@ -89,8 +91,10 @@ jobs: - name: Run Pull Request Tests if: github.event_name == 'pull_request' run: | - - cd AutoIG/scripts/testScript + cd AutoIG + . bin/set-path.sh + AUTOIG=$(pwd) + cd $AUTOIG/scripts/testScript echo "Running more thorough tests for Pull Request" bash check.sh bash check_pr.sh From b275d23f489f301ec19ab5f610ae5c1a7d265727 Mon Sep 17 00:00:00 2001 From: vincepick Date: Thu, 12 Dec 2024 19:34:25 +0000 Subject: [PATCH 063/100] build: further debug statements --- .github/workflows/run_tests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index deeaa491..90955c8d 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -84,7 +84,6 @@ jobs: AUTOIG=$(pwd) cd $AUTOIG/scripts/testScript echo "Running basic tests for Push" - ls bash check.sh # Run script for Pull Requests From d6a918a7f5d2151fd86b62d5edd6171a091a15e9 Mon Sep 17 00:00:00 2001 From: vincepick Date: Thu, 12 Dec 2024 19:34:45 +0000 Subject: [PATCH 064/100] build: added debug statements to testscripts --- scripts/testScript/tests/maccGradedSmallGen | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/testScript/tests/maccGradedSmallGen b/scripts/testScript/tests/maccGradedSmallGen index 22c742f6..c59ce158 100644 --- a/scripts/testScript/tests/maccGradedSmallGen +++ b/scripts/testScript/tests/maccGradedSmallGen @@ -1,8 +1,11 @@ #!/bin/bash # avoids having an error if directory already exists -mkdir -p "$AUTOIG/experiments/macc-graded" -cd "$AUTOIG/experiments/macc-graded" +echo "the variable is: " +ls +echo $AUTOIG +mkdir -p "$AUTOIG/experiments/macc-graded-small-gen" +cd "$AUTOIG/experiments/macc-graded-small-gen" python3 "$AUTOIG/scripts/setup.py" --generatorModel "$AUTOIG/data/models/macc/generator-small.essence" --problemModel "$AUTOIG/data/models/macc/problem.mzn" --instanceSetting graded --minSolverTime 0 --maxSolverTime 5 --solver chuffed --solverFlags="-f" --maxEvaluations 180 --genSolverTimeLimit 3 -bash "$AUTOIG/experiments/macc-graded/run.sh" +bash "$AUTOIG/experiments/macc-graded-small-gen/run.sh" From e371d5d7c091f1b6fe321878d60660b415a2e8b2 Mon Sep 17 00:00:00 2001 From: vincepick Date: Thu, 12 Dec 2024 19:40:01 +0000 Subject: [PATCH 065/100] build: updated which repo is cloned --- .github/workflows/run_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 90955c8d..0844e787 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -60,7 +60,7 @@ jobs: # Getting current branch CURRENT_BRANCH="${{ github.ref_name }}" - git clone -b "$CURRENT_BRANCH" https://github.com/stacs-cp/AutoIG.git + git clone -b "$CURRENT_BRANCH" https://github.com/vincepick/AutoIG.git bash bin/install-savilerow.sh bash bin/install-mininzinc.sh bash bin/install-runsolver.sh From 39fa18098d5177363d47680083afc4987dfe2d34 Mon Sep 17 00:00:00 2001 From: vincepick Date: Wed, 18 Dec 2024 19:42:01 +0000 Subject: [PATCH 066/100] test: added more test cases for other solvers, and updated test.readme documentation --- scripts/testScript/testreadme.md | 2 +- ...ccGradedSmallGen => chuffed-maccGradedSmallGen.sh} | 0 scripts/testScript/tests/cpsat-maccGradedSmallGen.sh | 11 +++++++++++ scripts/testScript/tests/gecode-maccGradedSmallGen.sh | 11 +++++++++++ scripts/testScript/tests/picat-maccGradedSmallGen.sh | 11 +++++++++++ scripts/testScript/tests/yuck-maccGradedSmallGen.sh | 11 +++++++++++ 6 files changed, 45 insertions(+), 1 deletion(-) rename scripts/testScript/tests/{maccGradedSmallGen => chuffed-maccGradedSmallGen.sh} (100%) create mode 100644 scripts/testScript/tests/cpsat-maccGradedSmallGen.sh create mode 100644 scripts/testScript/tests/gecode-maccGradedSmallGen.sh create mode 100644 scripts/testScript/tests/picat-maccGradedSmallGen.sh create mode 100644 scripts/testScript/tests/yuck-maccGradedSmallGen.sh diff --git a/scripts/testScript/testreadme.md b/scripts/testScript/testreadme.md index d4483528..62bbe692 100644 --- a/scripts/testScript/testreadme.md +++ b/scripts/testScript/testreadme.md @@ -8,7 +8,7 @@ The script will automatically scan the standard output, then output weather the After all tests are run, the script also outputs the number of passed tests / the number of failed tests, as well as time taken to run all of them. -This is one of the same test script which will eventuall be integrated into the automated CI pipeline in GitHub, but is used manually for now. +This is one of the same test script which will eventuall be integrated into the automated CI pipeline in GitHub, but can also be used manually. An example contents of a test may look like: diff --git a/scripts/testScript/tests/maccGradedSmallGen b/scripts/testScript/tests/chuffed-maccGradedSmallGen.sh similarity index 100% rename from scripts/testScript/tests/maccGradedSmallGen rename to scripts/testScript/tests/chuffed-maccGradedSmallGen.sh diff --git a/scripts/testScript/tests/cpsat-maccGradedSmallGen.sh b/scripts/testScript/tests/cpsat-maccGradedSmallGen.sh new file mode 100644 index 00000000..7f3280c7 --- /dev/null +++ b/scripts/testScript/tests/cpsat-maccGradedSmallGen.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# avoids having an error if directory already exists +echo "the variable is: " +ls +echo $AUTOIG +mkdir -p "$AUTOIG/experiments/macc-graded-small-gen" +cd "$AUTOIG/experiments/macc-graded-small-gen" +python3 "$AUTOIG/scripts/setup.py" --generatorModel "$AUTOIG/data/models/macc/generator-small.essence" --problemModel "$AUTOIG/data/models/macc/problem.mzn" --instanceSetting graded --minSolverTime 0 --maxSolverTime 5 --solver cpsat --solverFlags="-f" --maxEvaluations 180 --genSolverTimeLimit 3 + +bash "$AUTOIG/experiments/macc-graded-small-gen/run.sh" diff --git a/scripts/testScript/tests/gecode-maccGradedSmallGen.sh b/scripts/testScript/tests/gecode-maccGradedSmallGen.sh new file mode 100644 index 00000000..c43f9209 --- /dev/null +++ b/scripts/testScript/tests/gecode-maccGradedSmallGen.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# avoids having an error if directory already exists +echo "the variable is: " +ls +echo $AUTOIG +mkdir -p "$AUTOIG/experiments/macc-graded-small-gen" +cd "$AUTOIG/experiments/macc-graded-small-gen" +python3 "$AUTOIG/scripts/setup.py" --generatorModel "$AUTOIG/data/models/macc/generator-small.essence" --problemModel "$AUTOIG/data/models/macc/problem.mzn" --instanceSetting graded --minSolverTime 0 --maxSolverTime 5 --solver gecode --solverFlags="-f" --maxEvaluations 180 --genSolverTimeLimit 3 + +bash "$AUTOIG/experiments/macc-graded-small-gen/run.sh" diff --git a/scripts/testScript/tests/picat-maccGradedSmallGen.sh b/scripts/testScript/tests/picat-maccGradedSmallGen.sh new file mode 100644 index 00000000..11241962 --- /dev/null +++ b/scripts/testScript/tests/picat-maccGradedSmallGen.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# avoids having an error if directory already exists +echo "the variable is: " +ls +echo $AUTOIG +mkdir -p "$AUTOIG/experiments/macc-graded-small-gen" +cd "$AUTOIG/experiments/macc-graded-small-gen" +python3 "$AUTOIG/scripts/setup.py" --generatorModel "$AUTOIG/data/models/macc/generator-small.essence" --problemModel "$AUTOIG/data/models/macc/problem.mzn" --instanceSetting graded --minSolverTime 0 --maxSolverTime 5 --solver picat --solverFlags="-f" --maxEvaluations 180 --genSolverTimeLimit 3 + +bash "$AUTOIG/experiments/macc-graded-small-gen/run.sh" diff --git a/scripts/testScript/tests/yuck-maccGradedSmallGen.sh b/scripts/testScript/tests/yuck-maccGradedSmallGen.sh new file mode 100644 index 00000000..d519f224 --- /dev/null +++ b/scripts/testScript/tests/yuck-maccGradedSmallGen.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# avoids having an error if directory already exists +echo "the variable is: " +ls +echo $AUTOIG +mkdir -p "$AUTOIG/experiments/macc-graded-small-gen" +cd "$AUTOIG/experiments/macc-graded-small-gen" +python3 "$AUTOIG/scripts/setup.py" --generatorModel "$AUTOIG/data/models/macc/generator-small.essence" --problemModel "$AUTOIG/data/models/macc/problem.mzn" --instanceSetting graded --minSolverTime 0 --maxSolverTime 5 --solver yuck --solverFlags="-f" --maxEvaluations 180 --genSolverTimeLimit 3 + +bash "$AUTOIG/experiments/macc-graded-small-gen/run.sh" From 93eb5ebb69f0fc703a4fae99323810334af7dd04 Mon Sep 17 00:00:00 2001 From: vincepick Date: Wed, 18 Dec 2024 20:05:10 +0000 Subject: [PATCH 067/100] test: updated check test script --- scripts/testScript/check.sh | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/scripts/testScript/check.sh b/scripts/testScript/check.sh index ed128ae0..ebfcc7cc 100644 --- a/scripts/testScript/check.sh +++ b/scripts/testScript/check.sh @@ -37,6 +37,12 @@ for file in tests/*; do ((testsPassed++)) fi fi + # Record end time and calculate elapsed time + end=$(date +%s) + elapsedTime=$((end - start)) + + # Display time elapsed + echo "Time elapsed: $elapsedTime seconds" done # Final results @@ -47,10 +53,3 @@ else printf "\e[31mSome cases failing, only %d/%d passed.\e[0m\n" "$testsPassed" "$testsRun" exit 1 fi - -# Record end time and calculate elapsed time -end=$(date +%s) -elapsedTime=$((end - start)) - -# Display time elapsed -echo "Time elapsed: $elapsedTime seconds" From 6ed1a81f24718fd47796795ae95796acd047b2bb Mon Sep 17 00:00:00 2001 From: vincepick Date: Wed, 18 Dec 2024 20:11:35 +0000 Subject: [PATCH 068/100] test: added super lightweight models for testing, m.dzn and m.mzn --- data/models/testModel/m.dzn | 1 + data/models/testModel/m.mzn | 1 + 2 files changed, 2 insertions(+) create mode 100644 data/models/testModel/m.dzn create mode 100644 data/models/testModel/m.mzn diff --git a/data/models/testModel/m.dzn b/data/models/testModel/m.dzn new file mode 100644 index 00000000..e471eed8 --- /dev/null +++ b/data/models/testModel/m.dzn @@ -0,0 +1 @@ +A=4; \ No newline at end of file diff --git a/data/models/testModel/m.mzn b/data/models/testModel/m.mzn new file mode 100644 index 00000000..7c173cad --- /dev/null +++ b/data/models/testModel/m.mzn @@ -0,0 +1 @@ +int: A; \ No newline at end of file From ac116b6996417376a05c44b0ab97a4d258298545 Mon Sep 17 00:00:00 2001 From: vincepick Date: Wed, 18 Dec 2024 21:38:37 +0000 Subject: [PATCH 069/100] test: added tests for conjure solve to the testing directory --- scripts/testScript/conjure_solve-tests/model-test.solution | 3 +++ scripts/testScript/conjure_solve-tests/model.essence | 4 ++++ scripts/testScript/conjure_solve-tests/test.param | 1 + 3 files changed, 8 insertions(+) create mode 100644 scripts/testScript/conjure_solve-tests/model-test.solution create mode 100644 scripts/testScript/conjure_solve-tests/model.essence create mode 100644 scripts/testScript/conjure_solve-tests/test.param diff --git a/scripts/testScript/conjure_solve-tests/model-test.solution b/scripts/testScript/conjure_solve-tests/model-test.solution new file mode 100644 index 00000000..4b01251b --- /dev/null +++ b/scripts/testScript/conjure_solve-tests/model-test.solution @@ -0,0 +1,3 @@ +language Essence 1.3 + +letting y be 6 \ No newline at end of file diff --git a/scripts/testScript/conjure_solve-tests/model.essence b/scripts/testScript/conjure_solve-tests/model.essence new file mode 100644 index 00000000..9bdd5792 --- /dev/null +++ b/scripts/testScript/conjure_solve-tests/model.essence @@ -0,0 +1,4 @@ +given x: int(1..10) +find y: int(1..10) +such that + y > x \ No newline at end of file diff --git a/scripts/testScript/conjure_solve-tests/test.param b/scripts/testScript/conjure_solve-tests/test.param new file mode 100644 index 00000000..a063dcc8 --- /dev/null +++ b/scripts/testScript/conjure_solve-tests/test.param @@ -0,0 +1 @@ +letting x be 5 \ No newline at end of file From f3586db197e273d0d92f41bffbf6c712824ccb05 Mon Sep 17 00:00:00 2001 From: vincepick Date: Thu, 19 Dec 2024 13:47:19 +0000 Subject: [PATCH 070/100] test: added tests to ensure that Conjure still works in the altered environment --- .github/workflows/run_tests.yml | 2 +- scripts/testScripts/.DS_Store | Bin 0 -> 8196 bytes scripts/testScripts/check.sh | 55 +++++++++++++++++ scripts/testScripts/check_conjure.sh | 54 +++++++++++++++++ scripts/testScripts/check_pr.sh | 56 ++++++++++++++++++ .../conjure_solve-tests/check_chuffed.sh | 3 + .../conjure_solve-tests/or-tools.sh | 3 + .../essence_testing_data/model-test.solution | 3 + .../essence_testing_data/model.essence | 4 ++ .../essence_testing_data/test.param | 1 + .../testScripts/pr_tests/maccGradedFullGen | 8 +++ scripts/testScripts/test.sh | 5 ++ scripts/testScripts/testreadme.md | 23 +++++++ .../tests/chuffed-maccGradedSmallGen.sh | 11 ++++ .../tests/cpsat-maccGradedSmallGen.sh | 11 ++++ .../tests/gecode-maccGradedSmallGen.sh | 11 ++++ .../tests/picat-maccGradedSmallGen.sh | 11 ++++ .../tests/yuck-maccGradedSmallGen.sh | 11 ++++ 18 files changed, 271 insertions(+), 1 deletion(-) create mode 100644 scripts/testScripts/.DS_Store create mode 100644 scripts/testScripts/check.sh create mode 100644 scripts/testScripts/check_conjure.sh create mode 100644 scripts/testScripts/check_pr.sh create mode 100644 scripts/testScripts/conjure_solve-tests/check_chuffed.sh create mode 100644 scripts/testScripts/conjure_solve-tests/or-tools.sh create mode 100644 scripts/testScripts/essence_testing_data/model-test.solution create mode 100644 scripts/testScripts/essence_testing_data/model.essence create mode 100644 scripts/testScripts/essence_testing_data/test.param create mode 100644 scripts/testScripts/pr_tests/maccGradedFullGen create mode 100644 scripts/testScripts/test.sh create mode 100644 scripts/testScripts/testreadme.md create mode 100644 scripts/testScripts/tests/chuffed-maccGradedSmallGen.sh create mode 100644 scripts/testScripts/tests/cpsat-maccGradedSmallGen.sh create mode 100644 scripts/testScripts/tests/gecode-maccGradedSmallGen.sh create mode 100644 scripts/testScripts/tests/picat-maccGradedSmallGen.sh create mode 100644 scripts/testScripts/tests/yuck-maccGradedSmallGen.sh diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 0844e787..00579f2e 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -82,7 +82,7 @@ jobs: cd AutoIG . bin/set-path.sh AUTOIG=$(pwd) - cd $AUTOIG/scripts/testScript + cd $AUTOIG/scripts/testScripts echo "Running basic tests for Push" bash check.sh diff --git a/scripts/testScripts/.DS_Store b/scripts/testScripts/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5d41507f9d29088a4918025aa75365d17ab4e82c GIT binary patch literal 8196 zcmeHMK~5Vn6n!p19f2w#QBgLP<^UurYq}UvSaesF13*X+X`3)nLs-wM3pfBf#In0y zp)0Pzsu$n_^nKgRcrr&XB}7t5U~m_Ez(RV(l51A zp81wnL_n`&1yli5Kow90RDpj%0iM}XqABOT>s6}?r~?0`0`mP3 zvkE32Gl%x8gT|%+#2TAz;WhIB%ZWWE9y5oQ$}wH`U_90M6vH?=`(tq@CLS|~jt=AK zFn(s^GZbTICoi_{Fo{F8s(>m`RX}q02yJw6KpW)m`@M9ZeX^atvo>yR;T5nL`0rwX zFGbcLur|k7%VecE!Y7Q#IKVF76r||kgx7T((++8e^6sD*#k{`XD80k=op#zE$nCOR zv(7kwKW#Ss{L$Ci%7^;tl|(W#yYm3{pc~$G%xUq`>N2D~qJE;&mewAj`f zi&!F`nH$D@dA?TnG5-O-i26SKa@=nu?#QmIBHHnFaYmnTO;-HNdYGS+#th>gecSl4 z=ALzBtbSU=_dCCG9I|!rJbzyKo3UbbLsr&Bu(Mv|-m*hle71dJgSJ!N7j{pE%=w%- zu9WPcDV}AG7H;Snj1#JJy!ZA_osvhP%VdwTBJbrqcL%th{}fw`D)58~%(=N&CI8=^ z{{H_7?@*^!1yq5@R>0JnJIyW5;*RF(bdqbwtb43d#4mGbDKs`6C)#wJnEzqO>zJ;> VNjzo_*}|ef1gs2dRDr*$z%Rak8D; x \ No newline at end of file diff --git a/scripts/testScripts/essence_testing_data/test.param b/scripts/testScripts/essence_testing_data/test.param new file mode 100644 index 00000000..a063dcc8 --- /dev/null +++ b/scripts/testScripts/essence_testing_data/test.param @@ -0,0 +1 @@ +letting x be 5 \ No newline at end of file diff --git a/scripts/testScripts/pr_tests/maccGradedFullGen b/scripts/testScripts/pr_tests/maccGradedFullGen new file mode 100644 index 00000000..c817f56c --- /dev/null +++ b/scripts/testScripts/pr_tests/maccGradedFullGen @@ -0,0 +1,8 @@ +#!/bin/bash + +# avoids having an error if directory already exists +mkdir -p "$AUTOIG/experiments/macc-graded" +cd "$AUTOIG/experiments/macc-graded" +python3 "$AUTOIG/scripts/setup.py" --generatorModel "$AUTOIG/data/models/macc/generator.essence" --problemModel "$AUTOIG/data/models/macc/problem.mzn" --instanceSetting graded --minSolverTime 0 --maxSolverTime 5 --solver chuffed --solverFlags="-f" --maxEvaluations 180 --genSolverTimeLimit 3 + +bash "$AUTOIG/experiments/macc-graded/run.sh" diff --git a/scripts/testScripts/test.sh b/scripts/testScripts/test.sh new file mode 100644 index 00000000..5bb013c6 --- /dev/null +++ b/scripts/testScripts/test.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +echo "reached the test.sh script" + +exit 0 # exit successful diff --git a/scripts/testScripts/testreadme.md b/scripts/testScripts/testreadme.md new file mode 100644 index 00000000..62bbe692 --- /dev/null +++ b/scripts/testScripts/testreadme.md @@ -0,0 +1,23 @@ +# Description + +This is a directory which contains scripts to test various AutoIG runs using regex to test output + +To run this, put the commands to navigate to the AutoIG experiment directory, setup the project, and run it. See the general README for further instructions on running. + +The script will automatically scan the standard output, then output weather the output of each file contained the desired lines specified within the script. The lines need to exist independently in the output, not be sequential. + +After all tests are run, the script also outputs the number of passed tests / the number of failed tests, as well as time taken to run all of them. + +This is one of the same test script which will eventuall be integrated into the automated CI pipeline in GitHub, but can also be used manually. + +An example contents of a test may look like: + +## Within tests/macc-graded: + +`cd "AutoIG/experiments/macc-graded"` + +`python3 "\$AUTOIG/scripts/setup.py --generatorModel \$AUTOIG/data/models/macc/generator-small.essence --problemModel \$AUTOIG/data/models/macc/problem.mzn --instanceSetting graded --minSolverTime 0 --maxSolverTime 5 --solver chuffed --solverFlags=\"-f\" --maxEvaluations 180 --genSolverTimeLimit 5"` + +`bash "run.sh"` + +`cd "../.."` diff --git a/scripts/testScripts/tests/chuffed-maccGradedSmallGen.sh b/scripts/testScripts/tests/chuffed-maccGradedSmallGen.sh new file mode 100644 index 00000000..c59ce158 --- /dev/null +++ b/scripts/testScripts/tests/chuffed-maccGradedSmallGen.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# avoids having an error if directory already exists +echo "the variable is: " +ls +echo $AUTOIG +mkdir -p "$AUTOIG/experiments/macc-graded-small-gen" +cd "$AUTOIG/experiments/macc-graded-small-gen" +python3 "$AUTOIG/scripts/setup.py" --generatorModel "$AUTOIG/data/models/macc/generator-small.essence" --problemModel "$AUTOIG/data/models/macc/problem.mzn" --instanceSetting graded --minSolverTime 0 --maxSolverTime 5 --solver chuffed --solverFlags="-f" --maxEvaluations 180 --genSolverTimeLimit 3 + +bash "$AUTOIG/experiments/macc-graded-small-gen/run.sh" diff --git a/scripts/testScripts/tests/cpsat-maccGradedSmallGen.sh b/scripts/testScripts/tests/cpsat-maccGradedSmallGen.sh new file mode 100644 index 00000000..7f3280c7 --- /dev/null +++ b/scripts/testScripts/tests/cpsat-maccGradedSmallGen.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# avoids having an error if directory already exists +echo "the variable is: " +ls +echo $AUTOIG +mkdir -p "$AUTOIG/experiments/macc-graded-small-gen" +cd "$AUTOIG/experiments/macc-graded-small-gen" +python3 "$AUTOIG/scripts/setup.py" --generatorModel "$AUTOIG/data/models/macc/generator-small.essence" --problemModel "$AUTOIG/data/models/macc/problem.mzn" --instanceSetting graded --minSolverTime 0 --maxSolverTime 5 --solver cpsat --solverFlags="-f" --maxEvaluations 180 --genSolverTimeLimit 3 + +bash "$AUTOIG/experiments/macc-graded-small-gen/run.sh" diff --git a/scripts/testScripts/tests/gecode-maccGradedSmallGen.sh b/scripts/testScripts/tests/gecode-maccGradedSmallGen.sh new file mode 100644 index 00000000..c43f9209 --- /dev/null +++ b/scripts/testScripts/tests/gecode-maccGradedSmallGen.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# avoids having an error if directory already exists +echo "the variable is: " +ls +echo $AUTOIG +mkdir -p "$AUTOIG/experiments/macc-graded-small-gen" +cd "$AUTOIG/experiments/macc-graded-small-gen" +python3 "$AUTOIG/scripts/setup.py" --generatorModel "$AUTOIG/data/models/macc/generator-small.essence" --problemModel "$AUTOIG/data/models/macc/problem.mzn" --instanceSetting graded --minSolverTime 0 --maxSolverTime 5 --solver gecode --solverFlags="-f" --maxEvaluations 180 --genSolverTimeLimit 3 + +bash "$AUTOIG/experiments/macc-graded-small-gen/run.sh" diff --git a/scripts/testScripts/tests/picat-maccGradedSmallGen.sh b/scripts/testScripts/tests/picat-maccGradedSmallGen.sh new file mode 100644 index 00000000..11241962 --- /dev/null +++ b/scripts/testScripts/tests/picat-maccGradedSmallGen.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# avoids having an error if directory already exists +echo "the variable is: " +ls +echo $AUTOIG +mkdir -p "$AUTOIG/experiments/macc-graded-small-gen" +cd "$AUTOIG/experiments/macc-graded-small-gen" +python3 "$AUTOIG/scripts/setup.py" --generatorModel "$AUTOIG/data/models/macc/generator-small.essence" --problemModel "$AUTOIG/data/models/macc/problem.mzn" --instanceSetting graded --minSolverTime 0 --maxSolverTime 5 --solver picat --solverFlags="-f" --maxEvaluations 180 --genSolverTimeLimit 3 + +bash "$AUTOIG/experiments/macc-graded-small-gen/run.sh" diff --git a/scripts/testScripts/tests/yuck-maccGradedSmallGen.sh b/scripts/testScripts/tests/yuck-maccGradedSmallGen.sh new file mode 100644 index 00000000..d519f224 --- /dev/null +++ b/scripts/testScripts/tests/yuck-maccGradedSmallGen.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# avoids having an error if directory already exists +echo "the variable is: " +ls +echo $AUTOIG +mkdir -p "$AUTOIG/experiments/macc-graded-small-gen" +cd "$AUTOIG/experiments/macc-graded-small-gen" +python3 "$AUTOIG/scripts/setup.py" --generatorModel "$AUTOIG/data/models/macc/generator-small.essence" --problemModel "$AUTOIG/data/models/macc/problem.mzn" --instanceSetting graded --minSolverTime 0 --maxSolverTime 5 --solver yuck --solverFlags="-f" --maxEvaluations 180 --genSolverTimeLimit 3 + +bash "$AUTOIG/experiments/macc-graded-small-gen/run.sh" From 1e3880214359d341bf7c1a5c54e6801090537012 Mon Sep 17 00:00:00 2001 From: vincepick Date: Thu, 19 Dec 2024 13:52:10 +0000 Subject: [PATCH 071/100] test: deleted old test scripts folder --- scripts/testScript/conjure_solve-tests/model-test.solution | 3 --- scripts/testScript/conjure_solve-tests/model.essence | 4 ---- scripts/testScript/conjure_solve-tests/test.param | 1 - 3 files changed, 8 deletions(-) delete mode 100644 scripts/testScript/conjure_solve-tests/model-test.solution delete mode 100644 scripts/testScript/conjure_solve-tests/model.essence delete mode 100644 scripts/testScript/conjure_solve-tests/test.param diff --git a/scripts/testScript/conjure_solve-tests/model-test.solution b/scripts/testScript/conjure_solve-tests/model-test.solution deleted file mode 100644 index 4b01251b..00000000 --- a/scripts/testScript/conjure_solve-tests/model-test.solution +++ /dev/null @@ -1,3 +0,0 @@ -language Essence 1.3 - -letting y be 6 \ No newline at end of file diff --git a/scripts/testScript/conjure_solve-tests/model.essence b/scripts/testScript/conjure_solve-tests/model.essence deleted file mode 100644 index 9bdd5792..00000000 --- a/scripts/testScript/conjure_solve-tests/model.essence +++ /dev/null @@ -1,4 +0,0 @@ -given x: int(1..10) -find y: int(1..10) -such that - y > x \ No newline at end of file diff --git a/scripts/testScript/conjure_solve-tests/test.param b/scripts/testScript/conjure_solve-tests/test.param deleted file mode 100644 index a063dcc8..00000000 --- a/scripts/testScript/conjure_solve-tests/test.param +++ /dev/null @@ -1 +0,0 @@ -letting x be 5 \ No newline at end of file From 3a8b0dcf039a4454aa95982871dc2827a112d0d1 Mon Sep 17 00:00:00 2001 From: vincepick Date: Thu, 19 Dec 2024 13:52:47 +0000 Subject: [PATCH 072/100] test: fully deleted --- scripts/testScript/check.sh | 55 ------------------ scripts/testScript/check_pr.sh | 56 ------------------- scripts/testScript/pr_tests/maccGradedFullGen | 8 --- scripts/testScript/test.sh | 5 -- scripts/testScript/testreadme.md | 23 -------- .../tests/chuffed-maccGradedSmallGen.sh | 11 ---- .../tests/cpsat-maccGradedSmallGen.sh | 11 ---- .../tests/gecode-maccGradedSmallGen.sh | 11 ---- .../tests/picat-maccGradedSmallGen.sh | 11 ---- .../tests/yuck-maccGradedSmallGen.sh | 11 ---- 10 files changed, 202 deletions(-) delete mode 100644 scripts/testScript/check.sh delete mode 100644 scripts/testScript/check_pr.sh delete mode 100644 scripts/testScript/pr_tests/maccGradedFullGen delete mode 100644 scripts/testScript/test.sh delete mode 100644 scripts/testScript/testreadme.md delete mode 100644 scripts/testScript/tests/chuffed-maccGradedSmallGen.sh delete mode 100644 scripts/testScript/tests/cpsat-maccGradedSmallGen.sh delete mode 100644 scripts/testScript/tests/gecode-maccGradedSmallGen.sh delete mode 100644 scripts/testScript/tests/picat-maccGradedSmallGen.sh delete mode 100644 scripts/testScript/tests/yuck-maccGradedSmallGen.sh diff --git a/scripts/testScript/check.sh b/scripts/testScript/check.sh deleted file mode 100644 index ebfcc7cc..00000000 --- a/scripts/testScript/check.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash - -# Runs all scripts put in ./tests and makes sure that the run at some point contains a provided line: - -# Lines being checked for -lines=( - "# Best configurations (first number is the configuration ID; listed from best to worst according to the sum of ranks):" - "# Best configurations as commandlines (first number is the configuration ID; same order as above):" -) - -testsPassed=0 -testsRun=0 - -start=$(date +%s) - -# Loop through each script in the tests directory -for file in tests/*; do - ((testsRun++)) - # Check if file - if [[ -f "$file" ]]; then - - # Run contents of file - output=$(bash "$file") - all_lines_found=true - - # Check for each line in the array - for line in "${lines[@]}"; do - if [[ "$output" != *"$line"* ]]; then - all_lines_found=false - echo "Test $testsRun: $file failed, line not found: $line" - fi - done - - # If all lines are found, count as passed - if $all_lines_found; then - echo "Test $testsRun: $file passed, all lines found in output" - ((testsPassed++)) - fi - fi - # Record end time and calculate elapsed time - end=$(date +%s) - elapsedTime=$((end - start)) - - # Display time elapsed - echo "Time elapsed: $elapsedTime seconds" -done - -# Final results -if [[ "$testsRun" -eq "$testsPassed" ]]; then - printf "\e[32mAll tests passed: %d/%d! :D\e[0m\n" "$testsPassed" "$testsRun" - exit 0 -else - printf "\e[31mSome cases failing, only %d/%d passed.\e[0m\n" "$testsPassed" "$testsRun" - exit 1 -fi diff --git a/scripts/testScript/check_pr.sh b/scripts/testScript/check_pr.sh deleted file mode 100644 index 81858690..00000000 --- a/scripts/testScript/check_pr.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash - -# Runs all scripts put in ./tests and makes sure that the run at some point contains a provided line: - -# Lines being checked for -lines=( - "# Best configurations (first number is the configuration ID; listed from best to worst according to the sum of ranks):" - "# Best configurations as commandlines (first number is the configuration ID; same order as above):" -) - -testsPassed=0 -testsRun=0 - -start=$(date +%s) - -# Loop through each script in the tests directory -for file in pr_tests/*; do - ((testsRun++)) - # Check if file - if [[ -f "$file" ]]; then - - # Run contents of file - output=$(bash "$file") - all_lines_found=true - - # Check for each line in the array - for line in "${lines[@]}"; do - if [[ "$output" != *"$line"* ]]; then - all_lines_found=false - echo "Test $testsRun: $file failed, line not found: $line" - fi - done - - # If all lines are found, count as passed - if $all_lines_found; then - echo "Test $testsRun: $file passed, all lines found in output" - ((testsPassed++)) - fi - fi -done - -# Final results -if [[ "$testsRun" -eq "$testsPassed" ]]; then - printf "\e[32mAll tests passed: %d/%d! :D\e[0m\n" "$testsPassed" "$testsRun" - exit 0 -else - printf "\e[31mSome cases failing, only %d/%d passed.\e[0m\n" "$testsPassed" "$testsRun" - exit 1 -fi - -# Record end time and calculate elapsed time -end=$(date +%s) -elapsedTime=$((end - start)) - -# Display time elapsed -echo "Time elapsed: $elapsedTime seconds" diff --git a/scripts/testScript/pr_tests/maccGradedFullGen b/scripts/testScript/pr_tests/maccGradedFullGen deleted file mode 100644 index c817f56c..00000000 --- a/scripts/testScript/pr_tests/maccGradedFullGen +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -# avoids having an error if directory already exists -mkdir -p "$AUTOIG/experiments/macc-graded" -cd "$AUTOIG/experiments/macc-graded" -python3 "$AUTOIG/scripts/setup.py" --generatorModel "$AUTOIG/data/models/macc/generator.essence" --problemModel "$AUTOIG/data/models/macc/problem.mzn" --instanceSetting graded --minSolverTime 0 --maxSolverTime 5 --solver chuffed --solverFlags="-f" --maxEvaluations 180 --genSolverTimeLimit 3 - -bash "$AUTOIG/experiments/macc-graded/run.sh" diff --git a/scripts/testScript/test.sh b/scripts/testScript/test.sh deleted file mode 100644 index 5bb013c6..00000000 --- a/scripts/testScript/test.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -echo "reached the test.sh script" - -exit 0 # exit successful diff --git a/scripts/testScript/testreadme.md b/scripts/testScript/testreadme.md deleted file mode 100644 index 62bbe692..00000000 --- a/scripts/testScript/testreadme.md +++ /dev/null @@ -1,23 +0,0 @@ -# Description - -This is a directory which contains scripts to test various AutoIG runs using regex to test output - -To run this, put the commands to navigate to the AutoIG experiment directory, setup the project, and run it. See the general README for further instructions on running. - -The script will automatically scan the standard output, then output weather the output of each file contained the desired lines specified within the script. The lines need to exist independently in the output, not be sequential. - -After all tests are run, the script also outputs the number of passed tests / the number of failed tests, as well as time taken to run all of them. - -This is one of the same test script which will eventuall be integrated into the automated CI pipeline in GitHub, but can also be used manually. - -An example contents of a test may look like: - -## Within tests/macc-graded: - -`cd "AutoIG/experiments/macc-graded"` - -`python3 "\$AUTOIG/scripts/setup.py --generatorModel \$AUTOIG/data/models/macc/generator-small.essence --problemModel \$AUTOIG/data/models/macc/problem.mzn --instanceSetting graded --minSolverTime 0 --maxSolverTime 5 --solver chuffed --solverFlags=\"-f\" --maxEvaluations 180 --genSolverTimeLimit 5"` - -`bash "run.sh"` - -`cd "../.."` diff --git a/scripts/testScript/tests/chuffed-maccGradedSmallGen.sh b/scripts/testScript/tests/chuffed-maccGradedSmallGen.sh deleted file mode 100644 index c59ce158..00000000 --- a/scripts/testScript/tests/chuffed-maccGradedSmallGen.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -# avoids having an error if directory already exists -echo "the variable is: " -ls -echo $AUTOIG -mkdir -p "$AUTOIG/experiments/macc-graded-small-gen" -cd "$AUTOIG/experiments/macc-graded-small-gen" -python3 "$AUTOIG/scripts/setup.py" --generatorModel "$AUTOIG/data/models/macc/generator-small.essence" --problemModel "$AUTOIG/data/models/macc/problem.mzn" --instanceSetting graded --minSolverTime 0 --maxSolverTime 5 --solver chuffed --solverFlags="-f" --maxEvaluations 180 --genSolverTimeLimit 3 - -bash "$AUTOIG/experiments/macc-graded-small-gen/run.sh" diff --git a/scripts/testScript/tests/cpsat-maccGradedSmallGen.sh b/scripts/testScript/tests/cpsat-maccGradedSmallGen.sh deleted file mode 100644 index 7f3280c7..00000000 --- a/scripts/testScript/tests/cpsat-maccGradedSmallGen.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -# avoids having an error if directory already exists -echo "the variable is: " -ls -echo $AUTOIG -mkdir -p "$AUTOIG/experiments/macc-graded-small-gen" -cd "$AUTOIG/experiments/macc-graded-small-gen" -python3 "$AUTOIG/scripts/setup.py" --generatorModel "$AUTOIG/data/models/macc/generator-small.essence" --problemModel "$AUTOIG/data/models/macc/problem.mzn" --instanceSetting graded --minSolverTime 0 --maxSolverTime 5 --solver cpsat --solverFlags="-f" --maxEvaluations 180 --genSolverTimeLimit 3 - -bash "$AUTOIG/experiments/macc-graded-small-gen/run.sh" diff --git a/scripts/testScript/tests/gecode-maccGradedSmallGen.sh b/scripts/testScript/tests/gecode-maccGradedSmallGen.sh deleted file mode 100644 index c43f9209..00000000 --- a/scripts/testScript/tests/gecode-maccGradedSmallGen.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -# avoids having an error if directory already exists -echo "the variable is: " -ls -echo $AUTOIG -mkdir -p "$AUTOIG/experiments/macc-graded-small-gen" -cd "$AUTOIG/experiments/macc-graded-small-gen" -python3 "$AUTOIG/scripts/setup.py" --generatorModel "$AUTOIG/data/models/macc/generator-small.essence" --problemModel "$AUTOIG/data/models/macc/problem.mzn" --instanceSetting graded --minSolverTime 0 --maxSolverTime 5 --solver gecode --solverFlags="-f" --maxEvaluations 180 --genSolverTimeLimit 3 - -bash "$AUTOIG/experiments/macc-graded-small-gen/run.sh" diff --git a/scripts/testScript/tests/picat-maccGradedSmallGen.sh b/scripts/testScript/tests/picat-maccGradedSmallGen.sh deleted file mode 100644 index 11241962..00000000 --- a/scripts/testScript/tests/picat-maccGradedSmallGen.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -# avoids having an error if directory already exists -echo "the variable is: " -ls -echo $AUTOIG -mkdir -p "$AUTOIG/experiments/macc-graded-small-gen" -cd "$AUTOIG/experiments/macc-graded-small-gen" -python3 "$AUTOIG/scripts/setup.py" --generatorModel "$AUTOIG/data/models/macc/generator-small.essence" --problemModel "$AUTOIG/data/models/macc/problem.mzn" --instanceSetting graded --minSolverTime 0 --maxSolverTime 5 --solver picat --solverFlags="-f" --maxEvaluations 180 --genSolverTimeLimit 3 - -bash "$AUTOIG/experiments/macc-graded-small-gen/run.sh" diff --git a/scripts/testScript/tests/yuck-maccGradedSmallGen.sh b/scripts/testScript/tests/yuck-maccGradedSmallGen.sh deleted file mode 100644 index d519f224..00000000 --- a/scripts/testScript/tests/yuck-maccGradedSmallGen.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -# avoids having an error if directory already exists -echo "the variable is: " -ls -echo $AUTOIG -mkdir -p "$AUTOIG/experiments/macc-graded-small-gen" -cd "$AUTOIG/experiments/macc-graded-small-gen" -python3 "$AUTOIG/scripts/setup.py" --generatorModel "$AUTOIG/data/models/macc/generator-small.essence" --problemModel "$AUTOIG/data/models/macc/problem.mzn" --instanceSetting graded --minSolverTime 0 --maxSolverTime 5 --solver yuck --solverFlags="-f" --maxEvaluations 180 --genSolverTimeLimit 3 - -bash "$AUTOIG/experiments/macc-graded-small-gen/run.sh" From 3c2383190a119f2e61dee11ece8d3bf2c8c90eca Mon Sep 17 00:00:00 2001 From: vincepick Date: Thu, 19 Dec 2024 13:57:54 +0000 Subject: [PATCH 073/100] fix: added debug statement to check chuffed --- scripts/testScripts/conjure_solve-tests/check_chuffed.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/testScripts/conjure_solve-tests/check_chuffed.sh b/scripts/testScripts/conjure_solve-tests/check_chuffed.sh index ba2ecbd2..00862d30 100644 --- a/scripts/testScripts/conjure_solve-tests/check_chuffed.sh +++ b/scripts/testScripts/conjure_solve-tests/check_chuffed.sh @@ -1,3 +1,4 @@ #!/bin/bash DATA_DIR=../essence_testing_data +echo ls $DATA_DIR conjure solve model.essence test.param --solver=chuffed From 4c5cf1434752941e39922d5341c0323ac1ce259d Mon Sep 17 00:00:00 2001 From: vincepick Date: Thu, 19 Dec 2024 14:00:11 +0000 Subject: [PATCH 074/100] fix: updated debug statement --- scripts/testScripts/conjure_solve-tests/check_chuffed.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/testScripts/conjure_solve-tests/check_chuffed.sh b/scripts/testScripts/conjure_solve-tests/check_chuffed.sh index 00862d30..c6a6876a 100644 --- a/scripts/testScripts/conjure_solve-tests/check_chuffed.sh +++ b/scripts/testScripts/conjure_solve-tests/check_chuffed.sh @@ -1,4 +1,4 @@ #!/bin/bash DATA_DIR=../essence_testing_data -echo ls $DATA_DIR +ls $DATA_DIR conjure solve model.essence test.param --solver=chuffed From ceea7de7e2eb866a7a2f148293be59c0e4c867cc Mon Sep 17 00:00:00 2001 From: vincepick Date: Thu, 19 Dec 2024 14:03:05 +0000 Subject: [PATCH 075/100] test: updated checker for chuffed with Conjure --- scripts/testScripts/conjure_solve-tests/check_chuffed.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/testScripts/conjure_solve-tests/check_chuffed.sh b/scripts/testScripts/conjure_solve-tests/check_chuffed.sh index c6a6876a..f6c266c8 100644 --- a/scripts/testScripts/conjure_solve-tests/check_chuffed.sh +++ b/scripts/testScripts/conjure_solve-tests/check_chuffed.sh @@ -1,4 +1,4 @@ #!/bin/bash DATA_DIR=../essence_testing_data ls $DATA_DIR -conjure solve model.essence test.param --solver=chuffed +conjure solve $DATA_DIR/model.essence $DATA_DIR/test.param --solver=chuffed From c9dc039a4cb2c4621549dffc084a9fe4c48db398 Mon Sep 17 00:00:00 2001 From: vincepick Date: Thu, 19 Dec 2024 14:05:24 +0000 Subject: [PATCH 076/100] test: updated check conjure script --- scripts/testScripts/check_conjure.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/testScripts/check_conjure.sh b/scripts/testScripts/check_conjure.sh index bc4e5c7a..9df85c2d 100644 --- a/scripts/testScripts/check_conjure.sh +++ b/scripts/testScripts/check_conjure.sh @@ -4,7 +4,7 @@ # Lines being checked for lines=( - "Copying solution to: model-test.solution" + "Copying solution to:" ) testsPassed=0 From 97aedbb6bd96fdd4e2007182f7848f1904aa9405 Mon Sep 17 00:00:00 2001 From: vincepick Date: Thu, 19 Dec 2024 14:06:53 +0000 Subject: [PATCH 077/100] fix: updated scripts for checking chuffed and ortools --- scripts/testScripts/conjure_solve-tests/check_chuffed.sh | 2 +- scripts/testScripts/conjure_solve-tests/or-tools.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/testScripts/conjure_solve-tests/check_chuffed.sh b/scripts/testScripts/conjure_solve-tests/check_chuffed.sh index f6c266c8..ad98a42e 100644 --- a/scripts/testScripts/conjure_solve-tests/check_chuffed.sh +++ b/scripts/testScripts/conjure_solve-tests/check_chuffed.sh @@ -1,4 +1,4 @@ #!/bin/bash -DATA_DIR=../essence_testing_data +DATA_DIR=/essence_testing_data ls $DATA_DIR conjure solve $DATA_DIR/model.essence $DATA_DIR/test.param --solver=chuffed diff --git a/scripts/testScripts/conjure_solve-tests/or-tools.sh b/scripts/testScripts/conjure_solve-tests/or-tools.sh index 67341ce3..ac3ef415 100644 --- a/scripts/testScripts/conjure_solve-tests/or-tools.sh +++ b/scripts/testScripts/conjure_solve-tests/or-tools.sh @@ -1,3 +1,3 @@ #!/bin/bash -DATA_DIR=../essence_testing_data +DATA_DIR=/essence_testing_data conjure solve $DATA_DIR/model.essence $DATA_DIR/test.param --solver=or-tools From 240720c46d76bb47c8799f6cc326edd9cc36beb2 Mon Sep 17 00:00:00 2001 From: vincepick Date: Thu, 19 Dec 2024 14:38:41 +0000 Subject: [PATCH 078/100] test: update test scripts again --- scripts/testScripts/conjure_solve-tests/check_chuffed.sh | 3 ++- scripts/testScripts/conjure_solve-tests/or-tools.sh | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/testScripts/conjure_solve-tests/check_chuffed.sh b/scripts/testScripts/conjure_solve-tests/check_chuffed.sh index ad98a42e..289504f6 100644 --- a/scripts/testScripts/conjure_solve-tests/check_chuffed.sh +++ b/scripts/testScripts/conjure_solve-tests/check_chuffed.sh @@ -1,4 +1,5 @@ #!/bin/bash -DATA_DIR=/essence_testing_data +DATA_DIR=essence_testing_data ls $DATA_DIR conjure solve $DATA_DIR/model.essence $DATA_DIR/test.param --solver=chuffed +rm -r conjure_solve-tests/conjure-output diff --git a/scripts/testScripts/conjure_solve-tests/or-tools.sh b/scripts/testScripts/conjure_solve-tests/or-tools.sh index ac3ef415..9531f10c 100644 --- a/scripts/testScripts/conjure_solve-tests/or-tools.sh +++ b/scripts/testScripts/conjure_solve-tests/or-tools.sh @@ -1,3 +1,4 @@ #!/bin/bash -DATA_DIR=/essence_testing_data +DATA_DIR=essence_testing_data conjure solve $DATA_DIR/model.essence $DATA_DIR/test.param --solver=or-tools +rm -r conjure_solve-tests/conjure-output From a3400fd3f1ba8c3a1eede4a451743554d1f9699c Mon Sep 17 00:00:00 2001 From: vincepick Date: Thu, 19 Dec 2024 14:38:56 +0000 Subject: [PATCH 079/100] test: update test scripts again --- scripts/testScripts/conjure_solve-tests/check_chuffed.sh | 1 + scripts/testScripts/conjure_solve-tests/or-tools.sh | 1 + 2 files changed, 2 insertions(+) diff --git a/scripts/testScripts/conjure_solve-tests/check_chuffed.sh b/scripts/testScripts/conjure_solve-tests/check_chuffed.sh index 289504f6..d60a8bfb 100644 --- a/scripts/testScripts/conjure_solve-tests/check_chuffed.sh +++ b/scripts/testScripts/conjure_solve-tests/check_chuffed.sh @@ -1,5 +1,6 @@ #!/bin/bash DATA_DIR=essence_testing_data +ls ls $DATA_DIR conjure solve $DATA_DIR/model.essence $DATA_DIR/test.param --solver=chuffed rm -r conjure_solve-tests/conjure-output diff --git a/scripts/testScripts/conjure_solve-tests/or-tools.sh b/scripts/testScripts/conjure_solve-tests/or-tools.sh index 9531f10c..62d30e33 100644 --- a/scripts/testScripts/conjure_solve-tests/or-tools.sh +++ b/scripts/testScripts/conjure_solve-tests/or-tools.sh @@ -1,4 +1,5 @@ #!/bin/bash DATA_DIR=essence_testing_data +ls conjure solve $DATA_DIR/model.essence $DATA_DIR/test.param --solver=or-tools rm -r conjure_solve-tests/conjure-output From caf231a9db6d19c3c0f871342ef72ee7c7acc5ea Mon Sep 17 00:00:00 2001 From: vincepick Date: Thu, 19 Dec 2024 14:42:27 +0000 Subject: [PATCH 080/100] docs: updated test scripts --- .github/workflows/run_tests.yml | 10 ++++++++++ scripts/testScripts/check_pr.sh | 4 +++- scripts/testScripts/{check.sh => check_push.sh} | 4 +++- 3 files changed, 16 insertions(+), 2 deletions(-) rename scripts/testScripts/{check.sh => check_push.sh} (92%) diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 00579f2e..f09c9598 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -86,6 +86,16 @@ jobs: echo "Running basic tests for Push" bash check.sh + - name: Run Push Tests + if: github.event_name == 'push' + run: | + cd AutoIG + . bin/set-path.sh + AUTOIG=$(pwd) + cd $AUTOIG/scripts/testScripts + echo "Running basic tests for Conjure Usage" + bash check_conjure.sh + # Run script for Pull Requests - name: Run Pull Request Tests if: github.event_name == 'pull_request' diff --git a/scripts/testScripts/check_pr.sh b/scripts/testScripts/check_pr.sh index 81858690..c02ffbab 100644 --- a/scripts/testScripts/check_pr.sh +++ b/scripts/testScripts/check_pr.sh @@ -1,6 +1,8 @@ #!/bin/bash -# Runs all scripts put in ./tests and makes sure that the run at some point contains a provided line: +# Runs all scripts put in ./tests and makes sure that the run at some point contains provided lines. + +# This script runs more intensive tests, intended for PRs to main. # Lines being checked for lines=( diff --git a/scripts/testScripts/check.sh b/scripts/testScripts/check_push.sh similarity index 92% rename from scripts/testScripts/check.sh rename to scripts/testScripts/check_push.sh index ebfcc7cc..88cd2711 100644 --- a/scripts/testScripts/check.sh +++ b/scripts/testScripts/check_push.sh @@ -1,6 +1,8 @@ #!/bin/bash -# Runs all scripts put in ./tests and makes sure that the run at some point contains a provided line: +# Runs all scripts put in ./tests and makes sure that the run at some point contains provided lines + +# This script runs less intensive tests, intended for push requests rather than a PR # Lines being checked for lines=( From 6190522f13e5ad7207cf547aee54278dc3fc1d3a Mon Sep 17 00:00:00 2001 From: vincepick Date: Thu, 19 Dec 2024 14:43:13 +0000 Subject: [PATCH 081/100] test: updated testing workflow --- .github/workflows/run_tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index f09c9598..d7f476ed 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -84,7 +84,7 @@ jobs: AUTOIG=$(pwd) cd $AUTOIG/scripts/testScripts echo "Running basic tests for Push" - bash check.sh + bash check_push.sh - name: Run Push Tests if: github.event_name == 'push' @@ -105,7 +105,7 @@ jobs: AUTOIG=$(pwd) cd $AUTOIG/scripts/testScript echo "Running more thorough tests for Pull Request" - bash check.sh + bash check_push.sh bash check_pr.sh # bash check.sh From e5946a13778cf066ae12ced8e39db6fc1405d640 Mon Sep 17 00:00:00 2001 From: vincepick Date: Thu, 19 Dec 2024 14:52:30 +0000 Subject: [PATCH 082/100] fix: updated workflow --- .github/workflows/run_tests.yml | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index d7f476ed..ff145202 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -77,7 +77,7 @@ jobs: # Run script for Push Events - name: Run Push Tests - if: github.event_name == 'push' + if: ${{ github.event_name == 'push' }} run: | cd AutoIG . bin/set-path.sh @@ -86,19 +86,20 @@ jobs: echo "Running basic tests for Push" bash check_push.sh - - name: Run Push Tests - if: github.event_name == 'push' - run: | - cd AutoIG - . bin/set-path.sh - AUTOIG=$(pwd) - cd $AUTOIG/scripts/testScripts - echo "Running basic tests for Conjure Usage" - bash check_conjure.sh + - name: Run Conjure Tests + if: ${{ github.event_name == 'push' }} + run: | + cd AutoIG + . bin/set-path.sh + AUTOIG=$(pwd) + cd $AUTOIG/scripts/testScripts + echo "Running basic tests for Conjure Usage" + bash check_conjure.sh # Run script for Pull Requests - name: Run Pull Request Tests - if: github.event_name == 'pull_request' + + if: ${{ github.event_name == 'pull_request' }} run: | cd AutoIG . bin/set-path.sh From bb1358c201162b9f5539f9128b7d796901bc1d78 Mon Sep 17 00:00:00 2001 From: vincepick Date: Thu, 19 Dec 2024 14:58:20 +0000 Subject: [PATCH 083/100] fix: updated workflow again' --- .github/workflows/run_tests.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index ff145202..5288e130 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -89,12 +89,12 @@ jobs: - name: Run Conjure Tests if: ${{ github.event_name == 'push' }} run: | - cd AutoIG - . bin/set-path.sh - AUTOIG=$(pwd) - cd $AUTOIG/scripts/testScripts - echo "Running basic tests for Conjure Usage" - bash check_conjure.sh + cd AutoIG + . bin/set-path.sh + AUTOIG=$(pwd) + cd $AUTOIG/scripts/testScripts + echo "Running basic tests for Conjure Usage" + bash check_conjure.sh # Run script for Pull Requests - name: Run Pull Request Tests @@ -104,7 +104,7 @@ jobs: cd AutoIG . bin/set-path.sh AUTOIG=$(pwd) - cd $AUTOIG/scripts/testScript + cd $AUTOIG/scripts/testScripts echo "Running more thorough tests for Pull Request" bash check_push.sh bash check_pr.sh From 138aa3bc363d90d44e5ae545d82a8df6d89b299b Mon Sep 17 00:00:00 2001 From: vincepick Date: Thu, 19 Dec 2024 15:03:32 +0000 Subject: [PATCH 084/100] fix: yaml indentation --- .github/workflows/run_tests.yml | 62 ++++++++++++++++----------------- 1 file changed, 30 insertions(+), 32 deletions(-) diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 5288e130..85f00b86 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -1,13 +1,15 @@ +--- name: Run test using container - on: push: branches: - test/maccGradedCase - pull_request: - types: [opened, synchronize, reopened, closed] - + types: + - opened + - synchronize + - reopened + - closed jobs: run-tests: name: Run AutoIG Tests @@ -16,27 +18,15 @@ jobs: run: shell: bash container: - # using the main instead of the previous version for now image: ghcr.io/conjure-cp/conjure:main - - #previous version - #ghcr.io/conjure-cp/conjure@sha256:e959c664d83a08b68a5b31409d56ce82eadf0f0b74f8af1809642b73f652c940 - - # Current version of conjure - # image: ghcr.io/conjure-cp/conjure@sha256:ebff76918718631f099544eed3a808cd16ce8f2c863c8229c7d2e417ba745c56 - steps: - # Checkout repo: checks out current repo (so AutoIG current branch) - name: Checkout code uses: actions/checkout@v4 - - # Clones the current branch being pushed from - # Run same commands as in Docker file, this needs to be updated if there are major updates to Docker later on - # The two should be consistent - name: Run container and execute script - run: | + run: > apt-get update + DEBIAN_FRONTEND=noninteractive apt-get install -y \ bash \ sudo \ @@ -47,35 +37,52 @@ jobs: unzip # Installing Python Dependencies + sudo apt-get install -y python3-pip + apt install python3-pandas -y + apt install python3-numpy -y + sudo apt install python-is-python3 + sudo apt-get install r-base -y + sudo apt-get install git-all -y + # Getting current branch + CURRENT_BRANCH="${{ github.ref_name }}" + git clone -b "$CURRENT_BRANCH" https://github.com/vincepick/AutoIG.git + bash bin/install-savilerow.sh + bash bin/install-mininzinc.sh + bash bin/install-runsolver.sh + bash bin/install-irace.sh + bash bin/install-ortools.sh + bash bin/install-yuck.sh + bash bin/install-picat.sh + ls + echo "Environment made :D, path:" - echo $PATH - # Run script for Push Events + echo $PATH - name: Run Push Tests if: ${{ github.event_name == 'push' }} run: | @@ -85,20 +92,16 @@ jobs: cd $AUTOIG/scripts/testScripts echo "Running basic tests for Push" bash check_push.sh - - - name: Run Conjure Tests - if: ${{ github.event_name == 'push' }} - run: | + - name: Run Conjure Tests + if: ${{ github.event_name == 'push' }} + run: | cd AutoIG . bin/set-path.sh AUTOIG=$(pwd) cd $AUTOIG/scripts/testScripts echo "Running basic tests for Conjure Usage" bash check_conjure.sh - - # Run script for Pull Requests - name: Run Pull Request Tests - if: ${{ github.event_name == 'pull_request' }} run: | cd AutoIG @@ -108,16 +111,11 @@ jobs: echo "Running more thorough tests for Pull Request" bash check_push.sh bash check_pr.sh - - # bash check.sh - # if script fails reject PR - name: Fail if: ${{ failure() }} run: | echo "These tests failed, rejecting PR." exit 1 - - # if script passes approve PR - name: Pass if: ${{ success() }} run: | From b2f247dc9edabce668a51441a17c9be7a4101ea7 Mon Sep 17 00:00:00 2001 From: vincepick Date: Thu, 19 Dec 2024 15:06:27 +0000 Subject: [PATCH 085/100] docs: updated commenting in run_tests workflow --- .github/workflows/run_tests.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 85f00b86..1795185a 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -18,10 +18,20 @@ jobs: run: shell: bash container: + #previous version + #ghcr.io/conjure-cp/conjure@sha256:e959c664d83a08b68a5b31409d56ce82eadf0f0b74f8af1809642b73f652c940 + + # Current version of conjure + # image: ghcr.io/conjure-cp/conjure@sha256:ebff76918718631f099544eed3a808cd16ce8f2c863c8229c7d2e417ba745c56 image: ghcr.io/conjure-cp/conjure:main steps: - name: Checkout code + # Checkout repo: checks out current repo (so AutoIG current branch) + uses: actions/checkout@v4 + # Clones the current branch being pushed from + # Run same commands as in Docker file, this needs to be updated if there are major updates to Docker later on + # The two should be consistent - name: Run container and execute script run: > @@ -83,6 +93,7 @@ jobs: echo "Environment made :D, path:" echo $PATH + # Run script for Push Events - name: Run Push Tests if: ${{ github.event_name == 'push' }} run: | @@ -92,6 +103,8 @@ jobs: cd $AUTOIG/scripts/testScripts echo "Running basic tests for Push" bash check_push.sh + + # Run script for Conjure tsts - name: Run Conjure Tests if: ${{ github.event_name == 'push' }} run: | @@ -101,6 +114,7 @@ jobs: cd $AUTOIG/scripts/testScripts echo "Running basic tests for Conjure Usage" bash check_conjure.sh + # Run script for pull request Events - name: Run Pull Request Tests if: ${{ github.event_name == 'pull_request' }} run: | @@ -111,11 +125,15 @@ jobs: echo "Running more thorough tests for Pull Request" bash check_push.sh bash check_pr.sh + + # If fail, reject - name: Fail if: ${{ failure() }} run: | echo "These tests failed, rejecting PR." exit 1 + + # If pass approve - name: Pass if: ${{ success() }} run: | From 4f6e2415cdd3c6e3f387c6b477c0f4785ab48df3 Mon Sep 17 00:00:00 2001 From: vincepick Date: Thu, 19 Dec 2024 15:44:47 +0000 Subject: [PATCH 086/100] test: added test here from build/update-docker branch --- scripts/testScripts/conjure_solve-tests/kissat.sh | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 scripts/testScripts/conjure_solve-tests/kissat.sh diff --git a/scripts/testScripts/conjure_solve-tests/kissat.sh b/scripts/testScripts/conjure_solve-tests/kissat.sh new file mode 100644 index 00000000..d9a9281d --- /dev/null +++ b/scripts/testScripts/conjure_solve-tests/kissat.sh @@ -0,0 +1,6 @@ +#!/bin/bash +DATA_DIR=essence_testing_data +ls +ls $DATA_DIR +conjure solve $DATA_DIR/model.essence $DATA_DIR/test.param --solver=kissat +rm -r conjure_solve-tests/conjure-output From 9de03f599e3bbc534067f93364485a59c0153e51 Mon Sep 17 00:00:00 2001 From: vincepick Date: Thu, 19 Dec 2024 15:57:54 +0000 Subject: [PATCH 087/100] test: added more tests for other solvers to use full generator model rather than just small generator for macc --- ...maccGradedFullGen => chuffed-maccGradedFullGen.sh} | 9 ++++++--- .../testScripts/pr_tests/cpsat-maccGradedFullGen.sh | 11 +++++++++++ .../testScripts/pr_tests/gecode-maccGradedFullGen.sh | 11 +++++++++++ .../testScripts/pr_tests/picat-maccGradedFullGen.sh | 11 +++++++++++ .../testScripts/pr_tests/yuck-maccGradedFullGen.sh | 11 +++++++++++ 5 files changed, 50 insertions(+), 3 deletions(-) rename scripts/testScripts/pr_tests/{maccGradedFullGen => chuffed-maccGradedFullGen.sh} (66%) create mode 100644 scripts/testScripts/pr_tests/cpsat-maccGradedFullGen.sh create mode 100644 scripts/testScripts/pr_tests/gecode-maccGradedFullGen.sh create mode 100644 scripts/testScripts/pr_tests/picat-maccGradedFullGen.sh create mode 100644 scripts/testScripts/pr_tests/yuck-maccGradedFullGen.sh diff --git a/scripts/testScripts/pr_tests/maccGradedFullGen b/scripts/testScripts/pr_tests/chuffed-maccGradedFullGen.sh similarity index 66% rename from scripts/testScripts/pr_tests/maccGradedFullGen rename to scripts/testScripts/pr_tests/chuffed-maccGradedFullGen.sh index c817f56c..7abbc71c 100644 --- a/scripts/testScripts/pr_tests/maccGradedFullGen +++ b/scripts/testScripts/pr_tests/chuffed-maccGradedFullGen.sh @@ -1,8 +1,11 @@ #!/bin/bash # avoids having an error if directory already exists -mkdir -p "$AUTOIG/experiments/macc-graded" -cd "$AUTOIG/experiments/macc-graded" +echo "the variable is: " +ls +echo $AUTOIG +mkdir -p "$AUTOIG/experiments/macc-graded-gen" +cd "$AUTOIG/experiments/macc-graded-gen" python3 "$AUTOIG/scripts/setup.py" --generatorModel "$AUTOIG/data/models/macc/generator.essence" --problemModel "$AUTOIG/data/models/macc/problem.mzn" --instanceSetting graded --minSolverTime 0 --maxSolverTime 5 --solver chuffed --solverFlags="-f" --maxEvaluations 180 --genSolverTimeLimit 3 -bash "$AUTOIG/experiments/macc-graded/run.sh" +bash "$AUTOIG/experiments/macc-graded-gen/run.sh" diff --git a/scripts/testScripts/pr_tests/cpsat-maccGradedFullGen.sh b/scripts/testScripts/pr_tests/cpsat-maccGradedFullGen.sh new file mode 100644 index 00000000..55e6cbb7 --- /dev/null +++ b/scripts/testScripts/pr_tests/cpsat-maccGradedFullGen.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# avoids having an error if directory already exists +echo "the variable is: " +ls +echo $AUTOIG +mkdir -p "$AUTOIG/experiments/macc-graded-gen" +cd "$AUTOIG/experiments/macc-graded-gen" +python3 "$AUTOIG/scripts/setup.py" --generatorModel "$AUTOIG/data/models/macc/generator.essence" --problemModel "$AUTOIG/data/models/macc/problem.mzn" --instanceSetting graded --minSolverTime 0 --maxSolverTime 5 --solver cpsat --solverFlags="-f" --maxEvaluations 180 --genSolverTimeLimit 3 + +bash "$AUTOIG/experiments/macc-graded-gen/run.sh" diff --git a/scripts/testScripts/pr_tests/gecode-maccGradedFullGen.sh b/scripts/testScripts/pr_tests/gecode-maccGradedFullGen.sh new file mode 100644 index 00000000..298004b9 --- /dev/null +++ b/scripts/testScripts/pr_tests/gecode-maccGradedFullGen.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# avoids having an error if directory already exists +echo "the variable is: " +ls +echo $AUTOIG +mkdir -p "$AUTOIG/experiments/macc-graded-gen" +cd "$AUTOIG/experiments/macc-graded-gen" +python3 "$AUTOIG/scripts/setup.py" --generatorModel "$AUTOIG/data/models/macc/generator.essence" --problemModel "$AUTOIG/data/models/macc/problem.mzn" --instanceSetting graded --minSolverTime 0 --maxSolverTime 5 --solver gecode --solverFlags="-f" --maxEvaluations 180 --genSolverTimeLimit 3 + +bash "$AUTOIG/experiments/macc-graded-gen/run.sh" diff --git a/scripts/testScripts/pr_tests/picat-maccGradedFullGen.sh b/scripts/testScripts/pr_tests/picat-maccGradedFullGen.sh new file mode 100644 index 00000000..5a7976e7 --- /dev/null +++ b/scripts/testScripts/pr_tests/picat-maccGradedFullGen.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# avoids having an error if directory already exists +echo "the variable is: " +ls +echo $AUTOIG +mkdir -p "$AUTOIG/experiments/macc-graded-gen" +cd "$AUTOIG/experiments/macc-graded-gen" +python3 "$AUTOIG/scripts/setup.py" --generatorModel "$AUTOIG/data/models/macc/generator.essence" --problemModel "$AUTOIG/data/models/macc/problem.mzn" --instanceSetting graded --minSolverTime 0 --maxSolverTime 5 --solver picat --solverFlags="-f" --maxEvaluations 180 --genSolverTimeLimit 3 + +bash "$AUTOIG/experiments/macc-graded-gen/run.sh" diff --git a/scripts/testScripts/pr_tests/yuck-maccGradedFullGen.sh b/scripts/testScripts/pr_tests/yuck-maccGradedFullGen.sh new file mode 100644 index 00000000..712fddef --- /dev/null +++ b/scripts/testScripts/pr_tests/yuck-maccGradedFullGen.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# avoids having an error if directory already exists +echo "the variable is: " +ls +echo $AUTOIG +mkdir -p "$AUTOIG/experiments/macc-graded-gen" +cd "$AUTOIG/experiments/macc-graded-gen" +python3 "$AUTOIG/scripts/setup.py" --generatorModel "$AUTOIG/data/models/macc/generator.essence" --problemModel "$AUTOIG/data/models/macc/problem.mzn" --instanceSetting graded --minSolverTime 0 --maxSolverTime 5 --solver yuck --solverFlags="-f" --maxEvaluations 180 --genSolverTimeLimit 3 + +bash "$AUTOIG/experiments/macc-graded-gen/run.sh" From ab9d0f61169f8b02557ebe365e9ada4ae3abb3aa Mon Sep 17 00:00:00 2001 From: vincepick Date: Thu, 19 Dec 2024 16:09:09 +0000 Subject: [PATCH 088/100] test: added tests for discriminating instances for chuffed --- .../testScripts/pr_tests/chuffed-maccDiscriminatingGen.sh | 7 +++++++ .../push_tests/chuffed-maccDiscriminatingGen.sh | 7 +++++++ .../{tests => push_tests}/chuffed-maccGradedSmallGen.sh | 0 .../{tests => push_tests}/cpsat-maccGradedSmallGen.sh | 0 .../{tests => push_tests}/gecode-maccGradedSmallGen.sh | 0 .../{tests => push_tests}/picat-maccGradedSmallGen.sh | 0 .../{tests => push_tests}/yuck-maccGradedSmallGen.sh | 0 7 files changed, 14 insertions(+) create mode 100644 scripts/testScripts/pr_tests/chuffed-maccDiscriminatingGen.sh create mode 100644 scripts/testScripts/push_tests/chuffed-maccDiscriminatingGen.sh rename scripts/testScripts/{tests => push_tests}/chuffed-maccGradedSmallGen.sh (100%) rename scripts/testScripts/{tests => push_tests}/cpsat-maccGradedSmallGen.sh (100%) rename scripts/testScripts/{tests => push_tests}/gecode-maccGradedSmallGen.sh (100%) rename scripts/testScripts/{tests => push_tests}/picat-maccGradedSmallGen.sh (100%) rename scripts/testScripts/{tests => push_tests}/yuck-maccGradedSmallGen.sh (100%) diff --git a/scripts/testScripts/pr_tests/chuffed-maccDiscriminatingGen.sh b/scripts/testScripts/pr_tests/chuffed-maccDiscriminatingGen.sh new file mode 100644 index 00000000..7082b4f5 --- /dev/null +++ b/scripts/testScripts/pr_tests/chuffed-maccDiscriminatingGen.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +echo $AUTOIG +mkdir -p "$AUTOIG/experiments/macc-discrim-gen" +cd "$AUTOIG/experiments/macc-discrim-gen" +python $AUTOIG/scripts/setup.py --generatorModel $AUTOIG/data/models/macc/generator.essence --problemModel $AUTOIG/data/models/macc/problem.mzn --instanceSetting discriminating --minSolverTime 1 --maxSolverTime 3 --baseSolver chuffed --solverFlags="-f" --favouredSolver ortools --favouredSolverFlags="-f" --maxEvaluations 180 --genSolverTimeLimit 5 +bash "$AUTOIG/experiments/macc-discrim-gen/run.sh" diff --git a/scripts/testScripts/push_tests/chuffed-maccDiscriminatingGen.sh b/scripts/testScripts/push_tests/chuffed-maccDiscriminatingGen.sh new file mode 100644 index 00000000..2994a39c --- /dev/null +++ b/scripts/testScripts/push_tests/chuffed-maccDiscriminatingGen.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +echo $AUTOIG +mkdir -p "$AUTOIG/experiments/macc-discrim-small-gen" +cd "$AUTOIG/experiments/macc-discrim-small-gen" +python $AUTOIG/scripts/setup.py --generatorModel $AUTOIG/data/models/macc/generator-small.essence --problemModel $AUTOIG/data/models/macc/problem.mzn --instanceSetting discriminating --minSolverTime 1 --maxSolverTime 3 --baseSolver chuffed --solverFlags="-f" --favouredSolver ortools --favouredSolverFlags="-f" --maxEvaluations 180 --genSolverTimeLimit 5 +bash "$AUTOIG/experiments/macc-discrim-small-gen/run.sh" diff --git a/scripts/testScripts/tests/chuffed-maccGradedSmallGen.sh b/scripts/testScripts/push_tests/chuffed-maccGradedSmallGen.sh similarity index 100% rename from scripts/testScripts/tests/chuffed-maccGradedSmallGen.sh rename to scripts/testScripts/push_tests/chuffed-maccGradedSmallGen.sh diff --git a/scripts/testScripts/tests/cpsat-maccGradedSmallGen.sh b/scripts/testScripts/push_tests/cpsat-maccGradedSmallGen.sh similarity index 100% rename from scripts/testScripts/tests/cpsat-maccGradedSmallGen.sh rename to scripts/testScripts/push_tests/cpsat-maccGradedSmallGen.sh diff --git a/scripts/testScripts/tests/gecode-maccGradedSmallGen.sh b/scripts/testScripts/push_tests/gecode-maccGradedSmallGen.sh similarity index 100% rename from scripts/testScripts/tests/gecode-maccGradedSmallGen.sh rename to scripts/testScripts/push_tests/gecode-maccGradedSmallGen.sh diff --git a/scripts/testScripts/tests/picat-maccGradedSmallGen.sh b/scripts/testScripts/push_tests/picat-maccGradedSmallGen.sh similarity index 100% rename from scripts/testScripts/tests/picat-maccGradedSmallGen.sh rename to scripts/testScripts/push_tests/picat-maccGradedSmallGen.sh diff --git a/scripts/testScripts/tests/yuck-maccGradedSmallGen.sh b/scripts/testScripts/push_tests/yuck-maccGradedSmallGen.sh similarity index 100% rename from scripts/testScripts/tests/yuck-maccGradedSmallGen.sh rename to scripts/testScripts/push_tests/yuck-maccGradedSmallGen.sh From e48103bcda55a9ef7eddc731d4cb5d6febdd559b Mon Sep 17 00:00:00 2001 From: vincepick Date: Thu, 19 Dec 2024 19:03:44 +0000 Subject: [PATCH 089/100] test: updated tests scripts --- scripts/testScripts/.DS_Store | Bin 8196 -> 10244 bytes scripts/testScripts/check_pr.sh | 4 +- scripts/testScripts/check_pr_discrim.sh | 58 +++++++++++++++++ scripts/testScripts/check_push.sh | 4 +- scripts/testScripts/check_push_discrim.sh | 60 ++++++++++++++++++ .../chuffed-maccDiscriminatingGen.sh | 0 .../chuffed-maccGradedFullGen.sh | 0 .../cpsat-maccGradedFullGen.sh | 0 .../gecode-maccGradedFullGen.sh | 0 .../picat-maccGradedFullGen.sh | 0 .../yuck-maccGradedFullGen.sh | 0 .../chuffed-maccDiscriminatingGen.sh | 0 .../chuffed-maccGradedSmallGen.sh | 0 .../cpsat-maccGradedSmallGen.sh | 0 .../gecode-maccGradedSmallGen.sh | 0 .../picat-maccGradedSmallGen.sh | 0 .../yuck-maccGradedSmallGen.sh | 0 scripts/testScripts/test.sh | 5 -- 18 files changed, 124 insertions(+), 7 deletions(-) create mode 100644 scripts/testScripts/check_pr_discrim.sh create mode 100644 scripts/testScripts/check_push_discrim.sh rename scripts/testScripts/{pr_tests => pr_discrim_tests}/chuffed-maccDiscriminatingGen.sh (100%) rename scripts/testScripts/{pr_tests => pr_graded_tests}/chuffed-maccGradedFullGen.sh (100%) rename scripts/testScripts/{pr_tests => pr_graded_tests}/cpsat-maccGradedFullGen.sh (100%) rename scripts/testScripts/{pr_tests => pr_graded_tests}/gecode-maccGradedFullGen.sh (100%) rename scripts/testScripts/{pr_tests => pr_graded_tests}/picat-maccGradedFullGen.sh (100%) rename scripts/testScripts/{pr_tests => pr_graded_tests}/yuck-maccGradedFullGen.sh (100%) rename scripts/testScripts/{push_tests => push_discrim_tests}/chuffed-maccDiscriminatingGen.sh (100%) rename scripts/testScripts/{push_tests => push_graded_tests}/chuffed-maccGradedSmallGen.sh (100%) rename scripts/testScripts/{push_tests => push_graded_tests}/cpsat-maccGradedSmallGen.sh (100%) rename scripts/testScripts/{push_tests => push_graded_tests}/gecode-maccGradedSmallGen.sh (100%) rename scripts/testScripts/{push_tests => push_graded_tests}/picat-maccGradedSmallGen.sh (100%) rename scripts/testScripts/{push_tests => push_graded_tests}/yuck-maccGradedSmallGen.sh (100%) delete mode 100644 scripts/testScripts/test.sh diff --git a/scripts/testScripts/.DS_Store b/scripts/testScripts/.DS_Store index 5d41507f9d29088a4918025aa75365d17ab4e82c..951604e243e5de5342518c9c24918ce0afcd8710 100644 GIT binary patch literal 10244 zcmeHMO>Wab6n;}G5vBYD=(0%O!G@^40GP^DVu#cNv}qD0fw+z^VZq94*l>bgfm?7B zc1V@D0DNy|YR|+rnSz8+^hTO_&iH*Ef8RXMXkLg&9WF-)L=h2nP}%lwp=l_5pKGmb z*`7zR3V5P7)Tf-LFX!2?<}DqffG8jehytR3DDXchfIXW_XUAA+MFCMj6etzo^&vuK z8(Ui#tCtQm`Un8Kjc#3VjdOs;MApXE7RG8Qo@q`G%0iVrVkiU0{fOORV`~dz4V;vL zld>Z#dqPoqbl@WGPAWE5T2Vk0s4Ku{_YMtdN@KLn`TcC3o#7sTPG3;_KXt(s(T?MP zLJN9Zo%$Wr^A*$spfWnA*R%v;Oee?`WHhJuxPC(K(B^1!&K*=wQ4jy@Df7v}@i0pl z{JM6P3LHPplEjXWC8fA{`td6>2}Y0p0=<~JZ@tg2zN>Y~(Vjy;R_#iu8G0u8J)!~n z20mlV$~CYpoP)~o**7HX_%l{AT7&ZWykb5b%jYU8SHIs+@Nw6U zn!i7f>RZz@eU8PQzL~e$vwT+Vem)O9FZaP?$+=7YMTN!O9^N$w=f6LFw{aJU^hk6njfTTJqva^dV}jTk>JyR1T^pU=CDxfb7w z>F4CAXZMyyU!U74hNqk5+FxebtDTZ~mvUL%F1>lT<+Ub-?V}y}d#v8yT_lesMHCPP zL;+Di6c7bAQ-K?XR>b-L7dSq({Qtk159OBaE)@!nGu029MMdiYN zg|QlfMyKOpbvhnDI352Om3{Zwa=~?MZDA~WQ2zO!0bZU>&i}v7LCN_a5xRNj|6fqY Be~JJA delta 240 zcmZn(XmOBWU|?W$DortDU;r^WfEYvza8E20o2aMAD84aZH$S8JWFCPhObquY8wl!5 zmJ{S+ZDSD&(w(d;XbETOPM#si$EYxQxnL>lg6TTCx|0=!tf8z#A*adSB89A_E36Ob zOg<>03}=Z?5*41jT|9%4b@DSYO&~czSd#S<&;hKI-wBEFlqA?3(CIqn2o?wsL=(^x qk=|U*)59#t43q}~32q?a3Ud6$!tczJ`Befr7$II_*c{I@hZz8`Z91I* diff --git a/scripts/testScripts/check_pr.sh b/scripts/testScripts/check_pr.sh index c02ffbab..490e0e28 100644 --- a/scripts/testScripts/check_pr.sh +++ b/scripts/testScripts/check_pr.sh @@ -1,5 +1,7 @@ #!/bin/bash +# Tests for Graded Instance Generation + # Runs all scripts put in ./tests and makes sure that the run at some point contains provided lines. # This script runs more intensive tests, intended for PRs to main. @@ -16,7 +18,7 @@ testsRun=0 start=$(date +%s) # Loop through each script in the tests directory -for file in pr_tests/*; do +for file in pr_graded_tests/*; do ((testsRun++)) # Check if file if [[ -f "$file" ]]; then diff --git a/scripts/testScripts/check_pr_discrim.sh b/scripts/testScripts/check_pr_discrim.sh new file mode 100644 index 00000000..9617966a --- /dev/null +++ b/scripts/testScripts/check_pr_discrim.sh @@ -0,0 +1,58 @@ +#!/bin/bash + +# Tests for Discriminating Instance Generation + +# Runs all scripts put in ./tests and makes sure that the run at some point contains provided lines + +# This script runs less intensive tests, intended for push requests rather than a PR + +# Lines being checked for +lines=( + "too difficult instances for the favoured solver" +) + +testsPassed=0 +testsRun=0 + +start=$(date +%s) + +# Loop through each script in the tests directory +for file in pr_discrim_tests/*; do + ((testsRun++)) + # Check if file + if [[ -f "$file" ]]; then + + # Run contents of file + output=$(bash "$file") + all_lines_found=true + + # Check for each line in the array + for line in "${lines[@]}"; do + if [[ "$output" != *"$line"* ]]; then + all_lines_found=false + echo "Test $testsRun: $file failed, line not found: $line" + fi + done + + # If all lines are found, count as passed + if $all_lines_found; then + echo "Test $testsRun: $file passed, all lines found in output" + ((testsPassed++)) + fi + fi + # Record end time and calculate elapsed time + end=$(date +%s) + elapsedTime=$((end - start)) + + # Display time elapsed + echo "Time elapsed: $elapsedTime seconds" +done + +# Final results +if [[ "$testsRun" -eq "$testsPassed" ]]; then + printf "\e[32mAll tests passed: %d/%d! :D\e[0m\n" "$testsPassed" "$testsRun" + exit 0 +else + printf "\e[31mSome cases failing, only %d/%d passed.\e[0m\n" "$testsPassed" "$testsRun" + exit 1 +fi diff --git a/scripts/testScripts/check_push.sh b/scripts/testScripts/check_push.sh index 88cd2711..dfc40a24 100644 --- a/scripts/testScripts/check_push.sh +++ b/scripts/testScripts/check_push.sh @@ -1,5 +1,7 @@ #!/bin/bash +# Tests for graded instance generation + # Runs all scripts put in ./tests and makes sure that the run at some point contains provided lines # This script runs less intensive tests, intended for push requests rather than a PR @@ -16,7 +18,7 @@ testsRun=0 start=$(date +%s) # Loop through each script in the tests directory -for file in tests/*; do +for file in push_graded_tests/*; do ((testsRun++)) # Check if file if [[ -f "$file" ]]; then diff --git a/scripts/testScripts/check_push_discrim.sh b/scripts/testScripts/check_push_discrim.sh new file mode 100644 index 00000000..97620321 --- /dev/null +++ b/scripts/testScripts/check_push_discrim.sh @@ -0,0 +1,60 @@ +#!/bin/bash + +# Tests for discriminating instance generation + +# Runs all scripts put in ./tests and makes sure that the run at some point contains provided lines + +# This script runs less intensive tests, intended for push requests rather than a PR + +# Lines being checked for +lines=( + "instances where the base solver wins" + "too easy instances for the base solver" + "Info of discriminating instances is saved to" +) + +testsPassed=0 +testsRun=0 + +start=$(date +%s) + +# Loop through each script in the tests directory +for file in push_discrim_tests/*; do + ((testsRun++)) + # Check if file + if [[ -f "$file" ]]; then + + # Run contents of file + output=$(bash "$file") + all_lines_found=true + + # Check for each line in the array + for line in "${lines[@]}"; do + if [[ "$output" != *"$line"* ]]; then + all_lines_found=false + echo "Test $testsRun: $file failed, line not found: $line" + fi + done + + # If all lines are found, count as passed + if $all_lines_found; then + echo "Test $testsRun: $file passed, all lines found in output" + ((testsPassed++)) + fi + fi + # Record end time and calculate elapsed time + end=$(date +%s) + elapsedTime=$((end - start)) + + # Display time elapsed + echo "Time elapsed: $elapsedTime seconds" +done + +# Final results +if [[ "$testsRun" -eq "$testsPassed" ]]; then + printf "\e[32mAll tests passed: %d/%d! :D\e[0m\n" "$testsPassed" "$testsRun" + exit 0 +else + printf "\e[31mSome cases failing, only %d/%d passed.\e[0m\n" "$testsPassed" "$testsRun" + exit 1 +fi diff --git a/scripts/testScripts/pr_tests/chuffed-maccDiscriminatingGen.sh b/scripts/testScripts/pr_discrim_tests/chuffed-maccDiscriminatingGen.sh similarity index 100% rename from scripts/testScripts/pr_tests/chuffed-maccDiscriminatingGen.sh rename to scripts/testScripts/pr_discrim_tests/chuffed-maccDiscriminatingGen.sh diff --git a/scripts/testScripts/pr_tests/chuffed-maccGradedFullGen.sh b/scripts/testScripts/pr_graded_tests/chuffed-maccGradedFullGen.sh similarity index 100% rename from scripts/testScripts/pr_tests/chuffed-maccGradedFullGen.sh rename to scripts/testScripts/pr_graded_tests/chuffed-maccGradedFullGen.sh diff --git a/scripts/testScripts/pr_tests/cpsat-maccGradedFullGen.sh b/scripts/testScripts/pr_graded_tests/cpsat-maccGradedFullGen.sh similarity index 100% rename from scripts/testScripts/pr_tests/cpsat-maccGradedFullGen.sh rename to scripts/testScripts/pr_graded_tests/cpsat-maccGradedFullGen.sh diff --git a/scripts/testScripts/pr_tests/gecode-maccGradedFullGen.sh b/scripts/testScripts/pr_graded_tests/gecode-maccGradedFullGen.sh similarity index 100% rename from scripts/testScripts/pr_tests/gecode-maccGradedFullGen.sh rename to scripts/testScripts/pr_graded_tests/gecode-maccGradedFullGen.sh diff --git a/scripts/testScripts/pr_tests/picat-maccGradedFullGen.sh b/scripts/testScripts/pr_graded_tests/picat-maccGradedFullGen.sh similarity index 100% rename from scripts/testScripts/pr_tests/picat-maccGradedFullGen.sh rename to scripts/testScripts/pr_graded_tests/picat-maccGradedFullGen.sh diff --git a/scripts/testScripts/pr_tests/yuck-maccGradedFullGen.sh b/scripts/testScripts/pr_graded_tests/yuck-maccGradedFullGen.sh similarity index 100% rename from scripts/testScripts/pr_tests/yuck-maccGradedFullGen.sh rename to scripts/testScripts/pr_graded_tests/yuck-maccGradedFullGen.sh diff --git a/scripts/testScripts/push_tests/chuffed-maccDiscriminatingGen.sh b/scripts/testScripts/push_discrim_tests/chuffed-maccDiscriminatingGen.sh similarity index 100% rename from scripts/testScripts/push_tests/chuffed-maccDiscriminatingGen.sh rename to scripts/testScripts/push_discrim_tests/chuffed-maccDiscriminatingGen.sh diff --git a/scripts/testScripts/push_tests/chuffed-maccGradedSmallGen.sh b/scripts/testScripts/push_graded_tests/chuffed-maccGradedSmallGen.sh similarity index 100% rename from scripts/testScripts/push_tests/chuffed-maccGradedSmallGen.sh rename to scripts/testScripts/push_graded_tests/chuffed-maccGradedSmallGen.sh diff --git a/scripts/testScripts/push_tests/cpsat-maccGradedSmallGen.sh b/scripts/testScripts/push_graded_tests/cpsat-maccGradedSmallGen.sh similarity index 100% rename from scripts/testScripts/push_tests/cpsat-maccGradedSmallGen.sh rename to scripts/testScripts/push_graded_tests/cpsat-maccGradedSmallGen.sh diff --git a/scripts/testScripts/push_tests/gecode-maccGradedSmallGen.sh b/scripts/testScripts/push_graded_tests/gecode-maccGradedSmallGen.sh similarity index 100% rename from scripts/testScripts/push_tests/gecode-maccGradedSmallGen.sh rename to scripts/testScripts/push_graded_tests/gecode-maccGradedSmallGen.sh diff --git a/scripts/testScripts/push_tests/picat-maccGradedSmallGen.sh b/scripts/testScripts/push_graded_tests/picat-maccGradedSmallGen.sh similarity index 100% rename from scripts/testScripts/push_tests/picat-maccGradedSmallGen.sh rename to scripts/testScripts/push_graded_tests/picat-maccGradedSmallGen.sh diff --git a/scripts/testScripts/push_tests/yuck-maccGradedSmallGen.sh b/scripts/testScripts/push_graded_tests/yuck-maccGradedSmallGen.sh similarity index 100% rename from scripts/testScripts/push_tests/yuck-maccGradedSmallGen.sh rename to scripts/testScripts/push_graded_tests/yuck-maccGradedSmallGen.sh diff --git a/scripts/testScripts/test.sh b/scripts/testScripts/test.sh deleted file mode 100644 index 5bb013c6..00000000 --- a/scripts/testScripts/test.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -echo "reached the test.sh script" - -exit 0 # exit successful From 86f2175589d4f716c3aa1e6f38d9ba92a9c28985 Mon Sep 17 00:00:00 2001 From: vincepick Date: Thu, 19 Dec 2024 19:05:02 +0000 Subject: [PATCH 090/100] test: updated the testing workflow to correspond with the new test names --- .github/workflows/run_tests.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 1795185a..d8e283e7 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -103,6 +103,7 @@ jobs: cd $AUTOIG/scripts/testScripts echo "Running basic tests for Push" bash check_push.sh + bash check_push_discrim.sh # Run script for Conjure tsts - name: Run Conjure Tests @@ -123,8 +124,8 @@ jobs: AUTOIG=$(pwd) cd $AUTOIG/scripts/testScripts echo "Running more thorough tests for Pull Request" - bash check_push.sh bash check_pr.sh + bash check_pr_discrim.sh # If fail, reject - name: Fail From 5c22b645e18e91f990291145bc48a5d5f2f47e88 Mon Sep 17 00:00:00 2001 From: vincepick Date: Sat, 21 Dec 2024 21:54:57 +0000 Subject: [PATCH 091/100] docs: updated documentation for check_pr --- scripts/testScripts/check_pr.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/testScripts/check_pr.sh b/scripts/testScripts/check_pr.sh index 490e0e28..39b4d612 100644 --- a/scripts/testScripts/check_pr.sh +++ b/scripts/testScripts/check_pr.sh @@ -1,10 +1,12 @@ #!/bin/bash -# Tests for Graded Instance Generation +: <<'COMMENT' + Tests for Graded Instance Generation -# Runs all scripts put in ./tests and makes sure that the run at some point contains provided lines. + Runs all scripts put in ./tests and makes sure that the run contains provided lines. -# This script runs more intensive tests, intended for PRs to main. + This script runs more intensive tests, intended for PRs to main. +COMMENT # Lines being checked for lines=( From f4bbe9a98f1171f4000d4cf458fbbea114542ba5 Mon Sep 17 00:00:00 2001 From: vincepick Date: Sat, 21 Dec 2024 21:59:40 +0000 Subject: [PATCH 092/100] docs: added further comments --- scripts/testScripts/check_conjure.sh | 8 +++++++- scripts/testScripts/check_pr.sh | 2 +- scripts/testScripts/check_pr_discrim.sh | 8 +++++--- scripts/testScripts/check_push.sh | 8 +++++--- scripts/testScripts/check_push_discrim.sh | 8 +++++--- 5 files changed, 23 insertions(+), 11 deletions(-) diff --git a/scripts/testScripts/check_conjure.sh b/scripts/testScripts/check_conjure.sh index 9df85c2d..571a0438 100644 --- a/scripts/testScripts/check_conjure.sh +++ b/scripts/testScripts/check_conjure.sh @@ -1,6 +1,12 @@ #!/bin/bash -# Runs all scripts put in ./tests and makes sure that the run at some point contains a provided line: +. <<'COMMENT' + Tests for calls to conjure_solve() + + Runs all scripts in the conjure_solve-tests directory + + Ensure that conjure is able to recognize the paths to solver binaries inside container environment. +COMMENT # Lines being checked for lines=( diff --git a/scripts/testScripts/check_pr.sh b/scripts/testScripts/check_pr.sh index 39b4d612..d04fb538 100644 --- a/scripts/testScripts/check_pr.sh +++ b/scripts/testScripts/check_pr.sh @@ -3,7 +3,7 @@ : <<'COMMENT' Tests for Graded Instance Generation - Runs all scripts put in ./tests and makes sure that the run contains provided lines. + Runs all scripts put in ./pr_graded_tests and makes sure that the run contains provided lines. This script runs more intensive tests, intended for PRs to main. COMMENT diff --git a/scripts/testScripts/check_pr_discrim.sh b/scripts/testScripts/check_pr_discrim.sh index 9617966a..1d289ac0 100644 --- a/scripts/testScripts/check_pr_discrim.sh +++ b/scripts/testScripts/check_pr_discrim.sh @@ -1,10 +1,12 @@ #!/bin/bash -# Tests for Discriminating Instance Generation +: <<'COMMENT' + Tests for Discriminating Instance Generation -# Runs all scripts put in ./tests and makes sure that the run at some point contains provided lines + Runs all scripts put in ./pr_discrim_tests and makes sure that the run contains provided lines. -# This script runs less intensive tests, intended for push requests rather than a PR + This script runs more intensive tests, intended for PRs to main. +COMMENT # Lines being checked for lines=( diff --git a/scripts/testScripts/check_push.sh b/scripts/testScripts/check_push.sh index dfc40a24..82721cd5 100644 --- a/scripts/testScripts/check_push.sh +++ b/scripts/testScripts/check_push.sh @@ -1,10 +1,12 @@ #!/bin/bash -# Tests for graded instance generation +: <<'COMMENT' + Tests for Graded Instance Generation -# Runs all scripts put in ./tests and makes sure that the run at some point contains provided lines + Runs all scripts put in ./push_graded_tests and makes sure that the run contains provided lines. -# This script runs less intensive tests, intended for push requests rather than a PR + This script runs less intensive tests, intended for pushes to any branch. +COMMENT # Lines being checked for lines=( diff --git a/scripts/testScripts/check_push_discrim.sh b/scripts/testScripts/check_push_discrim.sh index 97620321..036f9519 100644 --- a/scripts/testScripts/check_push_discrim.sh +++ b/scripts/testScripts/check_push_discrim.sh @@ -1,10 +1,12 @@ #!/bin/bash -# Tests for discriminating instance generation +: <<'COMMENT' + Tests for Discriminating Instance Generation -# Runs all scripts put in ./tests and makes sure that the run at some point contains provided lines + Runs all scripts put in ./push_discrim_tests and makes sure that the run contains provided lines. -# This script runs less intensive tests, intended for push requests rather than a PR + This script runs less intensive tests, intended for pushes to any branch. +COMMENT # Lines being checked for lines=( From 6f8d74bbf6c8c6b004407147b0c5ea7d53749c54 Mon Sep 17 00:00:00 2001 From: vincepick Date: Sun, 22 Dec 2024 08:03:30 +0000 Subject: [PATCH 093/100] docs: updated comments and documentation further --- scripts/testScripts/check_conjure.sh | 2 +- scripts/testScripts/check_pr.sh | 6 +++- scripts/testScripts/check_pr_discrim.sh | 8 +++-- scripts/testScripts/check_push.sh | 6 +++- scripts/testScripts/check_push_discrim.sh | 6 +++- .../conjure_solve-tests/check_chuffed.sh | 2 ++ .../testScripts/conjure_solve-tests/kissat.sh | 2 ++ .../conjure_solve-tests/or-tools.sh | 2 ++ .../chuffed-maccDiscriminatingGen.sh | 2 +- .../chuffed-maccGradedFullGen.sh | 5 +-- .../cpsat-maccGradedFullGen.sh | 6 ++-- .../gecode-maccGradedFullGen.sh | 5 +-- .../picat-maccGradedFullGen.sh | 5 +-- .../pr_graded_tests/yuck-maccGradedFullGen.sh | 5 +-- .../chuffed-maccDiscriminatingGen.sh | 2 +- .../chuffed-maccGradedSmallGen.sh | 5 +-- .../cpsat-maccGradedSmallGen.sh | 5 +-- .../gecode-maccGradedSmallGen.sh | 5 +-- .../picat-maccGradedSmallGen.sh | 5 +-- .../yuck-maccGradedSmallGen.sh | 5 +-- scripts/testScripts/testreadme.md | 34 ++++++++++++++----- 21 files changed, 66 insertions(+), 57 deletions(-) diff --git a/scripts/testScripts/check_conjure.sh b/scripts/testScripts/check_conjure.sh index 571a0438..beb7065f 100644 --- a/scripts/testScripts/check_conjure.sh +++ b/scripts/testScripts/check_conjure.sh @@ -3,7 +3,7 @@ . <<'COMMENT' Tests for calls to conjure_solve() - Runs all scripts in the conjure_solve-tests directory + Runs all scripts in the conjure_solve-tests directory, to ensure that Conjure is able to find binaries for solvers: chuffed, kissat, and or-tools Ensure that conjure is able to recognize the paths to solver binaries inside container environment. COMMENT diff --git a/scripts/testScripts/check_pr.sh b/scripts/testScripts/check_pr.sh index d04fb538..805aefaf 100644 --- a/scripts/testScripts/check_pr.sh +++ b/scripts/testScripts/check_pr.sh @@ -5,7 +5,11 @@ Runs all scripts put in ./pr_graded_tests and makes sure that the run contains provided lines. - This script runs more intensive tests, intended for PRs to main. + Each script involves a full run of the macc problem, and each one uses a different solver. + + Solvers tested with include chuffed, cpsat, gecode, picat, and yuck. + + This script runs more intensive tests (macc runs with the full generator), and is intended for PRs to main. COMMENT # Lines being checked for diff --git a/scripts/testScripts/check_pr_discrim.sh b/scripts/testScripts/check_pr_discrim.sh index 1d289ac0..2fdd62b7 100644 --- a/scripts/testScripts/check_pr_discrim.sh +++ b/scripts/testScripts/check_pr_discrim.sh @@ -3,9 +3,13 @@ : <<'COMMENT' Tests for Discriminating Instance Generation - Runs all scripts put in ./pr_discrim_tests and makes sure that the run contains provided lines. + Runs all scripts put in ./pr_discrim_tests and makes sure that the runs contains provided lines. + + Each script involves a full run of the macc problem, and each one uses a different solver. - This script runs more intensive tests, intended for PRs to main. + Solvers tested with include chuffed, cpsat, gecode, picat, and yuck. + + This script runs more intensive tests (macc runs with the full generator), and is intended for PRs to main. COMMENT # Lines being checked for diff --git a/scripts/testScripts/check_push.sh b/scripts/testScripts/check_push.sh index 82721cd5..4a53c6b3 100644 --- a/scripts/testScripts/check_push.sh +++ b/scripts/testScripts/check_push.sh @@ -5,7 +5,11 @@ Runs all scripts put in ./push_graded_tests and makes sure that the run contains provided lines. - This script runs less intensive tests, intended for pushes to any branch. + Each script involves a full run of the macc problem, and each one uses a different solver. + + Solvers tested with include chuffed, cpsat, gecode, picat, and yuck. + + This script runs less intensive tests (macc runs with the small generator), and is intended for pushes to any branch. COMMENT # Lines being checked for diff --git a/scripts/testScripts/check_push_discrim.sh b/scripts/testScripts/check_push_discrim.sh index 036f9519..29415c0e 100644 --- a/scripts/testScripts/check_push_discrim.sh +++ b/scripts/testScripts/check_push_discrim.sh @@ -5,7 +5,11 @@ Runs all scripts put in ./push_discrim_tests and makes sure that the run contains provided lines. - This script runs less intensive tests, intended for pushes to any branch. + Each script involves a full run of the macc problem, and each one uses a different solver. + + Solvers tested with include chuffed, cpsat, gecode, picat, and yuck. + + This script runs less intensive tests (macc runs with the small generator), and is intended for pushes to any branch. COMMENT # Lines being checked for diff --git a/scripts/testScripts/conjure_solve-tests/check_chuffed.sh b/scripts/testScripts/conjure_solve-tests/check_chuffed.sh index d60a8bfb..92a22dec 100644 --- a/scripts/testScripts/conjure_solve-tests/check_chuffed.sh +++ b/scripts/testScripts/conjure_solve-tests/check_chuffed.sh @@ -1,4 +1,6 @@ #!/bin/bash +# This script is used to ensure that the Chuffed solver can be found by Conjure: +# Chuffed binary being searched for is called: fzn-chuffed DATA_DIR=essence_testing_data ls ls $DATA_DIR diff --git a/scripts/testScripts/conjure_solve-tests/kissat.sh b/scripts/testScripts/conjure_solve-tests/kissat.sh index d9a9281d..2fe9c61e 100644 --- a/scripts/testScripts/conjure_solve-tests/kissat.sh +++ b/scripts/testScripts/conjure_solve-tests/kissat.sh @@ -1,4 +1,6 @@ #!/bin/bash +# This script is used to ensure that the kissat solver can be found by Conjure: +# Chuffed binary being searched for is called: kissat DATA_DIR=essence_testing_data ls ls $DATA_DIR diff --git a/scripts/testScripts/conjure_solve-tests/or-tools.sh b/scripts/testScripts/conjure_solve-tests/or-tools.sh index 62d30e33..69a41582 100644 --- a/scripts/testScripts/conjure_solve-tests/or-tools.sh +++ b/scripts/testScripts/conjure_solve-tests/or-tools.sh @@ -1,4 +1,6 @@ #!/bin/bash +# This script is used to ensure that the or-tools solver can be found by Conjure: +# Chuffed binary being searched for is called: fzn-cp-sat DATA_DIR=essence_testing_data ls conjure solve $DATA_DIR/model.essence $DATA_DIR/test.param --solver=or-tools diff --git a/scripts/testScripts/pr_discrim_tests/chuffed-maccDiscriminatingGen.sh b/scripts/testScripts/pr_discrim_tests/chuffed-maccDiscriminatingGen.sh index 7082b4f5..da8af1e5 100644 --- a/scripts/testScripts/pr_discrim_tests/chuffed-maccDiscriminatingGen.sh +++ b/scripts/testScripts/pr_discrim_tests/chuffed-maccDiscriminatingGen.sh @@ -1,5 +1,5 @@ #!/bin/bash - +# Tests discriminating instance generation with Macc problem, using small generator, and basesolver: Chuffed and favouredSolver: ortools. echo $AUTOIG mkdir -p "$AUTOIG/experiments/macc-discrim-gen" cd "$AUTOIG/experiments/macc-discrim-gen" diff --git a/scripts/testScripts/pr_graded_tests/chuffed-maccGradedFullGen.sh b/scripts/testScripts/pr_graded_tests/chuffed-maccGradedFullGen.sh index 7abbc71c..f4b3850b 100644 --- a/scripts/testScripts/pr_graded_tests/chuffed-maccGradedFullGen.sh +++ b/scripts/testScripts/pr_graded_tests/chuffed-maccGradedFullGen.sh @@ -1,9 +1,6 @@ #!/bin/bash -# avoids having an error if directory already exists -echo "the variable is: " -ls -echo $AUTOIG +# Testing graded instance generation for the Macc problem using its full generator with the chuffed solver" mkdir -p "$AUTOIG/experiments/macc-graded-gen" cd "$AUTOIG/experiments/macc-graded-gen" python3 "$AUTOIG/scripts/setup.py" --generatorModel "$AUTOIG/data/models/macc/generator.essence" --problemModel "$AUTOIG/data/models/macc/problem.mzn" --instanceSetting graded --minSolverTime 0 --maxSolverTime 5 --solver chuffed --solverFlags="-f" --maxEvaluations 180 --genSolverTimeLimit 3 diff --git a/scripts/testScripts/pr_graded_tests/cpsat-maccGradedFullGen.sh b/scripts/testScripts/pr_graded_tests/cpsat-maccGradedFullGen.sh index 55e6cbb7..5a787280 100644 --- a/scripts/testScripts/pr_graded_tests/cpsat-maccGradedFullGen.sh +++ b/scripts/testScripts/pr_graded_tests/cpsat-maccGradedFullGen.sh @@ -1,9 +1,7 @@ #!/bin/bash -# avoids having an error if directory already exists -echo "the variable is: " -ls -echo $AUTOIG +# Testing graded instance generation for the Macc problem using its full generator with the cpsat solver" + mkdir -p "$AUTOIG/experiments/macc-graded-gen" cd "$AUTOIG/experiments/macc-graded-gen" python3 "$AUTOIG/scripts/setup.py" --generatorModel "$AUTOIG/data/models/macc/generator.essence" --problemModel "$AUTOIG/data/models/macc/problem.mzn" --instanceSetting graded --minSolverTime 0 --maxSolverTime 5 --solver cpsat --solverFlags="-f" --maxEvaluations 180 --genSolverTimeLimit 3 diff --git a/scripts/testScripts/pr_graded_tests/gecode-maccGradedFullGen.sh b/scripts/testScripts/pr_graded_tests/gecode-maccGradedFullGen.sh index 298004b9..689efbed 100644 --- a/scripts/testScripts/pr_graded_tests/gecode-maccGradedFullGen.sh +++ b/scripts/testScripts/pr_graded_tests/gecode-maccGradedFullGen.sh @@ -1,9 +1,6 @@ #!/bin/bash -# avoids having an error if directory already exists -echo "the variable is: " -ls -echo $AUTOIG +# Testing graded instance generation for the Macc problem using its full generator with the gecode solver" mkdir -p "$AUTOIG/experiments/macc-graded-gen" cd "$AUTOIG/experiments/macc-graded-gen" python3 "$AUTOIG/scripts/setup.py" --generatorModel "$AUTOIG/data/models/macc/generator.essence" --problemModel "$AUTOIG/data/models/macc/problem.mzn" --instanceSetting graded --minSolverTime 0 --maxSolverTime 5 --solver gecode --solverFlags="-f" --maxEvaluations 180 --genSolverTimeLimit 3 diff --git a/scripts/testScripts/pr_graded_tests/picat-maccGradedFullGen.sh b/scripts/testScripts/pr_graded_tests/picat-maccGradedFullGen.sh index 5a7976e7..87c2d08a 100644 --- a/scripts/testScripts/pr_graded_tests/picat-maccGradedFullGen.sh +++ b/scripts/testScripts/pr_graded_tests/picat-maccGradedFullGen.sh @@ -1,9 +1,6 @@ #!/bin/bash -# avoids having an error if directory already exists -echo "the variable is: " -ls -echo $AUTOIG +# Testing graded instance generation for the Macc problem using its full generator with the picat solver" mkdir -p "$AUTOIG/experiments/macc-graded-gen" cd "$AUTOIG/experiments/macc-graded-gen" python3 "$AUTOIG/scripts/setup.py" --generatorModel "$AUTOIG/data/models/macc/generator.essence" --problemModel "$AUTOIG/data/models/macc/problem.mzn" --instanceSetting graded --minSolverTime 0 --maxSolverTime 5 --solver picat --solverFlags="-f" --maxEvaluations 180 --genSolverTimeLimit 3 diff --git a/scripts/testScripts/pr_graded_tests/yuck-maccGradedFullGen.sh b/scripts/testScripts/pr_graded_tests/yuck-maccGradedFullGen.sh index 712fddef..e645c3b3 100644 --- a/scripts/testScripts/pr_graded_tests/yuck-maccGradedFullGen.sh +++ b/scripts/testScripts/pr_graded_tests/yuck-maccGradedFullGen.sh @@ -1,9 +1,6 @@ #!/bin/bash -# avoids having an error if directory already exists -echo "the variable is: " -ls -echo $AUTOIG +# Testing graded instance generation for the Macc problem using its full generator with the yuck solver" mkdir -p "$AUTOIG/experiments/macc-graded-gen" cd "$AUTOIG/experiments/macc-graded-gen" python3 "$AUTOIG/scripts/setup.py" --generatorModel "$AUTOIG/data/models/macc/generator.essence" --problemModel "$AUTOIG/data/models/macc/problem.mzn" --instanceSetting graded --minSolverTime 0 --maxSolverTime 5 --solver yuck --solverFlags="-f" --maxEvaluations 180 --genSolverTimeLimit 3 diff --git a/scripts/testScripts/push_discrim_tests/chuffed-maccDiscriminatingGen.sh b/scripts/testScripts/push_discrim_tests/chuffed-maccDiscriminatingGen.sh index 2994a39c..b2e3e659 100644 --- a/scripts/testScripts/push_discrim_tests/chuffed-maccDiscriminatingGen.sh +++ b/scripts/testScripts/push_discrim_tests/chuffed-maccDiscriminatingGen.sh @@ -1,5 +1,5 @@ #!/bin/bash - +# Tests discriminating instance generation with Macc problem, using full generator, and the Chuffed solver. echo $AUTOIG mkdir -p "$AUTOIG/experiments/macc-discrim-small-gen" cd "$AUTOIG/experiments/macc-discrim-small-gen" diff --git a/scripts/testScripts/push_graded_tests/chuffed-maccGradedSmallGen.sh b/scripts/testScripts/push_graded_tests/chuffed-maccGradedSmallGen.sh index c59ce158..52e4e00f 100644 --- a/scripts/testScripts/push_graded_tests/chuffed-maccGradedSmallGen.sh +++ b/scripts/testScripts/push_graded_tests/chuffed-maccGradedSmallGen.sh @@ -1,9 +1,6 @@ #!/bin/bash -# avoids having an error if directory already exists -echo "the variable is: " -ls -echo $AUTOIG +# Testing graded instance generation for the Macc problem using its small generator with the chuffed solver" mkdir -p "$AUTOIG/experiments/macc-graded-small-gen" cd "$AUTOIG/experiments/macc-graded-small-gen" python3 "$AUTOIG/scripts/setup.py" --generatorModel "$AUTOIG/data/models/macc/generator-small.essence" --problemModel "$AUTOIG/data/models/macc/problem.mzn" --instanceSetting graded --minSolverTime 0 --maxSolverTime 5 --solver chuffed --solverFlags="-f" --maxEvaluations 180 --genSolverTimeLimit 3 diff --git a/scripts/testScripts/push_graded_tests/cpsat-maccGradedSmallGen.sh b/scripts/testScripts/push_graded_tests/cpsat-maccGradedSmallGen.sh index 7f3280c7..62a21420 100644 --- a/scripts/testScripts/push_graded_tests/cpsat-maccGradedSmallGen.sh +++ b/scripts/testScripts/push_graded_tests/cpsat-maccGradedSmallGen.sh @@ -1,9 +1,6 @@ #!/bin/bash -# avoids having an error if directory already exists -echo "the variable is: " -ls -echo $AUTOIG +# Testing graded instance generation for the Macc problem using its small generator with the cpsat solver" mkdir -p "$AUTOIG/experiments/macc-graded-small-gen" cd "$AUTOIG/experiments/macc-graded-small-gen" python3 "$AUTOIG/scripts/setup.py" --generatorModel "$AUTOIG/data/models/macc/generator-small.essence" --problemModel "$AUTOIG/data/models/macc/problem.mzn" --instanceSetting graded --minSolverTime 0 --maxSolverTime 5 --solver cpsat --solverFlags="-f" --maxEvaluations 180 --genSolverTimeLimit 3 diff --git a/scripts/testScripts/push_graded_tests/gecode-maccGradedSmallGen.sh b/scripts/testScripts/push_graded_tests/gecode-maccGradedSmallGen.sh index c43f9209..65d6854e 100644 --- a/scripts/testScripts/push_graded_tests/gecode-maccGradedSmallGen.sh +++ b/scripts/testScripts/push_graded_tests/gecode-maccGradedSmallGen.sh @@ -1,9 +1,6 @@ #!/bin/bash -# avoids having an error if directory already exists -echo "the variable is: " -ls -echo $AUTOIG +# Testing graded instance generation for the Macc problem using its small generator with the gecode solver" mkdir -p "$AUTOIG/experiments/macc-graded-small-gen" cd "$AUTOIG/experiments/macc-graded-small-gen" python3 "$AUTOIG/scripts/setup.py" --generatorModel "$AUTOIG/data/models/macc/generator-small.essence" --problemModel "$AUTOIG/data/models/macc/problem.mzn" --instanceSetting graded --minSolverTime 0 --maxSolverTime 5 --solver gecode --solverFlags="-f" --maxEvaluations 180 --genSolverTimeLimit 3 diff --git a/scripts/testScripts/push_graded_tests/picat-maccGradedSmallGen.sh b/scripts/testScripts/push_graded_tests/picat-maccGradedSmallGen.sh index 11241962..46f32f87 100644 --- a/scripts/testScripts/push_graded_tests/picat-maccGradedSmallGen.sh +++ b/scripts/testScripts/push_graded_tests/picat-maccGradedSmallGen.sh @@ -1,9 +1,6 @@ #!/bin/bash -# avoids having an error if directory already exists -echo "the variable is: " -ls -echo $AUTOIG +# Testing graded instance generation for the Macc problem using its small generator with the picat solver" mkdir -p "$AUTOIG/experiments/macc-graded-small-gen" cd "$AUTOIG/experiments/macc-graded-small-gen" python3 "$AUTOIG/scripts/setup.py" --generatorModel "$AUTOIG/data/models/macc/generator-small.essence" --problemModel "$AUTOIG/data/models/macc/problem.mzn" --instanceSetting graded --minSolverTime 0 --maxSolverTime 5 --solver picat --solverFlags="-f" --maxEvaluations 180 --genSolverTimeLimit 3 diff --git a/scripts/testScripts/push_graded_tests/yuck-maccGradedSmallGen.sh b/scripts/testScripts/push_graded_tests/yuck-maccGradedSmallGen.sh index d519f224..5f41eb03 100644 --- a/scripts/testScripts/push_graded_tests/yuck-maccGradedSmallGen.sh +++ b/scripts/testScripts/push_graded_tests/yuck-maccGradedSmallGen.sh @@ -1,9 +1,6 @@ #!/bin/bash -# avoids having an error if directory already exists -echo "the variable is: " -ls -echo $AUTOIG +# Testing graded instance generation for the Macc problem using its small generator with the yuck solver" mkdir -p "$AUTOIG/experiments/macc-graded-small-gen" cd "$AUTOIG/experiments/macc-graded-small-gen" python3 "$AUTOIG/scripts/setup.py" --generatorModel "$AUTOIG/data/models/macc/generator-small.essence" --problemModel "$AUTOIG/data/models/macc/problem.mzn" --instanceSetting graded --minSolverTime 0 --maxSolverTime 5 --solver yuck --solverFlags="-f" --maxEvaluations 180 --genSolverTimeLimit 3 diff --git a/scripts/testScripts/testreadme.md b/scripts/testScripts/testreadme.md index 62bbe692..7f829656 100644 --- a/scripts/testScripts/testreadme.md +++ b/scripts/testScripts/testreadme.md @@ -1,23 +1,39 @@ # Description -This is a directory which contains scripts to test various AutoIG runs using regex to test output +This is a directory which contains scripts to test various parts of AutoIG. Its test scripts can both be run manually by a user, or automatically when called by a GitHub aciton in the AutoIG CI pipeline. -To run this, put the commands to navigate to the AutoIG experiment directory, setup the project, and run it. See the general README for further instructions on running. +Each `test script` calls a corresponding folder of `run files`. Each test is a full setup and run of AutoIG, and the `test script` scans the output caused by running the experiment ran by each `run file`, ensuring it contains all of the provided lines. To keep test results consistent, each currently made `run file` uses the same parameters as explained further on, but a different solver. Solvers tested to be functional currently include: chuffed, cpsat, gecode, picat, and yuck. -The script will automatically scan the standard output, then output weather the output of each file contained the desired lines specified within the script. The lines need to exist independently in the output, not be sequential. +For example, `check_push` would call all of the `run files` in `/push_graded_tests`, then insure that the output of every run file contained all lines specified in an array within the `check_push` script. -After all tests are run, the script also outputs the number of passed tests / the number of failed tests, as well as time taken to run all of them. +After a test script is run, the script also outputs the number of passed run files / the number of failed run files, as well as time taken to run all of them. Whenever a line is failed to be found, the script also outputs which line (or lines) weren't found to cause this issue. -This is one of the same test script which will eventuall be integrated into the automated CI pipeline in GitHub, but can also be used manually. +## Manual Run Instructions -An example contents of a test may look like: +To run any of these scripts, ensure that project paths are set up as described in the general README, then make a call to the script you wish to call. For example: `bash check`pr.sh`. -## Within tests/macc-graded: +Each of these test scripts call run script within its corresponding folder of `pr_discrim_tests`, `pr_graded_tests`, `push_discrim_tests`, or `push_graded_tests`. Each run script sets up an AutoIG experiment and runs it. + +## Script Descriptions + +All currently created tests use the macc problem in data/models/macc, with each test script testing that macc works with every supported solver. + +In the context of usage by the pipeline, some runs are meant to be called on PRs, and are more intensive, being done with the full macc generator. Some are meant to be called on pushes to any branch and are less intensive, being done with the small macc generator. + +Provided Scripts include: + +- `check_conjure`: test container environment is set correctly, and Conjure is able to find location of all needed solver binaries. +- `check_pr_discrim`: test discriminating instance generation with full macc generator. +- `check_pr`: test graded instances with full macc generator. +- `check_push_discrim`: test discriminating instances with small macc generator. +- `check_push`: test graded instances with small macc generator. + +Example contents of a test script may look like: + +## Within push_discrim_tests: `cd "AutoIG/experiments/macc-graded"` `python3 "\$AUTOIG/scripts/setup.py --generatorModel \$AUTOIG/data/models/macc/generator-small.essence --problemModel \$AUTOIG/data/models/macc/problem.mzn --instanceSetting graded --minSolverTime 0 --maxSolverTime 5 --solver chuffed --solverFlags=\"-f\" --maxEvaluations 180 --genSolverTimeLimit 5"` `bash "run.sh"` - -`cd "../.."` From ff774a152eb338ed1a5cbbcbea901a70e61eba4f Mon Sep 17 00:00:00 2001 From: vincepick Date: Sun, 22 Dec 2024 08:05:00 +0000 Subject: [PATCH 094/100] docs: further updated README --- scripts/testScripts/testreadme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/testScripts/testreadme.md b/scripts/testScripts/testreadme.md index 7f829656..a8db5a0e 100644 --- a/scripts/testScripts/testreadme.md +++ b/scripts/testScripts/testreadme.md @@ -2,7 +2,7 @@ This is a directory which contains scripts to test various parts of AutoIG. Its test scripts can both be run manually by a user, or automatically when called by a GitHub aciton in the AutoIG CI pipeline. -Each `test script` calls a corresponding folder of `run files`. Each test is a full setup and run of AutoIG, and the `test script` scans the output caused by running the experiment ran by each `run file`, ensuring it contains all of the provided lines. To keep test results consistent, each currently made `run file` uses the same parameters as explained further on, but a different solver. Solvers tested to be functional currently include: chuffed, cpsat, gecode, picat, and yuck. +Each `test script` calls a corresponding folder of `run files`. Each test is a full setup and run of AutoIG, and the `test script` scans the output caused by running the experiment ran by each `run file`, ensuring it contains all of the provided lines. To keep test results consistent, each currently made `run file` uses the same parameters as explained further on, but a different solver. Solvers tested to be functional currently include: chuffed, cpsat, gecode, picat, and yuck. The lines being searched for are manually set in each script itself, in a `lines` array towards the top of each script. Each script operates by iterating through all `run files` in each tests directory, so additional `run files` with different configurations/runs of AutoIG can also be directly added with no issues. For example, `check_push` would call all of the `run files` in `/push_graded_tests`, then insure that the output of every run file contained all lines specified in an array within the `check_push` script. From 64a9f0408e9b7b2b75b92a7c9dc2b50b96df855d Mon Sep 17 00:00:00 2001 From: vincepick Date: Sun, 22 Dec 2024 08:16:43 +0000 Subject: [PATCH 095/100] docs: updated testreadme again --- scripts/testScripts/testreadme.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/testScripts/testreadme.md b/scripts/testScripts/testreadme.md index a8db5a0e..bc97b56e 100644 --- a/scripts/testScripts/testreadme.md +++ b/scripts/testScripts/testreadme.md @@ -2,7 +2,7 @@ This is a directory which contains scripts to test various parts of AutoIG. Its test scripts can both be run manually by a user, or automatically when called by a GitHub aciton in the AutoIG CI pipeline. -Each `test script` calls a corresponding folder of `run files`. Each test is a full setup and run of AutoIG, and the `test script` scans the output caused by running the experiment ran by each `run file`, ensuring it contains all of the provided lines. To keep test results consistent, each currently made `run file` uses the same parameters as explained further on, but a different solver. Solvers tested to be functional currently include: chuffed, cpsat, gecode, picat, and yuck. The lines being searched for are manually set in each script itself, in a `lines` array towards the top of each script. Each script operates by iterating through all `run files` in each tests directory, so additional `run files` with different configurations/runs of AutoIG can also be directly added with no issues. +Each `test script` calls a corresponding folder of `run files`. Each `run file` is a full setup and run of AutoIG, and the `test script` scans the output caused by running the experiment ran by each `run file`, ensuring it contains all of the provided lines. To keep test results consistent, each currently made `run file` uses the same parameters as explained further on, but a different solver. Solvers tested to be functional currently include: chuffed, cpsat, gecode, picat, and yuck. The lines being searched for are manually set in each script itself, in a `lines` array towards the top of each script. Each script operates by iterating through all `run files` in each tests directory, so additional `run files` with different configurations/runs of AutoIG can be directly added with no further adjustments necessary. For example, `check_push` would call all of the `run files` in `/push_graded_tests`, then insure that the output of every run file contained all lines specified in an array within the `check_push` script. @@ -18,7 +18,7 @@ Each of these test scripts call run script within its corresponding folder of `p All currently created tests use the macc problem in data/models/macc, with each test script testing that macc works with every supported solver. -In the context of usage by the pipeline, some runs are meant to be called on PRs, and are more intensive, being done with the full macc generator. Some are meant to be called on pushes to any branch and are less intensive, being done with the small macc generator. +In the context of usage by the pipeline, some runs are meant to be called on PRs, and are more intensive, being done with the full macc generator. Some are meant to be called on pushes to any branch and are less intensive, being done with the small macc generator instead. Provided Scripts include: From f4cd0851af5d2761fb9688fe5b65cf7c8ae160e2 Mon Sep 17 00:00:00 2001 From: vincepick Date: Sun, 22 Dec 2024 09:12:59 +0000 Subject: [PATCH 096/100] docs: final comments --- scripts/testScripts/testreadme.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/testScripts/testreadme.md b/scripts/testScripts/testreadme.md index bc97b56e..d8cbc9fd 100644 --- a/scripts/testScripts/testreadme.md +++ b/scripts/testScripts/testreadme.md @@ -1,16 +1,16 @@ # Description -This is a directory which contains scripts to test various parts of AutoIG. Its test scripts can both be run manually by a user, or automatically when called by a GitHub aciton in the AutoIG CI pipeline. +This is a directory which contains scripts to test various parts of AutoIG. These test scripts can both be run manually by a user, or automatically when called by a GitHub action in the AutoIG CI pipeline. -Each `test script` calls a corresponding folder of `run files`. Each `run file` is a full setup and run of AutoIG, and the `test script` scans the output caused by running the experiment ran by each `run file`, ensuring it contains all of the provided lines. To keep test results consistent, each currently made `run file` uses the same parameters as explained further on, but a different solver. Solvers tested to be functional currently include: chuffed, cpsat, gecode, picat, and yuck. The lines being searched for are manually set in each script itself, in a `lines` array towards the top of each script. Each script operates by iterating through all `run files` in each tests directory, so additional `run files` with different configurations/runs of AutoIG can be directly added with no further adjustments necessary. +Each `test script` calls every test in a corresponding folder of `run files`. Each `run file` is a full setup and run of AutoIG, and the `test script` scans the output caused by running the experiment ran by each `run file`, ensuring it contains all of the provided lines. To keep test results consistent, each currently made `run file` uses the same parameters as explained further on, but a different solver. Solvers tested currently include: chuffed, cpsat, gecode, picat, and yuck. The lines being searched for are manually set in each script itself, in a `lines` array towards the top of each script. Each script operates by iterating through all `run files` in each tests directory, so additional `run files` with different configurations/runs of AutoIG can be directly added with no further adjustments necessary. -For example, `check_push` would call all of the `run files` in `/push_graded_tests`, then insure that the output of every run file contained all lines specified in an array within the `check_push` script. +For example, `check_push` would call all of the `run files` in `/push_graded_tests`, then ensure that the output of every run file contained all lines specified in an array within the `check_push` script. -After a test script is run, the script also outputs the number of passed run files / the number of failed run files, as well as time taken to run all of them. Whenever a line is failed to be found, the script also outputs which line (or lines) weren't found to cause this issue. +After a test script is run, the script also outputs the number of passed `run files` / the number of failed `run files`, as well as time taken to run all of them. Whenever a line is failed to be found, the script also outputs which line (or lines) weren't found to cause this issue. ## Manual Run Instructions -To run any of these scripts, ensure that project paths are set up as described in the general README, then make a call to the script you wish to call. For example: `bash check`pr.sh`. +To run any of these scripts, ensure that project paths are set up as described in the general README, then make a call to the script you wish to call. For example: `bash_check_pr.sh`. Each of these test scripts call run script within its corresponding folder of `pr_discrim_tests`, `pr_graded_tests`, `push_discrim_tests`, or `push_graded_tests`. Each run script sets up an AutoIG experiment and runs it. From 75d3f610a78ba4f55d6fc5b8add1a2285d9ef960 Mon Sep 17 00:00:00 2001 From: vincepick Date: Wed, 25 Dec 2024 22:15:09 -0800 Subject: [PATCH 097/100] fix: updated workflows to fix environment setup issues --- .../{run_tests.yml => run_pr_tests.yml} | 101 +++++------------- .github/workflows/run_push_tests.yml | 90 ++++++++++++++++ .github/workflows/testPush.yml | 20 ---- 3 files changed, 114 insertions(+), 97 deletions(-) rename .github/workflows/{run_tests.yml => run_pr_tests.yml} (56%) create mode 100644 .github/workflows/run_push_tests.yml delete mode 100644 .github/workflows/testPush.yml diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_pr_tests.yml similarity index 56% rename from .github/workflows/run_tests.yml rename to .github/workflows/run_pr_tests.yml index d8e283e7..0640ce40 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_pr_tests.yml @@ -1,15 +1,10 @@ ---- -name: Run test using container +name: Run PR tests, graded and discrim + on: push: branches: - test/maccGradedCase - pull_request: - types: - - opened - - synchronize - - reopened - - closed + jobs: run-tests: name: Run AutoIG Tests @@ -18,25 +13,27 @@ jobs: run: shell: bash container: + # using the main instead of the previous version for now + image: ghcr.io/conjure-cp/conjure:main + #previous version #ghcr.io/conjure-cp/conjure@sha256:e959c664d83a08b68a5b31409d56ce82eadf0f0b74f8af1809642b73f652c940 # Current version of conjure # image: ghcr.io/conjure-cp/conjure@sha256:ebff76918718631f099544eed3a808cd16ce8f2c863c8229c7d2e417ba745c56 - image: ghcr.io/conjure-cp/conjure:main + steps: + # Checkout repo: checks out current repo (so AutoIG current branch) - name: Checkout code - # Checkout repo: checks out current repo (so AutoIG current branch) - uses: actions/checkout@v4 + # Clones the current branch being pushed from # Run same commands as in Docker file, this needs to be updated if there are major updates to Docker later on # The two should be consistent - - name: Run container and execute script - run: > - + - name: Setup environment and execute test scripts for PR + run: | + # Install General Dependencies apt-get update - DEBIAN_FRONTEND=noninteractive apt-get install -y \ bash \ sudo \ @@ -47,96 +44,46 @@ jobs: unzip # Installing Python Dependencies - sudo apt-get install -y python3-pip - apt install python3-pandas -y - apt install python3-numpy -y - sudo apt install python-is-python3 - - sudo apt-get install r-base -y - - sudo apt-get install git-all -y - - # Getting current branch - CURRENT_BRANCH="${{ github.ref_name }}" + git clone -b "$CURRENT_BRANCH" https://github.com/stacs-cp/AutoIG.git - - git clone -b "$CURRENT_BRANCH" https://github.com/vincepick/AutoIG.git - + # Install Necessary Dependencies into AutoIG Bin bash bin/install-savilerow.sh - bash bin/install-mininzinc.sh - bash bin/install-runsolver.sh - - bash bin/install-irace.sh - bash bin/install-ortools.sh - - bash bin/install-yuck.sh - bash bin/install-picat.sh - ls - - - echo "Environment made :D, path:" - - echo $PATH - # Run script for Push Events - - name: Run Push Tests - if: ${{ github.event_name == 'push' }} - run: | - cd AutoIG + # Set Paths . bin/set-path.sh AUTOIG=$(pwd) - cd $AUTOIG/scripts/testScripts - echo "Running basic tests for Push" - bash check_push.sh - bash check_push_discrim.sh - # Run script for Conjure tsts - - name: Run Conjure Tests - if: ${{ github.event_name == 'push' }} - run: | - cd AutoIG - . bin/set-path.sh - AUTOIG=$(pwd) - cd $AUTOIG/scripts/testScripts - echo "Running basic tests for Conjure Usage" - bash check_conjure.sh - # Run script for pull request Events - - name: Run Pull Request Tests - if: ${{ github.event_name == 'pull_request' }} - run: | - cd AutoIG - . bin/set-path.sh - AUTOIG=$(pwd) - cd $AUTOIG/scripts/testScripts - echo "Running more thorough tests for Pull Request" - bash check_pr.sh + # Navigate to test directory + cd scripts/testScript + + # Run the two test scripts associated with PRs bash check_pr_discrim.sh + bash check_pr.sh - # If fail, reject + # if script fails reject PR - name: Fail if: ${{ failure() }} run: | - echo "These tests failed, rejecting PR." + echo "This tests failed, rejecting PR." exit 1 - - # If pass approve + # if script passes approve PR - name: Pass if: ${{ success() }} run: | - echo "These tests passed! allowing PR." + echo "This tests passed! allowing PR." exit 0 diff --git a/.github/workflows/run_push_tests.yml b/.github/workflows/run_push_tests.yml new file mode 100644 index 00000000..72f16ade --- /dev/null +++ b/.github/workflows/run_push_tests.yml @@ -0,0 +1,90 @@ +name: Run push tests, graded and discrim + +# Triggered on pushes on any branch +on: + push: + branches: + - "*" + +jobs: + run-tests: + name: Run AutoIG Tests + runs-on: ubuntu-latest + defaults: + run: + shell: bash + container: + # using the main instead of the previous version for now + image: ghcr.io/conjure-cp/conjure:main + + #previous version + #ghcr.io/conjure-cp/conjure@sha256:e959c664d83a08b68a5b31409d56ce82eadf0f0b74f8af1809642b73f652c940 + + # Current version of conjure + # image: ghcr.io/conjure-cp/conjure@sha256:ebff76918718631f099544eed3a808cd16ce8f2c863c8229c7d2e417ba745c56 + + steps: + # Checkout repo: checks out current repo (so AutoIG current branch) + - name: Checkout code + uses: actions/checkout@v4 + + # Clones the current branch being pushed from + # Run same commands as in Docker file, this needs to be updated if there are major updates to Docker later on + # The two should be consistent + - name: Setup environment and execute test scripts for pushes + run: | + # Install General Dependencies + apt-get update + DEBIAN_FRONTEND=noninteractive apt-get install -y \ + bash \ + sudo \ + wget \ + curl \ + gnupg \ + software-properties-common \ + unzip + + # Installing Python Dependencies + sudo apt-get install -y python3-pip + apt install python3-pandas -y + apt install python3-numpy -y + sudo apt install python-is-python3 + sudo apt-get install r-base -y + sudo apt-get install git-all -y + + # Getting current branch + CURRENT_BRANCH="${{ github.ref_name }}" + git clone -b "$CURRENT_BRANCH" https://github.com/stacs-cp/AutoIG.git + + # Install Necessary Dependencies into AutoIG Bin + bash bin/install-savilerow.sh + bash bin/install-mininzinc.sh + bash bin/install-runsolver.sh + bash bin/install-irace.sh + bash bin/install-ortools.sh + bash bin/install-yuck.sh + bash bin/install-picat.sh + + # Set Paths + . bin/set-path.sh + AUTOIG=$(pwd) + + # Navigate to test directory + cd scripts/testScript + + # Run the two test scripts associated with pushes + bash check_push.sh + bash check_push_discrim.sh + + # if script fails reject PR + - name: Fail + if: ${{ failure() }} + run: | + echo "This tests failed, rejecting PR." + exit 1 + # if script passes approve PR + - name: Pass + if: ${{ success() }} + run: | + echo "This tests passed! allowing PR." + exit 0 diff --git a/.github/workflows/testPush.yml b/.github/workflows/testPush.yml deleted file mode 100644 index d55767d8..00000000 --- a/.github/workflows/testPush.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: test seeing push requests - -on: - push: - branches: - - test/maccGradedCase - -jobs: - testing_push: - runs-on: ubuntu-latest - - steps: - # Check out code - - name: Check out code - uses: actions/checkout@v4 - - # Run the script - - name: Testing push request recieved - run: | - echo "Push request found" From 6440fbd2eea7fb9a80bde04220fe52e4d90c99b8 Mon Sep 17 00:00:00 2001 From: vincepick Date: Thu, 26 Dec 2024 13:03:09 -0800 Subject: [PATCH 098/100] fix: updated path to delete --- scripts/testScripts/conjure_solve-tests/check_chuffed.sh | 2 +- scripts/testScripts/conjure_solve-tests/kissat.sh | 2 +- scripts/testScripts/conjure_solve-tests/or-tools.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/testScripts/conjure_solve-tests/check_chuffed.sh b/scripts/testScripts/conjure_solve-tests/check_chuffed.sh index 92a22dec..86d06d86 100644 --- a/scripts/testScripts/conjure_solve-tests/check_chuffed.sh +++ b/scripts/testScripts/conjure_solve-tests/check_chuffed.sh @@ -5,4 +5,4 @@ DATA_DIR=essence_testing_data ls ls $DATA_DIR conjure solve $DATA_DIR/model.essence $DATA_DIR/test.param --solver=chuffed -rm -r conjure_solve-tests/conjure-output +rm -r conjure-output diff --git a/scripts/testScripts/conjure_solve-tests/kissat.sh b/scripts/testScripts/conjure_solve-tests/kissat.sh index 2fe9c61e..9fcdce1c 100644 --- a/scripts/testScripts/conjure_solve-tests/kissat.sh +++ b/scripts/testScripts/conjure_solve-tests/kissat.sh @@ -5,4 +5,4 @@ DATA_DIR=essence_testing_data ls ls $DATA_DIR conjure solve $DATA_DIR/model.essence $DATA_DIR/test.param --solver=kissat -rm -r conjure_solve-tests/conjure-output +rm -r conjure-output diff --git a/scripts/testScripts/conjure_solve-tests/or-tools.sh b/scripts/testScripts/conjure_solve-tests/or-tools.sh index 69a41582..7fc2f42d 100644 --- a/scripts/testScripts/conjure_solve-tests/or-tools.sh +++ b/scripts/testScripts/conjure_solve-tests/or-tools.sh @@ -4,4 +4,4 @@ DATA_DIR=essence_testing_data ls conjure solve $DATA_DIR/model.essence $DATA_DIR/test.param --solver=or-tools -rm -r conjure_solve-tests/conjure-output +rm -r conjure-output From 2afeb1ea7890026e7cb7ec2e023cfd9e8f7cd606 Mon Sep 17 00:00:00 2001 From: vincepick Date: Thu, 26 Dec 2024 13:05:57 -0800 Subject: [PATCH 099/100] fix: updated check_conjure syntax error --- scripts/testScripts/check_conjure.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/testScripts/check_conjure.sh b/scripts/testScripts/check_conjure.sh index beb7065f..a9fa92fd 100644 --- a/scripts/testScripts/check_conjure.sh +++ b/scripts/testScripts/check_conjure.sh @@ -1,6 +1,6 @@ #!/bin/bash -. <<'COMMENT' +: <<'COMMENT' Tests for calls to conjure_solve() Runs all scripts in the conjure_solve-tests directory, to ensure that Conjure is able to find binaries for solvers: chuffed, kissat, and or-tools From 3cff9cf3d72f522a4e0321cc91ad282119bb19fe Mon Sep 17 00:00:00 2001 From: vincepick Date: Thu, 26 Dec 2024 13:09:26 -0800 Subject: [PATCH 100/100] fix: updated test directory path --- .github/workflows/run_pr_tests.yml | 2 +- .github/workflows/run_push_tests.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run_pr_tests.yml b/.github/workflows/run_pr_tests.yml index 0640ce40..50127bea 100644 --- a/.github/workflows/run_pr_tests.yml +++ b/.github/workflows/run_pr_tests.yml @@ -69,7 +69,7 @@ jobs: AUTOIG=$(pwd) # Navigate to test directory - cd scripts/testScript + cd scripts/testScripts # Run the two test scripts associated with PRs bash check_pr_discrim.sh diff --git a/.github/workflows/run_push_tests.yml b/.github/workflows/run_push_tests.yml index 72f16ade..01ad1837 100644 --- a/.github/workflows/run_push_tests.yml +++ b/.github/workflows/run_push_tests.yml @@ -70,7 +70,7 @@ jobs: AUTOIG=$(pwd) # Navigate to test directory - cd scripts/testScript + cd scripts/testScripts # Run the two test scripts associated with pushes bash check_push.sh