Skip to content

Commit

Permalink
ci: improve ci and test performance
Browse files Browse the repository at this point in the history
  • Loading branch information
afuetterer committed Aug 4, 2023
1 parent e9075d0 commit 3050588
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 36 deletions.
32 changes: 16 additions & 16 deletions .github/workflows/render-readme.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
on:
push:
paths:
- README.md

name: Render README

on:
push:
paths:
- README.md

jobs:
render:
name: Render README
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Render README
run: tools/render-readme.sh
- name: Commit results
run: |
git commit README.md -m 'Render README.md' || echo "No changes to commit"
git push origin || echo "No changes to commit"
render:
name: Render README
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Render README
run: tools/render-readme.sh
- name: Commit results
run: |
git commit README.md -m 'Render README.md' || echo "No changes to commit"
git push origin || echo "No changes to commit"
1 change: 1 addition & 0 deletions .github/workflows/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pytest
27 changes: 16 additions & 11 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,31 @@
on: push

name: Run tests

on:
push:
branches:
- master
pull_request:

jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Use Python 3.8
uses: actions/setup-python@v2
- name: Use Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.8'

- name: Update package index
run: sudo apt-get update
python-version: '3.11'
cache: pip
cache-dependency-path: .github/workflows/requirements.txt

- name: Install xmllint
run: sudo apt-get install -y libxml2-utils
run: |
sudo apt install --yes libxml2-utils
xmllint --version
- name: Install requirements
run: pip install pytest
run: pip install -r .github/workflows/requirements.txt

- name: Run tests
run: pytest
14 changes: 5 additions & 9 deletions tests/test_xml.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import os
import xml.etree.ElementTree as ET
from pathlib import Path
from subprocess import check_call

import pytest

PATHS = ["rdmorganiser", "shared"]
TAGS = [
PATHS = ("rdmorganiser", "shared")
PATHS = (Path(p) for p in PATHS)
TAGS = {
"condition",
"attribute",
"optionset",
Expand All @@ -17,16 +17,12 @@
"question",
"task",
"view",
]
}


def walk_xml_files():
for path in PATHS:
for root, dirs, files in os.walk(path):
for file in files:
file_path = Path(root) / file
if file_path.suffix == ".xml":
yield file_path
yield from path.rglob("*.xml")


@pytest.mark.parametrize("xml_file", walk_xml_files())
Expand Down

0 comments on commit 3050588

Please sign in to comment.