Skip to content

Commit

Permalink
run spec tests in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
hbmartin committed Oct 3, 2024
1 parent a716b63 commit f839953
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 34 deletions.
64 changes: 32 additions & 32 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,35 @@ jobs:
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Setup Graphviz
uses: ts-graphviz/setup-graphviz@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
id: cpython3
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: requirements.txt
allow-prereleases: true
- run: pip install -r requirements.txt
- run: pip install black ruff pytest pytest-cov
- run: ruff check .
- name: Run mypy if on 3.12, pytype otherwise
run: |
if [[ '${{ steps.cpython3.outputs.python-version }}' == *"3.11"* ]]; then
pip install pytype
pytype -j auto graphviz2drawio
else
echo "pytype does not support >= 3.12: https://github.com/google/pytype/issues/1475"
pip install mypy
mypy graphviz2drawio --ignore-missing-imports
fi
- uses: psf/black@stable
with:
options: "--check --verbose"
- run: pytest --cov
- name: Run main script
run: |
python3 -m graphviz2drawio test/directed/hello.gv.txt
test -f test/directed/hello.gv.xml
- uses: actions/checkout@v4
- name: Setup Graphviz
uses: ts-graphviz/setup-graphviz@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
id: cpython3
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: requirements.txt
allow-prereleases: true
- run: pip install -r requirements.txt
- run: pip install black ruff pytest pytest-cov
- run: ruff check .
- name: Run mypy if on 3.12, pytype otherwise
run: |
if [[ '${{ steps.cpython3.outputs.python-version }}' == *"3.11"* ]]; then
pip install pytype
pytype -j auto graphviz2drawio
else
echo "pytype does not support >= 3.12: https://github.com/google/pytype/issues/1475"
pip install mypy
mypy graphviz2drawio --ignore-missing-imports
fi
- uses: psf/black@stable
with:
options: "--check --verbose"
- run: pytest --cov
- name: Run specs tests script
run: |
mkdir tmp_out
./test_specs.sh test/ specs/ tmp_out/
2 changes: 1 addition & 1 deletion .typos.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[files]
extend-exclude = ["test/**"]
extend-exclude = ["test/**", "specs/**"]
2 changes: 1 addition & 1 deletion test_specs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ process_files() {
local src_dir="$1"
local out_dir="$2"

find "$src_dir" -type f -name "*.gv.txt" | while read -r file; do
find "$src_dir" -type f -name "*.gv.txt" -print0 | while IFS= read -r -d $'\0' file; do
rel_path="${file#$src_dir/}"
output_file="$out_dir/${rel_path%.gv.txt}.xml"
mkdir -p "$(dirname "$output_file")"
Expand Down

0 comments on commit f839953

Please sign in to comment.