Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI Testing Pipeline #22

Merged
merged 102 commits into from
Dec 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
fdd5717
feat: added a new test script to scan output of AutoIG runs for key l…
vincepick Nov 12, 2024
07c4208
feat: added functional test script for macc-graded
vincepick Nov 13, 2024
2014aa6
Create main.yml
vincepick Nov 17, 2024
a03a851
Merge pull request #15 from stacs-cp/vincepick-patch-1
vincepick Nov 17, 2024
ec85b31
fix: updated check.sh with exit scores for use by github actions
vincepick Nov 17, 2024
148c51e
feat: updated main.yml to call check.sh
vincepick Nov 17, 2024
c3016cc
Create testPush.yml
vincepick Nov 17, 2024
7080379
build: testing ability to make a PR which is picked up by github action
vincepick Nov 18, 2024
8de7fc3
Merge pull request #16 from stacs-cp/testPRbranch
vincepick Nov 18, 2024
610841d
fix: updated branch to not run GitHub action on every PR, instead onl…
vincepick Nov 18, 2024
58f628a
build: trying to use docker volume within GitHub workflow
vincepick Nov 18, 2024
8da738f
fix: trying to directly use desired docker container in workflow
vincepick Nov 18, 2024
66b5ffa
build: temporary changing CI to always be wrong to check its actually…
vincepick Nov 19, 2024
6d6bff9
fix: undoing the intentional break
vincepick Nov 19, 2024
36b629a
build: breaking check script
vincepick Nov 19, 2024
d4375f1
fix: undoing intentional break to check.sh
vincepick Nov 19, 2024
885f456
build: changing how docker container is used inside github actions
vincepick Nov 20, 2024
e7345d0
build: added updated dockerfile to this branch for use to build conta…
vincepick Nov 20, 2024
004803d
build: updated yml file for building docker
vincepick Nov 20, 2024
080b5ec
build: updated use of root directory in workflow
vincepick Nov 20, 2024
f9e4043
fix: commenting out pushcontainer github workflow
vincepick Nov 20, 2024
3832c12
fix: commenting out main.yml github workflow
vincepick Nov 20, 2024
faa2517
fix: updated testPush with more accurate job names
vincepick Nov 20, 2024
2170136
fix: fixed testing push workflow again
vincepick Nov 20, 2024
3b593fb
build: added updated dockerfile
vincepick Nov 20, 2024
23ca488
build: updating yaml for using container
vincepick Nov 25, 2024
6ce72a0
docs: updated tests readme
vincepick Dec 1, 2024
ccca4d1
build: updated docker push workflow
vincepick Dec 1, 2024
0baffb4
Delete .github/workflows/main.yml
vincepick Dec 1, 2024
8fe0ba6
build: updated the workflow for automatically adding pushContainer to…
vincepick Dec 10, 2024
5f34a99
build: updated useContainer for new approach to GHCR
vincepick Dec 10, 2024
257ebbc
build: using older Conjure release version
vincepick Dec 10, 2024
af0eb74
build: using older Conjure release version
vincepick Dec 10, 2024
914b95d
build: adding test call in AutoIG evnironment in useContainer
vincepick Dec 10, 2024
494eead
build: adding debug statements
vincepick Dec 10, 2024
e3d39a0
build: testing new push
vincepick Dec 10, 2024
8db4853
build: added additional debug statement
vincepick Dec 10, 2024
4a8a811
build: added additional debug statement
vincepick Dec 10, 2024
259c30a
docs: added flag for potential issue for later reference about the sh…
vincepick Dec 10, 2024
008c3c7
build: specified default shell as bash to be able to run AutoIG
vincepick Dec 10, 2024
b643e0b
build: updated branch to be cloned
vincepick Dec 10, 2024
f466598
build: updated to ensure builds correctly without test
vincepick Dec 10, 2024
0aacc8c
build: updated to ensure builds correctly without test
vincepick Dec 10, 2024
cfd35ab
build: testing ability to run in the test branch
vincepick Dec 10, 2024
b2ebc73
build: testing ability to run test
vincepick Dec 10, 2024
2d26c67
build: trying to run tests again
vincepick Dec 10, 2024
0cea72c
test: updated testing script
vincepick Dec 10, 2024
20eab31
test: updated testing script again
vincepick Dec 10, 2024
9b4f0c6
build(CI-Pipeline): made it run tests on the branch changes are being…
vincepick Dec 10, 2024
c4c44c0
build(CI-Pipeline): update dynamic branch usage
vincepick Dec 10, 2024
463ff81
docs: added updated comments to useContainer workflow
vincepick Dec 11, 2024
1e64d58
build: trying specific version of Conjure again
vincepick Dec 11, 2024
b112fa0
build: changed back to conjure:main base image for now before the iss…
vincepick Dec 11, 2024
a8f35fd
build: dockerfile works with existing set-path file
vincepick Dec 11, 2024
3483d44
build: removed pushcontainer workflow
vincepick Dec 11, 2024
2d4b666
build: updated run_tests.yml to also run on pull requests
vincepick Dec 12, 2024
7e67ee6
fix: fixed previous commit
vincepick Dec 12, 2024
0e44f91
tests(CI Pipeline): added different testing suite for PRs vs just pul…
vincepick Dec 12, 2024
578916b
tests: updated path to test running script
vincepick Dec 12, 2024
ad61f0f
tests: update previous commit
vincepick Dec 12, 2024
0a70147
build: added debug statements to run_tests
vincepick Dec 12, 2024
33dc913
build: added debug statements to run_tests again
vincepick Dec 12, 2024
2c82f54
build: updated workflow with correct path
vincepick Dec 12, 2024
5861b92
build: updated workflow with correct path
vincepick Dec 12, 2024
b275d23
build: further debug statements
vincepick Dec 12, 2024
d6a918a
build: added debug statements to testscripts
vincepick Dec 12, 2024
e371d5d
build: updated which repo is cloned
vincepick Dec 12, 2024
39fa180
test: added more test cases for other solvers, and updated test.readm…
vincepick Dec 18, 2024
93eb5eb
test: updated check test script
vincepick Dec 18, 2024
6ed1a81
test: added super lightweight models for testing, m.dzn and m.mzn
vincepick Dec 18, 2024
ac116b6
test: added tests for conjure solve to the testing directory
vincepick Dec 18, 2024
f3586db
test: added tests to ensure that Conjure still works in the altered e…
vincepick Dec 19, 2024
1e38802
test: deleted old test scripts folder
vincepick Dec 19, 2024
3a8b0dc
test: fully deleted
vincepick Dec 19, 2024
3c23831
fix: added debug statement to check chuffed
vincepick Dec 19, 2024
4c5cf14
fix: updated debug statement
vincepick Dec 19, 2024
ceea7de
test: updated checker for chuffed with Conjure
vincepick Dec 19, 2024
c9dc039
test: updated check conjure script
vincepick Dec 19, 2024
97aedbb
fix: updated scripts for checking chuffed and ortools
vincepick Dec 19, 2024
240720c
test: update test scripts again
vincepick Dec 19, 2024
a3400fd
test: update test scripts again
vincepick Dec 19, 2024
caf231a
docs: updated test scripts
vincepick Dec 19, 2024
6190522
test: updated testing workflow
vincepick Dec 19, 2024
e5946a1
fix: updated workflow
vincepick Dec 19, 2024
bb1358c
fix: updated workflow again'
vincepick Dec 19, 2024
138aa3b
fix: yaml indentation
vincepick Dec 19, 2024
b2f247d
docs: updated commenting in run_tests workflow
vincepick Dec 19, 2024
4f6e241
test: added test here from build/update-docker branch
vincepick Dec 19, 2024
9de03f5
test: added more tests for other solvers to use full generator model …
vincepick Dec 19, 2024
ab9d0f6
test: added tests for discriminating instances for chuffed
vincepick Dec 19, 2024
e48103b
test: updated tests scripts
vincepick Dec 19, 2024
86f2175
test: updated the testing workflow to correspond with the new test names
vincepick Dec 19, 2024
5c22b64
docs: updated documentation for check_pr
vincepick Dec 21, 2024
f4bbe9a
docs: added further comments
vincepick Dec 21, 2024
6f8d74b
docs: updated comments and documentation further
vincepick Dec 22, 2024
ff774a1
docs: further updated README
vincepick Dec 22, 2024
64a9f04
docs: updated testreadme again
vincepick Dec 22, 2024
f4cd085
docs: final comments
vincepick Dec 22, 2024
75d3f61
fix: updated workflows to fix environment setup issues
vincepick Dec 26, 2024
6440fbd
fix: updated path to delete
vincepick Dec 26, 2024
2afeb1e
fix: updated check_conjure syntax error
vincepick Dec 26, 2024
3cff9cf
fix: updated test directory path
vincepick Dec 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions .github/workflows/run_pr_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Run PR tests, graded and discrim

