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

GitHub Actions CI workflow #720

Merged
merged 3 commits into from
Sep 13, 2024
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
23 changes: 23 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: FLExTrans CI

on: [push, pull_request]

jobs:
test-with-validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: dependencies
run: |
sudo apt-get -qy update
sudo apt-get -qfy install wget ca-certificates
wget -q https://apertium.projectjj.com/apt/install-nightly.sh -O - | sudo bash
sudo apt-get install apertium-all-dev
- name: test
run: python test_rule_assistant.py
test-on-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: test
run: python test_rule_assistant.py
28 changes: 20 additions & 8 deletions test_rule_assistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,23 +62,35 @@ def runTest(self):
self.assertIn((f'Added {self.RuleCount} rule(s) from {path}.',),
report.infos)

# Validate rules
validate = subprocess.run(
['apertium-validate-transfer', t1xFile],
text=True, check=False, capture_output=True,
)
self.assertEqual(0, validate.returncode)
if os.name == 'posix':
# Validate rules
validate = subprocess.run(
['apertium-validate-transfer', t1xFile],
text=True, check=False, capture_output=True,
)
self.assertEqual(0, validate.returncode)
# We don't install apertium-validate-transfer with FLExTrans,
# so don't run this check on Windows.

comp_cmd = 'apertium-preprocess-transfer'
run_cmd = 'apertium-transfer'
if os.name == 'nt':
comp_cmd = f'Apertium4Windows\\{comp_cmd}.exe'
run_cmd = f'Apertium4Windows\\{run_cmd}.exe'

# Compile rules
preproc = subprocess.run(
['apertium-preprocess-transfer', t1xFile, binFile],
[comp_cmd, t1xFile, binFile],
text=True, check=False, capture_output=True,
)
if preproc.returncode != 0:
print(preproc.stdout)
print(preproc.stderr)
self.assertEqual(0, preproc.returncode)

# Apply rules
proc = subprocess.Popen(
['apertium-transfer', '-b', '-z', t1xFile, binFile],
[run_cmd, '-b', '-z', t1xFile, binFile],
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)
Expand Down
Loading