Skip to content

Commit

Permalink
Add frontend unit tests to run on github actions on PR (#703)
Browse files Browse the repository at this point in the history
* Add frontend unit tests to run on PR.

* Specify path to pakcage.json on tests github action.

* Add a step to install frontend dependencies.

* Set the tests workflow to only run on push to main.

* Use working directory instead of npm --prefix in frontend tests github action.

* Set push branch back to main on tests github action.

* Use make commands to run tests on github tests action.
  • Loading branch information
superhindupur authored Apr 17, 2024
1 parent 610c6cb commit f3181ce
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
echo "MIN_COVERAGE=$MIN_COVERAGE" >> "$GITHUB_OUTPUT"
- name: Run Unit tests
run: poetry run pytest -m "not azure and not functional" --junitxml=coverage-junit.xml --cov=. --cov-report xml:coverage.xml --cov-fail-under ${{ steps.coverage-value.outputs.MIN_COVERAGE }}
run: make unittest optional_args="--junitxml=coverage-junit.xml --cov=. --cov-report xml:coverage.xml --cov-fail-under ${{ steps.coverage-value.outputs.MIN_COVERAGE }}"
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
Expand All @@ -89,4 +89,12 @@ jobs:
coverage.xml
if-no-files-found: error
- name: Run Functional tests
run: poetry run pytest -m "functional"
run: make functionaltest
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
cache-dependency-path: "code/frontend/package-lock.json"
- name: Run frontend unit tests
run: make unittest-frontend
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ lint: ## 🧹 Lint the code

unittest: ## 🧪 Run the unit tests
@echo -e "\e[34m$@\e[0m" || true
@poetry run pytest -m "not azure and not functional"
@poetry run pytest -m "not azure and not functional" $(optional_args)

functionaltest: ## 🧪 Run the functional tests
@echo -e "\e[34m$@\e[0m" || true
Expand Down

0 comments on commit f3181ce

Please sign in to comment.