-
-
Notifications
You must be signed in to change notification settings - Fork 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Separate backend and client tests to have indepdendent badges
- Loading branch information
Showing
8 changed files
with
106 additions
and
77 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
This file was deleted.
Oops, something went wrong.
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
|
||
backend_test_failed=0 | ||
|
||
setupBackend() { | ||
cd $GITHUB_WORKSPACE/backend # to install backend dependencies | ||
pip3 install -r requirements/requirements-$(lsb_release -cs).txt | ||
} | ||
|
||
echo "Running setup" | ||
sudo apt-get update | ||
sudo apt-get install -y tor | ||
pip install coverage | ||
setupBackend | ||
|
||
# Running backend tests | ||
echo "Running backend tests" | ||
cd $GITHUB_WORKSPACE/backend && coverage run setup.py test | ||
if [ $? -ne 0 ]; then | ||
backend_test_failed=1 | ||
fi | ||
|
||
cd $GITHUB_WORKSPACE/backend && coverage xml | ||
bash <(curl -Ls https://coverage.codacy.com/get.sh) report -l Python -r $GITHUB_WORKSPACE/backend/coverage.xml | ||
|
||
if [ $backend_test_failed -eq 1 ]; then | ||
echo "Backend unit tests: FAILED" | ||
exit 1 | ||
else | ||
echo "Backend unit tests: PASSED" | ||
exit 0 | ||
fi |
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/bash | ||
|
||
client_test_failed=0 | ||
|
||
setupBackend() { | ||
cd $GITHUB_WORKSPACE/backend # to install backend dependencies | ||
pip3 install -r requirements/requirements-$(lsb_release -cs).txt | ||
} | ||
|
||
setupClient() { | ||
cd $GITHUB_WORKSPACE/client # to install frontend dependencies | ||
npm install -d | ||
./node_modules/grunt/bin/grunt build_and_instrument | ||
} | ||
|
||
echo "Running setup" | ||
sudo apt-get update | ||
sudo apt-get install -y tor | ||
npm install -g grunt grunt-cli | ||
setupBackend | ||
setupClient | ||
|
||
$GITHUB_WORKSPACE/backend/bin/globaleaks -z | ||
sleep 5 | ||
|
||
# Running client tests locally | ||
echo "Running client tests locally collecting code coverage" | ||
cd $GITHUB_WORKSPACE/client && npm test | ||
if [ $? -ne 0 ]; then | ||
client_test_failed=1 | ||
fi | ||
|
||
bash <(curl -Ls https://coverage.codacy.com/get.sh) report -l TypeScript -r $GITHUB_WORKSPACE/client/cypress/coverage/lcov.info | ||
|
||
if [ $client_test_failed -eq 1 ]; then | ||
echo "Client tests: FAILED" | ||
exit 1 | ||
else | ||
echo "Client tests: PASSED" | ||
exit 0 | ||
fi |
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Tests (Backend) | ||
|
||
on: [ push, pull_request ] | ||
|
||
# Declare default permissions as read only. | ||
permissions: read-all | ||
|
||
env: | ||
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} | ||
|
||
jobs: | ||
run_tests: | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- name: Check out repository code | ||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Install git | ||
run: | | ||
sudo apt-get update -q | ||
sudo apt-get install -y git | ||
- name: Run tests | ||
run: | | ||
cd $GITHUB_WORKSPACE | ||
./.github/workflows/scripts/run-tests-backend.sh |
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
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