Skip to content

Commit

Permalink
Integration test (last 2 releases)
Browse files Browse the repository at this point in the history
  • Loading branch information
vijaiaeroastro committed May 21, 2024
1 parent 2a1e9d2 commit ea0b2c5
Showing 1 changed file with 97 additions and 1 deletion.
98 changes: 97 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -346,4 +346,100 @@ jobs:
- name: Run integration tests
run: |
cd test_suites && python integration_test.py
cd test_suites && python integration_test.py
integration_tests-last-two-releases:
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: true

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
- name: Get latest lib3mf SDK release info from GitHub API
id: get_latest_release
run: |
LATEST_LIB3MF_URL=$(curl -s https://api.github.com/repos/3MFConsortium/lib3mf/releases/latest | grep "browser_download_url.*zip" | cut -d '"' -f 4)
echo "LATEST_LIB3MF_URL=${LATEST_LIB3MF_URL}" >> $GITHUB_ENV
- name: Get second latest lib3mf SDK release info from GitHub API
id: get_second_latest_release
run: |
SECOND_LATEST_LIB3MF_URL=$(curl -s https://api.github.com/repos/3MFConsortium/lib3mf/releases | grep "browser_download_url.*zip" | cut -d '"' -f 4 | sed -n '2p')
echo "SECOND_LATEST_LIB3MF_URL=${SECOND_LATEST_LIB3MF_URL}" >> $GITHUB_ENV
- name: Download latest lib3mf SDK zip
run: |
wget ${{ env.LATEST_LIB3MF_URL }} -O latest_lib3mf_sdk.zip
- name: Download second latest lib3mf SDK zip
run: |
wget ${{ env.SECOND_LATEST_LIB3MF_URL }} -O second_latest_lib3mf_sdk.zip
- name: Unpack the latest SDK
run: |
unzip latest_lib3mf_sdk.zip -d latest_lib3mf_sdk
- name: Unpack the second latest SDK
run: |
unzip second_latest_lib3mf_sdk.zip -d second_latest_lib3mf_sdk
- name: Download and unzip test suite
run: |
wget https://github.com/3MFConsortium/test_suites/releases/download/v2.0.0/3MF_Conformance_Test_Suites_v2.0.0.zip
unzip 3MF_Conformance_Test_Suites_v2.0.0.zip -d test_suites
- name: Copy integration test script
run: |
cp CI/integration_test.py test_suites/
- name: Build and run CppDynamic with latest SDK
run: |
sh latest_lib3mf_sdk/Examples/CppDynamic/GenerateMake.sh
cd latest_lib3mf_sdk/Examples/CppDynamic/build
cmake --build .
cp * ../../../test_suites/
cp *.so ../../../test_suites/ || true
- name: Run integration tests with latest SDK
run: |
cd test_suites
/usr/bin/time -v python integration_test.py 2>&1 | tee latest_sdk_test.log
- name: Clean up latest SDK binaries
run: |
find test_suites -maxdepth 1 ! -name 'integration_test.py' ! -name '3MF_Conformance_Test_Suites_v2.0.0' ! -name 'latest_sdk_test.log' -exec rm -rf {} +
- name: Build and run CppDynamic with second latest SDK
run: |
sh second_latest_lib3mf_sdk/Examples/CppDynamic/GenerateMake.sh
cd second_latest_lib3mf_sdk/Examples/CppDynamic/build
cmake --build .
cp * ../../../test_suites/
cp *.so ../../../test_suites/ || true
- name: Run integration tests with second latest SDK
run: |
cd test_suites
/usr/bin/time -v python integration_test.py 2>&1 | tee second_latest_sdk_test.log
- name: Compare results
run: |
LATEST_TIME=$(grep "Elapsed (wall clock) time" test_suites/latest_sdk_test.log | awk '{print $8}')
SECOND_LATEST_TIME=$(grep "Elapsed (wall clock) time" test_suites/second_latest_sdk_test.log | awk '{print $8}')
echo "Latest SDK execution time: ${LATEST_TIME}"
echo "Second Latest SDK execution time: ${SECOND_LATEST_TIME}"
if [ $(echo "$LATEST_TIME < $SECOND_LATEST_TIME" | bc) -eq 1 ]; then
echo "New release is better"
else
echo "New release is worse"
fi

0 comments on commit ea0b2c5

Please sign in to comment.