Skip to content

Commit a22dc89

Browse files
authored
Merge pull request #2 from IPLSplatoon/1.2.0
1.2.0 Update
2 parents 5135174 + be0aadb commit a22dc89

File tree

15 files changed

+954
-110
lines changed

15 files changed

+954
-110
lines changed

.github/workflows/publish-to-pypi.yml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,30 @@ jobs:
2626
virtualenvs-in-project: true
2727
installer-parallel: true
2828
- name: Install dependencies
29-
run: poetry install --no-interaction --no-root
29+
run: poetry install --no-interaction --no-root --with=dev,ci
30+
- name: Check Schema Hash with upstream
31+
run: |
32+
source .venv/bin/activate
33+
python scripts/checkUpstreamSchema.py
34+
- name: Run tests
35+
env:
36+
REPORT_OUTPUT: md_report.md
37+
shell: bash
38+
run: |
39+
source .venv/bin/activate
40+
echo "REPORT_FILE=${REPORT_OUTPUT}" >> "$GITHUB_ENV"
41+
pytest -v --md-report --md-report-flavor gfm --md-report-exclude-outcomes passed skipped xpassed --md-report-output "$REPORT_OUTPUT"
42+
- name: Output reports to the job summary when tests fail
43+
if: failure()
44+
shell: bash
45+
run: |
46+
if [ -f "$REPORT_FILE" ]; then
47+
echo "<details><summary>Failed Test Report</summary>" >> $GITHUB_STEP_SUMMARY
48+
echo "" >> $GITHUB_STEP_SUMMARY
49+
cat "$REPORT_FILE" >> $GITHUB_STEP_SUMMARY
50+
echo "" >> $GITHUB_STEP_SUMMARY
51+
echo "</details>" >> $GITHUB_STEP_SUMMARY
52+
fi
3053
- name: Mint token
3154
id: mint
3255
uses: tschm/[email protected]

.github/workflows/pull_request.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Pull request
2+
3+
# Make sure only the latest push to the PR's source branch runs and cancel any on-going previous run
4+
concurrency:
5+
group: ${{ github.head_ref }}
6+
cancel-in-progress: true
7+
8+
on:
9+
pull_request:
10+
11+
jobs:
12+
Pull-Request:
13+
runs-on: ubuntu-latest
14+
permissions:
15+
pull-requests: write
16+
steps:
17+
- name: Check out repository
18+
uses: actions/checkout@v4
19+
- name: Set up python
20+
id: setup-python
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: '3.11'
24+
- name: Install Poetry
25+
uses: snok/install-poetry@v1
26+
with:
27+
virtualenvs-create: true
28+
virtualenvs-in-project: true
29+
installer-parallel: true
30+
- name: Install dependencies
31+
run: poetry install --no-interaction --no-root --with=dev,ci
32+
- name: Check Schema Hash with upstream
33+
run: |
34+
source .venv/bin/activate
35+
python scripts/checkUpstreamSchema.py
36+
- name: Install library
37+
run: poetry install --no-interaction
38+
- name: Run tests
39+
env:
40+
REPORT_OUTPUT: md_report.md
41+
shell: bash
42+
run: |
43+
source .venv/bin/activate
44+
echo "REPORT_FILE=${REPORT_OUTPUT}" >> "$GITHUB_ENV"
45+
pytest -v --md-report --md-report-flavor gfm --md-report-exclude-outcomes passed skipped xpassed --md-report-output "$REPORT_OUTPUT"
46+
- name: Render the report to the PR when tests fail
47+
uses: marocchino/sticky-pull-request-comment@v2
48+
if: failure()
49+
with:
50+
header: test-report
51+
recreate: true
52+
path: ${{ env.REPORT_FILE }}

README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,48 @@ asyncio.run(run())
4141
## Getting an API Key
4242
To use this library, you must have an API key. You need to DM Sendou for an API Key currently.
4343

44+
## Development
45+
For development, you'll need [Poetry](https://python-poetry.org) installed for dependency management and building distributions
46+
47+
### Dev Dependencies
48+
When install dependencies for development run
49+
50+
```bash
51+
poetry install --with=dev
52+
```
53+
54+
*In CI you way want to run `poetry install --with=dev,ci` that includes CI dependencies for GitHub Actions*
55+
56+
### Testing
57+
This package has *some* tests, these are written with pytest and can be run with
58+
59+
```bash
60+
pytest
61+
```
62+
63+
*You likely need to run `poetry install` before executing pytest*
64+
65+
### Tracking Upstream Schema
66+
This package uses sendou.ink's [Public API Schema](https://github.com/Sendouc/sendou.ink/blob/rewrite/app/features/api-public/schema.ts)
67+
file to design the models uses in the package. To keep track of where the package is in relation to the upstream schema,
68+
the commit sha of the upstream schema is kept in the `pyproject.toml` file under `tool.sendou-py.source`.
69+
70+
There are 2 scripts that help keep this package inline with the upstream schema.
71+
72+
#### Upstream Schema Commit SHA checker
73+
This script uses the GitHub API to check that the SHA stored in `tool.sendou-py.source` matches the latest commit for
74+
for the upstream schema.
75+
76+
```bash
77+
python3 python3 scripts/checkUpstreamSchema.py
78+
```
79+
80+
81+
#### Update local SHA with Upstream Schema Commit SHA
82+
This script pulls down the latest SHA hash for the upstream schema and saves it to the `pyproject.toml` file
83+
84+
```bash
85+
python3 scripts/updateUpstreamSchema.py
86+
```
87+
88+
**This should only be run after dev has checked their changes match the upstream schema**

0 commit comments

Comments
 (0)