Skip to content

Commit

Permalink
Run Each Test as it's Own Action
Browse files Browse the repository at this point in the history
Split the tests into to it own Github Actions to make going over the results much easier to read and track.

Update script-build.yaml - fix spelling error
  • Loading branch information
odysseywestra committed Feb 16, 2024
1 parent 6ad53d0 commit 906326b
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 21 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/script-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,16 @@ jobs:

- name: "Build MyPaint"
run: bash $GITHUB_WORKSPACE/scripts/linux-build.sh build

- name: "Run Docktest"
run: bash $GITHUB_WORKSPACE/scripts/linux-build.sh run-test doctest

- name: "Test MyPaint"
- name: "Run Conformance Tests with XVFB"
run: xvfb-run --auto-servernum bash $GITHUB_WORKSPACE/scripts/linux-build.sh tests

- name: "Run Script Install Test"
run: bash $GITHUB_WORKSPACE/scripts/linux-build.sh run-test install-test

- name: Run demo with XVFB
run: xvfb-run --auto-servernum bash $GITHUB_WORKSPACE/scripts/linux-build.sh demo

Expand Down
57 changes: 37 additions & 20 deletions scripts/linux-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@
#: install Install dependencies from package manager or source.
#: pkg-deps - Install dependencies from package manager.
#: source-dep - Install dependencies from source.
#: $3 - The source package to grab.
#: $4 - Install the package after building.
#: {package_name} - The source package to grab.
#: {True, False} - Install the package after building.
#: build Build MyPaint itself from this source tree.
#: run-test Run tests on the built source.
#: doctest - Run doctests on the built source.
#: conformance - Run conformance on the built source.
#: install-test - Run install and uninstall tests.
#: clean Clean the build tree.
#: demo Run the demo. Have Xvfb running if in a headless server.
#: tests Runs tests on the built source. Includes doctests.
#: conformance Runs conformance on the built source. Includes doctests.
#:
#: This script is designed to be called by GitHub actions, however
#: it's clean enough to run from an interactive shell.
Expand Down Expand Up @@ -77,7 +81,7 @@ logerror() {
echo -e "${NC}"
}

lognote() {
logwarn() {
echo -ne "${YELLOW}NOTICE: "
echo -n "$@"
echo -e "${NC}"
Expand Down Expand Up @@ -141,15 +145,15 @@ use_correct_fork(){
FORK_EXISTS=$(git ls-remote --quiet --exit-code $SOURCEPKG_URL > /dev/null && echo "true" || echo "false")

if $FORK_EXISTS; then
lognote "$SRC_USERNAME has a fork of $SOURCEPKG."
logwarn "$SRC_USERNAME has a fork of $SOURCEPKG."
CORRECT_REPO="Fork"
else
lognote "$SRC_USERNAME does not have a fork of $SOURCEPKG."
logwarn "$SRC_USERNAME does not have a fork of $SOURCEPKG."
CORRECT_REPO="Upstream"
SOURCEPKG_URL="$SRC_SITE/$SRC_PROJECT_NAME/$SOURCEPKG.git"
fi

lognote "Using $CORRECT_REPO Repository: $SOURCEPKG_URL for $SOURCEPKG"
loginfo "Using $CORRECT_REPO Repository: $SOURCEPKG_URL for $SOURCEPKG"
}

# This function will select the correct branch of the source package and pass it to $SOURCEPKG_BRANCH.
Expand All @@ -163,14 +167,14 @@ use_correct_branch(){
BRANCH_EXISTS=$(git ls-remote --quiet --exit-code $SOURCEPKG_URL $SRC_BRANCH > /dev/null && echo "true" || echo "false")

if $BRANCH_EXISTS; then
lognote "$SRC_BRANCH exists in $SOURCEPKG git repository."
logwarn "$SRC_BRANCH exists in $SOURCEPKG git repository."
SOURCEPKG_BRANCH="$SRC_BRANCH"
else
lognote "No branch matching $SRC_BRANCH found for $SOURCEPKG."
logwarn "No branch matching $SRC_BRANCH found for $SOURCEPKG."
SOURCEPKG_BRANCH="$DEFAULT_BRANCH"
fi

lognote "Using $SOURCEPKG_BRANCH branch for $SOURCEPKG"
logwarn "Using $SOURCEPKG_BRANCH branch for $SOURCEPKG"
}

# This function will be used to install the source package from the source. Needs
Expand Down Expand Up @@ -253,18 +257,18 @@ install_test(){

run_doctest() {
# This will make sure all the files in the lib directory are present and working.
loginfo "Running unit document tests."
if ! python3 setup.py nosetests --tests lib; then
loginfo "Running unit document conformance."
if ! python3 setup.py nosetests --conformance lib; then
logerror "Test failed."
exit 1
fi
logok "Unit document tests done."
logok "Unit document conformance done."
}

run_tests() {
run_conformance() {
# This will run conformance test to make sure the brush engine is working.
# NOTE: Might need to run with xvfb too since it skiping certian tests.
loginfo "Running conformance tests."
# NOTE: Might need to run with xvfb too since it skiping certian conformance.
loginfo "Running conformance conformance."
if ! python3 setup.py test; then
logerror "Test failed."
exit 1
Expand Down Expand Up @@ -306,15 +310,28 @@ case "$1" in
clean)
clean_local_repo
;;
tests)
run_tests
run_doctest
install_test
run-test)
case $2 in
doctest)
run_doctest
;;
conformance)
run_conformance
;;
install-test)
install_test
;;
*)
logerror "Unknown test command: $2"
exit 2
;;
esac
;;
demo)
run_demo
;;
*)
logerror "Unknown command: $1"
grep '^#:' $0 | cut -d ':' -f 2-50
exit 2
;;
Expand Down

0 comments on commit 906326b

Please sign in to comment.