Merge pull request #1785 from sand-boa/sand-boa-injuries-fix #168
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: [push, workflow_dispatch, pull_request] | |
jobs: | |
# Run unittest tests. | |
unittest: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Python 3.11 x64 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
architecture: 'x64' | |
- name: Download the test saves | |
run: wget https://github.com/ImLvna/clangen-unittest-saves/archive/refs/heads/main.zip -O tests/saves.zip | |
- name: Unzip | |
run: unzip tests/saves.zip | |
- name: Move the folder | |
run: mv clangen-unittest-saves-main tests/testSaves | |
- name: Remove the zip | |
run: rm tests/saves.zip | |
- name: Install poetry | |
uses: abatilo/actions-poetry@v2 | |
with: | |
poetry-version: 1.4.1 | |
- name: install dependencies | |
run: poetry install | |
- name: Run unit tests | |
env: | |
SDL_VIDEODRIVER: "dummy" | |
SDL_AUDIODRIVER: "disk" | |
run: poetry run python3 -m unittest tests/test_thoughts.py tests/test_relation_events.py tests/test_conditions.py tests/test_utility.py tests/test_cat.py tests/test_save.py | |
# Check if file encoding is correct. | |
encoding_test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Python 3.11 x64 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
architecture: 'x64' | |
- name: Install poetry | |
uses: abatilo/actions-poetry@v2 | |
with: | |
poetry-version: 1.4.1 | |
- name: Check file encoding | |
id: encoding_test | |
run: poetry run python3 tests/test_encoding.py test | |
- name: Fix the issue hopefully | |
if: ${{ failure() && github.event_name == 'push'}} | |
id: fixit | |
env: | |
FILES: ${{ steps.encoding_test.outputs.files }} | |
run: poetry run python3 tests/test_encoding.py fix | |
- name: Make a pr | |
if: ${{ failure() && steps.fixit.conclusion == 'success' && github.event_name == 'push' }} | |
uses: peter-evans/create-pull-request@v3 | |
with: | |
commit-message: Fix file encoding | |
title: Fix file encoding | |
body: | | |
This PR fixes the file encoding. The files that were changed are: ${{ steps.encoding_test.outputs.files }} | |
branch: fix-file-encoding | |
delete-branch: true | |
token: ${{ secrets.GITHUB_TOKEN }} | |
branch-suffix: random | |
json_test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Python 3.11 x64 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
architecture: 'x64' | |
- name: Install poetry | |
uses: abatilo/actions-poetry@v2 | |
with: | |
poetry-version: 1.4.1 | |
- name: install dependencies | |
run: poetry install | |
- name: Check json validity | |
run: poetry run python3 tests/test_json.py | |
pronoun_test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Python 3.11 x64 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
architecture: 'x64' | |
- name: Install poetry | |
uses: abatilo/actions-poetry@v2 | |
with: | |
poetry-version: 1.4.1 | |
- name: install dependencies | |
run: poetry install | |
- name: Check for pronoun tag errors in resources | |
run: poetry run python3 -m unittest tests/test_pronouns.py |