Skip to content

Commit

Permalink
General fixes
Browse files Browse the repository at this point in the history
- Remove check_text and move to my personal dotfiles bin
- Update README hero image
- Make Directory include_hidden kw only
- Standardize errors, system exit
- Bump up and update GHA modules
- Add trove classifiers to setup.py
- Check with '==' instead of 'is' (Closes #5)
- Add flake8 to pre-commit
- Update utils.display_table
- GHA when releasing, wait for other publish
  • Loading branch information
strboul committed Jul 31, 2022
1 parent 30ea39e commit b59e0e3
Show file tree
Hide file tree
Showing 33 changed files with 293 additions and 334 deletions.
73 changes: 0 additions & 73 deletions .github/scripts/check_text.py

This file was deleted.

34 changes: 20 additions & 14 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
py_version: ${{ steps.versions.outputs.py_version }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Get versions
id: versions
Expand All @@ -23,13 +23,16 @@ jobs:
pre_commit:
name: pre-commit checks
needs: [ prepare ]
runs-on: ubuntu-latest
timeout-minutes: 2

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: pre-commit/action@v2.0.3
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ needs.prepare.outputs.py_version }}
- uses: pre-commit/action@v3.0.0

check_readme:
name: "Check README help text"
Expand All @@ -38,21 +41,24 @@ jobs:
timeout-minutes: 2

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ needs.prepare.outputs.version }}
python-version: ${{ needs.prepare.outputs.py_version }}

- name: Install
run: make install

- name: Check if help text in README is up-to-date
run: |
python .github/scripts/check_text.py \
# TODO: change branch name
wget https://raw.githubusercontent.com/strboul/dotfiles/v0.4.4/bin/command-output-in-file
chmod +x command-output-in-file
./command-output-in-file \
--file "README.md" \
--pattern_start '<!-- help-output: start -->\n' \
--pattern_end '<!-- help-output: end -->\n' \
--command "git-substatus --help"
--command "git-substatus --help" \
--marker-start '<!-- help-output: start -->\n' \
--marker-end '<!-- help-output: end -->\n'
tests:
name: "Run tests"
Expand All @@ -61,12 +67,12 @@ jobs:
timeout-minutes: 2

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Setup python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ needs.prepare.outputs.version }}
python-version: ${{ needs.prepare.outputs.py_version }}

- name: Install dev dependencies
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ jobs:
timeout-minutes: 3

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Build the Docker image
run: make VERSION=test docker-build

- name: Docker container can be run
run: |
./tests/gen_test_repos.sh && \
./tests/generate_test_repos.sh && \
docker run --rm -t \
-v "$(pwd)":/"$(pwd)" \
-w "$(pwd)" strboul/git-substatus:test \
Expand Down
63 changes: 31 additions & 32 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
py_version: ${{ steps.versions.outputs.py_version }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Get versions
id: versions
Expand All @@ -34,43 +34,17 @@ jobs:
env:
tag_ref: ${{ github.ref_name }}

release_github:
name: "Create release on Github"
needs: [ prepare ]
runs-on: ubuntu-latest
timeout-minutes: 2

steps:
- uses: actions/checkout@v2

- name: Create release
uses: softprops/action-gh-release@v1
with:
body: |
Install this specific release with:
- PyPI
```bash
pip install git-substatus==${{ needs.prepare.outputs.version }}
```
- Dockerhub
```bash
docker run --rm -t -v "$(pwd)":/"$(pwd)" -w "$(pwd)" strboul/git-substatus:${{ needs.prepare.outputs.version }}
```
publish_pypi:
name: "Publish to PyPI (https://pypi.org/project/git-substatus/)"
needs: [ prepare ]
runs-on: ubuntu-latest
timeout-minutes: 2

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ needs.prepare.outputs.py_version }}

Expand All @@ -85,7 +59,7 @@ jobs:
python -m build --sdist --wheel --outdir dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@master
uses: pypa/gh-action-pypi-publish@release/v1.5.1
with:
password: ${{ secrets.PYPI_API_TOKEN }}

Expand All @@ -97,13 +71,12 @@ jobs:

steps:
- name: Login to DockerHub
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
username: strboul
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
Expand All @@ -112,3 +85,29 @@ jobs:
tags: |
strboul/git-substatus:${{ needs.prepare.outputs.version }}
strboul/git-substatus:latest
release_github:
name: "Create release on Github"
needs: [ prepare, publish_pypi, publish_dockerhub ]
runs-on: ubuntu-latest
timeout-minutes: 2

steps:
- uses: actions/checkout@v3

- name: Create release
uses: softprops/action-gh-release@v1
with:
body: |
Install this release with:
- [PyPI](https://pypi.org/project/git-substatus/)
```sh
pip install git-substatus==${{ needs.prepare.outputs.version }}
```
- [Dockerhub](https://hub.docker.com/r/strboul/git-substatus)
```sh
docker run --rm -t -v "$(pwd)":/"$(pwd)" -w "$(pwd)" strboul/git-substatus:${{ needs.prepare.outputs.version }}
```
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ build/
dist/
*.egg-info/
*.egg

tests/generated-test-proj-dir
16 changes: 13 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,22 @@ repos:
hooks:
- id: isort
description: "A Python utility / library to sort imports."
name: "[py] isort"
args: ["--profile", "black"]

- repo: https://github.com/psf/black
rev: 21.11b1
rev: 22.6.0
hooks:
- id: black
description: "The uncompromising Python code formatter"
name: "[py] black"

- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
hooks:
- id: flake8
args: ["--ignore=E501"] # E501: line too long (conflicts with black)

- repo: https://github.com/asottile/pyupgrade
rev: v2.37.3
hooks:
- id: pyupgrade
args: ["--py310-plus"]
12 changes: 10 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,15 @@ install:
pip install .


test: unittest clean
test: gentest unittest clean


coverage: gentest runcoverage clean


gentest:
$(call echo_section,"generate test repos")
./tests/generate_test_repos.sh


unittest:
Expand All @@ -39,7 +47,7 @@ typecheck:
mypy --pretty --show-error-context --show-error-codes git_substatus


coverage:
runcoverage:
$(call check_pip_module,"coverage")
$(call echo_section,"measuring code coverage")
coverage run --source git_substatus -m unittest && coverage report
Expand Down
Loading

0 comments on commit b59e0e3

Please sign in to comment.