Skip to content
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

Only run Python tests when PR contains more than .po's #2133

Merged
merged 2 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,37 @@ jobs:
runs-on: ubuntu-latest

steps:
# Define which file extensions, when touched, should trigger the
# Python tests, so we can skip this Action if we've only touched .po files
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
non_pofiles:
- '**.txt'
- '**.yml'
- '**.in'
- '**.py'

# Clones the openedx-translations repo
- name: clone openedx/openedx-translations
uses: actions/checkout@v3

- name: Install gettext
if: steps.filter.outputs.non_pofiles == 'true'
run: |
sudo apt install -y gettext

# Sets up Python
- name: setup python
if: steps.filter.outputs.non_pofiles == 'true'
uses: actions/setup-python@v4
with:
python-version: '3.8'

# Run the script
- name: run python tests
if: steps.filter.outputs.non_pofiles == 'true'
run: |
make test_requirements
make test
14 changes: 13 additions & 1 deletion .github/workflows/validate-translation-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
name: Validate translation PO files

on:
pull_request:
- pull_request

jobs:
validate-po-files:
Expand All @@ -12,16 +12,28 @@ jobs:
contents: read
pull-requests: write
steps:
# Define .po filepaths, so we can skip this action unless a .po
# file has been modified in this diff
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
pofiles:
- '**.po'

# Clones the openedx-translations repo
- name: clone openedx/openedx-translations
if: steps.filter.outputs.pofiles == 'true'
uses: actions/checkout@v3

- name: Install gettext
if: steps.filter.outputs.pofiles == 'true'
run: |
sudo apt install -y gettext

- name: Validate translation files
id: validate_translation_files
if: steps.filter.outputs.pofiles == 'true'
run: |
has_validation_errors=0
python scripts/validate_translation_files.py 2>validation_errors.txt || has_validation_errors=1
Expand Down