on:
push:
branches:
- test/maccGradedCase

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 PR
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/testScripts

# Run the two test scripts associated with PRs
bash check_pr_discrim.sh
bash check_pr.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
90 changes: 90 additions & 0 deletions .github/workflows/run_push_tests.yml
Original file line number Diff line number Diff line change
@@ -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/testScripts

# 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
2 changes: 2 additions & 0 deletions bin/set-path.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions data/models/testModel/m.dzn
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
A=4;
1 change: 1 addition & 0 deletions data/models/testModel/m.mzn
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
int: A;
Binary file added scripts/testScripts/.DS_Store
Binary file not shown.
60 changes: 60 additions & 0 deletions scripts/testScripts/check_conjure.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/bin/bash

: <<'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

Ensure that conjure is able to recognize the paths to solver binaries inside container environment.
COMMENT

# Lines being checked for
lines=(
"Copying solution to:"
)

testsPassed=0
testsRun=0

start=$(date +%s)

# Loop through each script in the tests directory
for file in conjure_solve-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 for Conjure: %d/%d! :D\e[0m\n" "$testsPassed" "$testsRun"
exit 0
else
printf "\e[31mSome cases failing for Conjure, only %d/%d passed.\e[0m\n" "$testsPassed" "$testsRun"
exit 1
fi
66 changes: 66 additions & 0 deletions scripts/testScripts/check_pr.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#!/bin/bash

: <<'COMMENT'
Tests for Graded Instance Generation

Runs all scripts put in ./pr_graded_tests and makes sure that the run contains provided lines.

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
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_graded_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"
64 changes: 64 additions & 0 deletions scripts/testScripts/check_pr_discrim.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/bin/bash

: <<'COMMENT'
Tests for Discriminating Instance Generation

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.

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
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
Loading