-
Notifications
You must be signed in to change notification settings - Fork 49
Create new action to measure code coverage of our test suite #8278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
g1rly-c0d3r
wants to merge
132
commits into
main
Choose a base branch
from
issue-8264
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+185
−1
Open
Changes from all commits
Commits
Show all changes
132 commits
Select commit
Hold shift + click to select a range
2c1e6a1
chore: add modules to requirements-testing.txt that are needed for te…
g1rly-c0d3r 18c15fe
fix: expose specifyweb.settings to pytest-django
g1rly-c0d3r 262a908
Merge branch 'main' of github.com:specify/specify7 into issue-8228
g1rly-c0d3r 2d11cb0
Merge branch 'main' of github.com:specify/specify7 into issue-8228
g1rly-c0d3r cbb4d7f
Merge branch 'main' of github.com:specify/specify7 into issue-8228
g1rly-c0d3r cffe14e
added a new test
g1rly-c0d3r de8b58c
get meminfo
g1rly-c0d3r c8d1719
feat(meta): added a new github action to report on code coverage
g1rly-c0d3r 25aca9a
Merge branch 'main' of github.com:specify/specify7 into issue-8264
g1rly-c0d3r 66fe30b
fix: added required `runs-on` parameter
g1rly-c0d3r 3e44a47
chore: fix if clause of setup job to trigger if a file was changed or…
g1rly-c0d3r c7337c5
fix: added a retention-days field so that the report does not linger
g1rly-c0d3r 344799c
fix: removed doubly starting the docker container
g1rly-c0d3r 27c5896
fix: changed secret name
g1rly-c0d3r 2bfc8aa
fix: added dependancy to install list for coverage action
g1rly-c0d3r e868f94
temp: added debugging output
g1rly-c0d3r bccbd6f
fix: read ssh key from stdin
g1rly-c0d3r 16e2a0a
chore: remove debugging output added in e868f94628a
g1rly-c0d3r c5804ac
chore: update readme to document new secret key
g1rly-c0d3r 9ef2fcb
fix: terminate sed s-expression
g1rly-c0d3r aa25971
fix: allow discovery of run-coverage
g1rly-c0d3r f975f2c
fix: manually find the path to run-coverage
g1rly-c0d3r e14f0a9
fix: combine setup and run jobs so that they exist on the same VM
g1rly-c0d3r 9a6f0bb
fix: dont change database name when configuring specify
g1rly-c0d3r fd96f57
chore: view logs of containers
g1rly-c0d3r ec71760
chore: debugging why mariadb is not accessable
g1rly-c0d3r e55e91f
chore: moving docker exec to the top
g1rly-c0d3r cd6df30
chore: check out docker ps
g1rly-c0d3r 65ea138
chore: view stats
g1rly-c0d3r 578b128
fix(trees): sync tree conformation with URL cache
grantfitzsimmons b3d8b9b
fix(trees): tree view initial sync
grantfitzsimmons 2ff4a34
Script: "Add Django EOL checker script (fail if <180 days to EOL)"
CarolineDenis 629a4f6
Github: Add github CI for EOL dependencies
CarolineDenis 99345e4
Fix: Improve run time out handling
CarolineDenis 8fff9ec
Test: Create pr comments when warning triggered
CarolineDenis fa482ef
Fix: Fix installation
CarolineDenis 8115889
Fix: Add timeout
CarolineDenis 6bd897e
Fix: Add timeout to CI
CarolineDenis 608776b
Fix: Alignement
CarolineDenis e0773af
Fix: Handle backticks
CarolineDenis 0a734d2
Comment
CarolineDenis e8c0147
Clean
CarolineDenis 8eaafc3
Fix: test new install for dependecies
CarolineDenis eacface
Fix: Typo
CarolineDenis 84328c9
Fix: Create or Update github action comment
CarolineDenis af0d0e9
Test
CarolineDenis c9544b3
Feat: Generalize EOL script
CarolineDenis 9d32681
Fix: fix python version
CarolineDenis 9eb047c
Feat: Combine github comments
CarolineDenis 256c7cc
Fix: Indentation
CarolineDenis f89833d
Refactor: Allow expension of EOL tracking
CarolineDenis 6b7457a
Fix: remove install
CarolineDenis 20f804e
Fix: fix path
CarolineDenis 459d299
Fix: Update imports
CarolineDenis 4890ad7
Fix: Add init
CarolineDenis 9260ff5
Update .github/workflows/test.yml
CarolineDenis 2da603a
fix: apply CodeRabbit auto-fixes
coderabbitai[bot] c490002
Fix: Handle None dates
CarolineDenis ea2f299
Fix: Handle string and integer cycle
CarolineDenis 4343142
Fix: handle failed request
CarolineDenis 692d5fc
Fix: Improve regex
CarolineDenis 928846c
Potential fix for pull request finding 'CodeQL / Empty except'
CarolineDenis fdd7a93
Potential fix for pull request finding 'CodeQL / Empty except'
CarolineDenis 406a949
Potential fix for pull request finding 'CodeQL / Empty except'
CarolineDenis 1141650
Potential fix for pull request finding 'CodeQL / Empty except'
CarolineDenis f6a9051
fix: use pass instead of continue in scanner
grantfitzsimmons 6e23b61
fix: update about info
grantfitzsimmons 0938216
chore: minor style adjustment
grantfitzsimmons aac284b
created a permit object
rijulpoudel 7f80d03
[test]: saved + verify all fields persisted
rijulpoudel c553774
[test]: create mew issued by agent
rijulpoudel d324649
[test]: create mew issued to agent
rijulpoudel e5815c9
[test]: create permit with existing agent + new agents
rijulpoudel 96c7aab
[test]: verify save + agent relationships
rijulpoudel 653f11a
fix: use simpler approach
grantfitzsimmons baede98
Sync localization strings with Weblate
9b91880
chore: update README
grantfitzsimmons 73e9401
chore: add data ownership mention
grantfitzsimmons 37274f1
fix: add podman
grantfitzsimmons 95e36c1
fix: add links
grantfitzsimmons 1faf199
Lint code with ESLint and Prettier
grantfitzsimmons f11db91
Sync localization strings with Weblate
melton-jason d53f8be
Sync localization strings with Weblate
melton-jason f996b9f
Sync localization strings with Weblate
c7950ee
[test]: Backend unit test for Like operator (basic)
rijulpoudel 4ed2d1d
[test]: Backend unit test for Like operator (percent wildcard)
rijulpoudel 4ff4ab5
[test]: Backend unit test for Like operator (underscore wildcard)
rijulpoudel 97659ce
[test]: Backend unit test for Like operator (no wildcard)
rijulpoudel db7eef5
[test]: reduced duplication by extracing a shared assertion
rijulpoudel f6cde74
Sync localization strings with Weblate
a2660b2
Sync localization strings with Weblate
6bf77fe
Sync localization strings with Weblate
a9ad80b
test: check for containers that are no longer running
g1rly-c0d3r 27abc3b
test: try to stat mariadb tempfiles
g1rly-c0d3r c410291
test: cat the entire file to see if it is commented or not
g1rly-c0d3r a1660c8
test: check if mariadb is just slow, and also check out if the socket…
g1rly-c0d3r 85234f3
test: we know mariadb dies now, so lets find out why
g1rly-c0d3r 27b00be
test: check logs of specify7 to see if that is what is trying to crea…
g1rly-c0d3r 619364e
fix: check logs of specify7 to see if that is what is trying to creat…
g1rly-c0d3r c37adce
test: enable verbose logging for mariadb
g1rly-c0d3r a0becac
test: view all logs
g1rly-c0d3r 9785625
fix: restart mariadb then triage user creation
g1rly-c0d3r abc881a
fix: mariadb needs to crash before we restart it
g1rly-c0d3r c210196
test: try to find mysqld.sock
g1rly-c0d3r 289cd25
fix: detach from docker-compose and clean up run params
g1rly-c0d3r 7870684
fix: address CodeRabbit suggestions
g1rly-c0d3r e07d47f
[test]: verify needsSaved propagates from independent collection to p…
rijulpoudel 2614467
[test]: verify independent resource field changes propagate needsSave…
rijulpoudel 37330a1
verify independent subview sub-record changes propagate needsSaved an…
rijulpoudel 351c049
created a permit object
rijulpoudel 4552849
Sync localization strings with Weblate
6fa4a2c
[test]: Backend unit test for Timestamp Created in query results
rijulpoudel 6be8aa8
[test]: Add timestampModified coverage to query results test
rijulpoudel ecf356d
[fix]: Removed unnecessary f string
rijulpoudel 7abb6f4
[test]: create a permit first
rijulpoudel 5b7874f
[test]: creating an attachment
rijulpoudel a683cb8
[test]: verifying attachment is linked
rijulpoudel 2a1d19e
[test]: deleting the attachment
rijulpoudel ace1b1b
[test]: verifying that it's gone
rijulpoudel 08e4230
[fix]: refetch from DB instead of using stale in-memory object
rijulpoudel 80757b3
[fix]: didn
rijulpoudel 1708ce2
final changes
rijulpoudel 3d0ac2d
[fix]: added comments for clarification on permit attachment deletion
rijulpoudel 0deabf5
[fix]: remove .env from branch
rijulpoudel da4607c
Sync localization strings with Weblate
melton-jason ead47e5
created a permit object
rijulpoudel 28e89c5
Merge branch 'main' into issue-8264
g1rly-c0d3r ebe6bd3
Merge branch 'main' into issue-8264
g1rly-c0d3r 9b566c5
fix: remove debugging flag from mariadb container entrypoint
g1rly-c0d3r bfc91ca
fix: re-create .env since that is in `.gitignore` now
g1rly-c0d3r 07882a2
fix: fix yaml syntax
g1rly-c0d3r 16368d7
fix: fix yaml syntax
g1rly-c0d3r File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,168 @@ | ||
| name: Coverage | ||
|
|
||
| on: | ||
| pull_request: | ||
| push: | ||
| workflow_dispatch: | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| jobs: | ||
| # copied from test.yml | ||
| changes: | ||
| name: Check if back-end or front-end files changed | ||
| # Don't run this for pushes generated by push.yml on weblate-localization | ||
| # branch → prevents an infinite loop of actions triggering actions | ||
| # | ||
| # Also, "push" event is not triggered for forks, so need to listen for | ||
| # pull_requests, but only for external ones, so as not to run the action | ||
| # twice | ||
| if: | | ||
| (github.event_name == 'workflow_dispatch' || | ||
| (github.event.head_commit.committer.name != 'Hosted Weblate' && | ||
| github.event.head_commit.committer.name != 'github-actions')) | ||
| && | ||
| ( | ||
| github.event_name != 'pull_request' || | ||
| github.event.pull_request.head.repo.fork == true | ||
| ) | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| backend_changed: ${{ steps.back-end-check.outputs.changed }} | ||
| frontend: ${{ steps.filter.outputs.frontend }} | ||
| frontend_changes: ${{ steps.filter.outputs.frontend_files }} | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Find all changed files | ||
| uses: dorny/paths-filter@v3 | ||
| id: filter | ||
| with: | ||
| base: ${{ github.ref }} | ||
| list-files: escape | ||
| filters: | | ||
| frontend: | ||
| - 'specifyweb/frontend/**' | ||
| backend: | ||
| - '**' | ||
|
|
||
| - name: Check if any non-front-end files changed | ||
| id: back-end-check | ||
| run: | | ||
| changed_files=`echo "${{steps.filter.outputs.backend_files}}" | tr " " "\n" | grep -v 'specifyweb/frontend/' || echo ""` | ||
| echo "Changed back-end files: ${changed_files}" | ||
| echo "changed=$([[ -z "${changed_files}" ]] && echo "" || echo "1")" >> $GITHUB_OUTPUT | ||
|
|
||
| setup-and-run: | ||
| needs: changes | ||
| if: | | ||
| (needs.changes.outputs.backend_changed || | ||
| needs.changes.outputs.frontend) || | ||
| github.event_name == 'workflow_dispatch' | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| runs-on: ubuntu-latest | ||
|
|
||
|
|
||
| steps: | ||
| - name: Install needed packages | ||
| id: apt | ||
| run: | | ||
| sudo apt update | ||
| sudo apt install docker-compose-v2 openssh-client | ||
|
|
||
| - uses: actions/checkout@v4 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Fetch coverage script | ||
| id: clone-coverage | ||
| run: | | ||
| eval "$(ssh-agent -s)" | ||
| ssh-add - <<< '${{ secrets.COVERAGE_SCRIPT_CLONE }}' | ||
| cd ~ | ||
| git clone git@github.com:specify/specify-development | ||
| sudo install -m 0777 -o "$USER" specify-development/scripts/tests/{run-coverage,test_coverage.py} /usr/bin/ | ||
| cd - | ||
|
|
||
| - name: Configure specify | ||
| id: config-specify | ||
| run: | | ||
| cat > .env <<-EOS | ||
| DATABASE_HOST=mariadb | ||
| DATABASE_PORT=3306 | ||
| MYSQL_ROOT_PASSWORD=password | ||
| DATABASE_NAME=specify | ||
|
|
||
| MASTER_NAME=root | ||
| MASTER_PASSWORD=password | ||
| MASTER_HOST=% | ||
|
|
||
| MIGRATOR_NAME=root | ||
| MIGRATOR_PASSWORD=password | ||
| MIGRATOR_HOST=% | ||
|
|
||
| APP_USER_NAME=root | ||
| APP_USER_PASSWORD=password | ||
| APP_HOST=% | ||
|
|
||
| ALLOW_SUPPORT_LOGIN=false | ||
| SUPPORT_LOGIN_TTL=180 | ||
|
|
||
| SECRET_KEY=change_this_to_some_unique_random_string | ||
|
|
||
| ASSET_SERVER_URL=http://host.docker.internal/web_asset_store.xml | ||
| ASSET_SERVER_KEY=your_asset_server_access_key | ||
| REDIS_HOST=redis | ||
| REDIS_PORT=6379 | ||
| REDIS_DB_INDEX=0 | ||
|
|
||
| REPORT_RUNNER_HOST=report-runner | ||
| REPORT_RUNNER_PORT=8080 | ||
|
|
||
| CELERY_BROKER_URL=redis://redis/0 | ||
| CELERY_RESULT_BACKEND=redis://redis/1 | ||
|
|
||
| TIME_ZONE=America/Chicago | ||
|
|
||
| LOG_LEVEL=WARNING | ||
|
|
||
| SP7_DEBUG=true | ||
| EOS | ||
|
|
||
| sed -i 's/#[ ]*\(.*requirements-testing.txt\)/\1/; s/\(COPY\) \(requirements-testing.txt\)/\1 --chown=specify:specify \2/' Dockerfile | ||
| sed -i 's/\(\(DATABASE_\|MASTER_\|MIGRATOR\|APP_USER_\)[^O].*\) = \(.*\)/\1 = os.environ.get("\1", "")/' specifyweb/settings/specify_settings.py | ||
| for i in range {0..3}; do | ||
| sudo chmod a+x $(find . -type d) | ||
| sudo chmod -R a+rw . | ||
| done | ||
| docker compose up --build -d | ||
|
|
||
| - name: Fix mariadb | ||
| id: reboot-mariadb | ||
| run: | | ||
| sleep 10 | ||
| docker compose up -d mariadb | ||
| sleep 10 | ||
| docker exec mariadb mariadb -uroot -ppassword -e"DROP USER root; | ||
| CREATE USER 'root'@'%' IDENTIFIED BY 'password'; | ||
| GRANT ALL ON *.* TO 'root'@'%' IDENTIFIED BY 'password'; | ||
| DROP DATABASE IF EXISTS specify;" | ||
| docker compose down | ||
| docker compose up -d | ||
| sleep 10 | ||
|
|
||
|
|
||
| - name: Run the script | ||
| id: run-coverage | ||
| run: run-coverage -t pj -a pj -d pj -o html,csv | ||
|
|
||
|
|
||
| - name: Upload report as artifact | ||
| uses: actions/upload-artifact@v7 | ||
| with: | ||
| name: coverage-report | ||
| path: ./report.tar.bz2 | ||
| archive: false | ||
| retention-days: 1 | ||
|
|
||
|
|
||
This file contains hidden or 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,2 @@ | ||
| [pytest] | ||
| DJANGO_SETTINGS_MODULE = specifyweb.settings |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.