-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cb89902
commit 1bbd208
Showing
1 changed file
with
25 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,34 @@ | ||
#!/bin/bash | ||
|
||
# Script for running the selfhosted tests on QPUs directly from GitHub | ||
# Script for running the self-hosted tests on QPUs directly from GitHub | ||
# Tests need to be copied to /tmp/ because coverage does not work with NFS | ||
|
||
cp -r src/qibojit/tests /tmp/ | ||
cp pyproject.toml /tmp/ | ||
cd /tmp/tests | ||
# Create a unique temporary directory | ||
TMP_DIR=$(mktemp -d /tmp/qibojit.XXXXXX) | ||
|
||
# Copy tests to the temporary directory | ||
cp -r src/qibojit/tests "$TMP_DIR" | ||
cp pyproject.toml "$TMP_DIR/" | ||
cd "$TMP_DIR/tests" | ||
|
||
# Activate the test environment | ||
source /nfs/users/github/actions-runner/_work/qibojit/qibojit/testenv/bin/activate | ||
|
||
# Run tests | ||
pytest | ||
pytest_status=$? | ||
if [[ $pytest_status -ne 0 ]] | ||
then | ||
exit $pytest_status | ||
|
||
# Exit if tests fail | ||
if [[ $pytest_status -ne 0 ]]; then | ||
exit $pytest_status | ||
fi | ||
|
||
# Return to the original directory | ||
cd - | ||
mv /tmp/tests/coverage.xml . | ||
mv /tmp/tests/htmlcov . | ||
rm -r /tmp/tests | ||
|
||
# Move coverage results | ||
mv "$TMP_DIR/tests/coverage.xml" . | ||
mv "$TMP_DIR/tests/htmlcov" . | ||
|
||
# Clean up | ||
rm -r "$TMP_DIR" |