diff --git a/.github/workflow/build_and_test.yml b/.github/workflow/build_and_test.yml new file mode 100644 index 0000000..a8f1843 --- /dev/null +++ b/.github/workflow/build_and_test.yml @@ -0,0 +1,51 @@ +name: Build Package + +on: + push: + branches: [ "develop" ] + pull_request: + branches: [ "develop" ] + +permissions: + contents: read + +jobs: + build: + # For the sake of simplicity in testing, the Athena packaging program will temporarily run on Ubuntu-latest. + # However, to ensure the stability of the packaging system, we will need to fix the Ubuntu version in the future. + runs-on: ubuntu-latest + + # For the sake of simplicity in testing, the Athena packaging program will temporarily only package executable files for Python 3.8. + # In the future, we will need to extend support to cover Python 3.8 through Python 3.12. + steps: + - name: Setup Python 3.8 + uses: actions/setup-python@v5 + with: + python-version: '3.8' + + # Checkout the latest branch of Athena. + - name: Checkout Athena + uses: actions/checkout@v4 + with: + submodules: true + path: athena + + + # Install Dependencies for Python + - name: Install Dependencies for Python + run: | + python -m pip install --upgrade pip + pip install setuptools wheel build + + # Build Athena + - name: Build Athena + working-directory: ./athena + run: | + python -m build + python -m pip install dist/*.whl + + # Install Test + - name: Run Test + working-directory: ./athena/tests + run: | + bash run_all_test.sh diff --git a/tests/run_all_test.sh b/tests/run_all_test.sh new file mode 100644 index 0000000..311f304 --- /dev/null +++ b/tests/run_all_test.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +failed_scripts=() +whitelist=( + # "tests/test-generate-fusion-op-unittests.sh" +) + +for script in tests/test-generate*.sh; do + if [[ " ${whitelist[@]} " =~ " ${script} " ]]; then + output=$(bash "$script" 2>&1) + status=$? + if [ $status -ne 0 ]; then + failed_scripts+=("$script: $output") + fi + else + echo "Skip $script" + fi +done + +if [ ${#failed_scripts[@]} -gt 0 ]; then + echo "The following tests failed: " + for script in "${failed_scripts[@]}"; do + echo "$script" + done + echo "Failed!" + exit 1 +else + echo "All tests run successfully!" +fi