-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
3 changed files
with
63 additions
and
5 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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: Test Count Badge | ||
|
||
on: | ||
push: | ||
branches: | ||
- main # Adjust this if your main branch has a different name | ||
|
||
jobs: | ||
count_tests: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.12 | ||
cache: "pip" | ||
|
||
- name: Install Python dependencies | ||
run: | | ||
pip install -r requirements.txt | ||
pip install -r dev-requirements.txt | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
|
||
- name: Install NPM dependencies | ||
run: npm install | ||
working-directory: ./app/web_ui | ||
|
||
- name: Count Python tests | ||
run: | | ||
PYTHON_TEST_COUNT=$(python3 -m pytest --collect-only -q . | grep "tests collected" | awk '{print $1}' | sed 's/[^0-9]//g') | ||
echo "PYTHON_TEST_COUNT=$PYTHON_TEST_COUNT" >> $GITHUB_ENV | ||
- name: Count NPM tests | ||
run: | | ||
JS_TEST_COUNT=$(npx vitest run --no-color | grep 'Tests *[0-9]* passed ([0-9]*)' | awk '{print $2}' | sed 's/[^0-9]*//g') | ||
echo "JS_TEST_COUNT=$JS_TEST_COUNT" >> $GITHUB_ENV | ||
working-directory: ./app/web_ui | ||
|
||
- name: Calculate total test count | ||
run: | | ||
TOTAL_TEST_COUNT=$((PYTHON_TEST_COUNT + JS_TEST_COUNT)) | ||
echo "TOTAL_TEST_COUNT=$TOTAL_TEST_COUNT" >> $GITHUB_ENV | ||
- name: Create test count badge | ||
uses: schneegans/[email protected] | ||
with: | ||
auth: ${{ secrets.GIST_SECRET }} | ||
gistID: 57742c1b1b60d597a6aba5d5148d728e | ||
filename: test_count_kiln.json | ||
label: Test Count | ||
message: ${{ env.TOTAL_TEST_COUNT }} | ||
color: brightgreen |
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,6 +1,7 @@ | ||
# Byte-compiled / optimized / DLL files | ||
|
||
.env | ||
.act_secrets | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
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