Skip to content

Commit

Permalink
Adds validation and final 0.0.9 fixes (#34)
Browse files Browse the repository at this point in the history
* Adds validation and final 0.0.9 fixes

* [pre-commit.ci] auto fixes from pre-commit.com hooks

* Merge

* Add known first party

* [pre-commit.ci] auto fixes from pre-commit.com hooks

* Fix CI

* Fix CI

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
sobolevn and pre-commit-ci[bot] authored May 21, 2024
1 parent 141a4af commit 22c7515
Show file tree
Hide file tree
Showing 17 changed files with 332 additions and 59 deletions.
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,10 @@ updates:
interval: daily
time: "02:00"
open-pull-requests-limit: 10

- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
time: "02:00"
open-pull-requests-limit: 10
30 changes: 30 additions & 0 deletions .github/workflows/shellcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: shellcheck

on:
push:
branches:
- master
paths:
- 'tools/**/*.sh'
- '.github/workflows/shellcheck.yml'
pull_request:
paths:
- 'tools/**/*.sh'
- '.github/workflows/shellcheck.yml'
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ludeeus/action-shellcheck@2.0.0
env:
SHELLCHECK_OPTS: --shell bash
with:
severity: style
check_together: 'yes'
48 changes: 48 additions & 0 deletions .github/workflows/tools.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: test-tools

on:
push:
branches:
- master
paths:
- "tools/**"
- '.github/workflows/tools.yml'
pull_request:
paths:
- "tools/**"
- '.github/workflows/tools.yml'
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: read

jobs:
mypy:
name: Run mypy
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install poetry
run: |
curl -sSL "https://install.python-poetry.org" | python
# Adding `poetry` to `$PATH`:
echo "$HOME/.poetry/bin" >> $GITHUB_PATH
- name: Install dependencies
run: |
cd tools
poetry config virtualenvs.in-project true
poetry run pip install -U pip
poetry install
- run: cd tools && poetry run mypy *.py
42 changes: 42 additions & 0 deletions .github/workflows/validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: validate

on:
push:
branches:
- master
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: read

jobs:
validate:
name: Run validation
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install poetry
run: |
curl -sSL "https://install.python-poetry.org" | python
# Adding `poetry` to `$PATH`:
echo "$HOME/.poetry/bin" >> $GITHUB_PATH
- name: Install dependencies
run: |
cd tools
poetry config virtualenvs.in-project true
poetry run pip install -U pip
poetry install
- run: poetry run -C tools bash tools/validate.sh
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@
- Clarified `Legacy` rules
- Clarified `Redirect` rules
- Simplified `Monitoring` and `Firewall` rules: they now don't interact with `sudo`
- Changed `Supply chain` card: it does not have ⚙️ effect anymore
- Tweaked `Frontend` social interaction, again
- Tweaked some minor wordings on multiple cards
- Tweaked multiple other social interactions a bit
- Fixed fonts on multiple cards
- Added "Pytup" rule special card

## Version 0.0.8

Expand Down
Binary file modified ru/cards.numbers
Binary file not shown.
Binary file modified ru/counts.numbers
Binary file not shown.
3 changes: 3 additions & 0 deletions tools/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ set -x
# Clean existing build:
rm -rf build

# Run validation:
source tools/validate.sh

# Just all cards types in one pdf:
CARDS_PDF="$1"
# All cards in one pdf, with correct counts, useful for printing:
Expand Down
2 changes: 1 addition & 1 deletion tools/generate-images-from-pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import io
import os

import pypdfium2 as pdf
import pypdfium2 as pdf # type: ignore[import-untyped]


def _render_images(cards: io.BytesIO, output_dir: str) -> None:
Expand Down
17 changes: 3 additions & 14 deletions tools/generate-pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,9 @@
import io
import os

import numbers_parser
import pypdfium2 as pdf
import pypdfium2 as pdf # type: ignore[import-untyped]


def _read_counts(counts_path: str) -> list[int]:
document = numbers_parser.Document(counts_path)
table = document.sheets[0].tables[0]

read_counts = []
for row in range(table.num_rows):
cell = table.cell(f"C{row + 1}").value
if cell:
read_counts.append(int(cell))
return read_counts
from ship_it_tools import counts


def _write_cards_with_counts(
Expand Down Expand Up @@ -81,7 +70,7 @@ def main() -> None:
parsed_args = parser.parse_args()
_write_cards_with_counts(
parsed_args.cards,
_read_counts(parsed_args.counts),
counts.read_counts(parsed_args.counts),
parsed_args.output_file,
)

Expand Down
Loading

0 comments on commit 22c7515

Please sign in to comment.