forked from ClanGenOfficial/clangen
-
Notifications
You must be signed in to change notification settings - Fork 0
107 lines (104 loc) · 3.55 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: Tests
on: [push, workflow_dispatch, pull_request]
jobs:
# Run unittest tests.
unittest:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.11']
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
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 tests/test_freshkill.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