forked from opengisch/qgis-plugin-ci
-
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.
fine tune test skipping (opengisch#295)
- Loading branch information
Showing
3 changed files
with
24 additions
and
9 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,31 @@ | ||
import os | ||
|
||
|
||
def can_skip_test(): | ||
"""Check when a test can run.""" | ||
def can_skip_test_github(): | ||
"""Check when the Transifex test can run.""" | ||
is_ci = os.getenv("CI") == "true" | ||
is_main_repo = os.getenv("GITHUB_REPOSITORY") == "opengisch/qgis-plugin-ci" | ||
|
||
if is_ci and is_main_repo: | ||
return False | ||
|
||
if not os.getenv("github_token"): | ||
return True | ||
|
||
return False | ||
|
||
|
||
def can_skip_test_transifex(): | ||
"""Check when the Transifex test can run.""" | ||
is_ci = os.getenv("CI") == "true" | ||
is_main_repo = os.getenv("GITHUB_REPOSITORY") == "opengisch/qgis-plugin-ci" | ||
is_dependabot = os.getenv("GITHUB_ACTOR") == "dependabot[bot]" | ||
|
||
if is_ci and is_main_repo and not is_dependabot: | ||
# Always run the test on CI | ||
return False | ||
|
||
if not os.getenv("tx_api_token") or not os.getenv("github_token"): | ||
# On local, the token must be set | ||
if not os.getenv("tx_api_token"): | ||
return True | ||
|
||
return False |