Skip to content

Commit

Permalink
Merge branch 'template'
Browse files Browse the repository at this point in the history
  • Loading branch information
liskin committed Nov 29, 2023
2 parents 23ad362 + 684d101 commit efbc0b0
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 17 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ jobs:
uses: liskin/gh-problem-matcher-wrap@v2
with:
linters: pytest
run: make test
- name: readme
run: make test-pytest
- name: cram, readme
run: make readme
- name: check-wheel
run: make check-wheel
Expand Down Expand Up @@ -139,8 +139,8 @@ jobs:
uses: liskin/gh-problem-matcher-wrap@v2
with:
linters: pytest
run: make test
- name: readme
run: make test-pytest
- name: cram, readme
run: make readme
- name: check-wheel
run: make check-wheel
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*.egg-info/
*.md.err
/.*_cache/
/.venv/
/build/
Expand Down
20 changes: 11 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,26 +48,28 @@ lint-isort: $(VENV_DONE)
$(VENV_PYTHON) -m isort --check $(LINT_SOURCES)

.PHONY: test
test: $(VENV_DONE)
test: test-pytest test-cram

.PHONY: test-pytest
test-pytest: $(VENV_DONE)
$(VENV_PYTHON) -m pytest $(PYTEST_FLAGS) tests/

.PHONY: readme
readme: README.md
git diff --exit-code $^

CRAM_TARGETS := $(wildcard .readme.md/*.md)

.PHONY: $(CRAM_TARGETS)
$(CRAM_TARGETS) &: CRAM_INTERACTIVE=$(shell [ -t 0 ] && echo --interactive)
$(CRAM_TARGETS) &: $(VENV_DONE)
.PHONY: test-cram
test-cram: CRAM_INTERACTIVE=$(shell [ -t 0 ] && echo --interactive)
test-cram: $(VENV_DONE)
PATH="$(CURDIR)/$(VENV)/bin:$$PATH" \
XDG_DATA_HOME=/home/user/.local/share \
XDG_CONFIG_HOME=/home/user/.config \
$(VENV_PYTHON) -m cram --indent=4 $(CRAM_INTERACTIVE) $(CRAM_TARGETS)
$(VENV_PYTHON) tests/cram-noescape.py --indent=4 --shell=/bin/bash $(CRAM_INTERACTIVE) \
$(wildcard tests/*.md tests/*/*.md tests/*/*/*.md)

.PHONY: README.md
README.md: $(CRAM_TARGETS)
.readme.md/include.py < $@ > $@.tmp
README.md: test-cram
tests/include.py < $@ > $@.tmp
mv -f $@.tmp $@

.PHONY: dist
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ pip install strava-offline

### Mirror activities metadata

<!-- include .readme.md/help-sqlite.md -->
<!-- include tests/readme/help-sqlite.md -->
$ strava-offline sqlite --help
Usage: strava-offline sqlite [OPTIONS]

Expand Down Expand Up @@ -131,7 +131,7 @@ least once to let strava-offline reuse these downloaded files.

[strava-bulk-export]: https://support.strava.com/hc/en-us/articles/216918437-Exporting-your-Data-and-Bulk-Export#Bulk

<!-- include .readme.md/help-gpx.md -->
<!-- include tests/readme/help-gpx.md -->
$ strava-offline gpx --help
Usage: strava-offline gpx [OPTIONS]

Expand Down Expand Up @@ -164,7 +164,7 @@ least once to let strava-offline reuse these downloaded files.

### Reports

<!-- include .readme.md/help-report.md -->
<!-- include tests/readme/help-report.md -->
$ strava-offline --help | grep report-
report-bikes Show all-time report by bike
report-yearly Show yearly report by activity type
Expand All @@ -191,7 +191,7 @@ which is located at `~/.config/strava_offline/config.yaml` by default

Sample config file can be generated using the `--config-sample` flag:

<!-- include .readme.md/config-sample.md -->
<!-- include tests/readme/config-sample.md -->
$ strava-offline --config-sample
# Perform full sync instead of incremental
full: false
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,7 @@ show_error_codes = true
[tool.isort]
profile = "open_stack"

[tool.ruff]
line-length = 120

# vim:set et:
8 changes: 8 additions & 0 deletions tests/cram-noescape.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env python3

import runpy

import cram # type: ignore [import]

cram._test._needescape = lambda _: False
runpy.run_module('cram')
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit efbc0b0

Please sign in to comment.