Skip to content

Commit

Permalink
[TESTING] Excludes code tests when no changes are made there (hedyorg…
Browse files Browse the repository at this point in the history
…#3456)

We improve our tests by excluding the code snippet tests when there are no relevant changes made in either the /content or the /grammars folder. This reduces our test time significantly, making it easier to work with and reduce the waiting time for validation when working on the front-end / unrelated back-end.
  • Loading branch information
TiBiBa authored Oct 19, 2022
1 parent b1a0bb7 commit 7de3b2b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
24 changes: 21 additions & 3 deletions .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python 3.9
uses: actions/setup-python@v1
with:
Expand All @@ -34,5 +36,21 @@ jobs:
- name: Compiling Babel translations
run: |
pybabel compile -f -d translations
- name: Run validations
run: build-tools/github/validate
- name: Check for changed files in grammar related directories
shell: pwsh
id: check_file_changed
run: |
$diff = git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }}
$SourceDiff = $diff | Where-Object { $_ -match '^content/' -or $_ -match '^grammars/' }
$HasDiff = $SourceDiff.Length -gt 0
Write-Host "::set-output name=docs_changed::$HasDiff"
- name: Run all tests
shell: pwsh
if: steps.check_file_changed.outputs.docs_changed == 'True'
run: |
build-tools/github/validate --all
- name: Run non-code related tests
shell: pwsh
if: steps.check_file_changed.outputs.docs_changed != 'True'
run: |
build-tools/github/validate
4 changes: 3 additions & 1 deletion build-tools/github/validate
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ scriptdir=$(cd $(dirname $0) && pwd)
$scriptdir/validate-python
$scriptdir/validate-typescript
$scriptdir/validate-yaml
$scriptdir/validate-tests
if [[ "${1:-}" == "--all" ]]; then
$scriptdir/validate-tests
fi
$scriptdir/validate-e2e

echo "Everything is great! 🍰"

0 comments on commit 7de3b2b

Please sign in to comment.