Skip to content

Commit

Permalink
GitHub Actions refactor, add epic-comments lint and test
Browse files Browse the repository at this point in the history
  • Loading branch information
semperos committed May 10, 2024
1 parent a0151d4 commit 78347ec
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 1 deletion.
41 changes: 41 additions & 0 deletions .github/workflows/lint-epic-comments.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
###
### Workflow that lints code in pull requests
###

name: Lint

# Note: No name so it uses the name associated with the pull request merge to main

on:
pull_request:
paths:
- 'epic-comments/**'

jobs:
lint-epic-comments:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Check out repository code
uses: actions/checkout@v4

- name: Get Python Version
run: echo "PYTHON_VERSION=$(cat .python-version | grep ^[^#])" >> $GITHUB_ENV

- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: "pipenv"

- name: Install pipenv
run: pip install --user pipenv

- name: Install Python dependencies
working-directory: ./epic-comments
run: make setup-dev

- name: Lint epic-comments with Black linter
working-directory: ./epic-comments
run: make lint
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ jobs:
working-directory: ./pivotal-import
run: make setup-dev

- name: Lint Python with Black linter
- name: Lint pivotal-import with Black linter
working-directory: ./pivotal-import
run: make lint
41 changes: 41 additions & 0 deletions .github/workflows/test-epic-comments.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
###
### Workflow that test code in pull requests
###

name: Test

# Note: No name so it uses the name associated with the pull request merge to main

on:
pull_request:
paths:
- 'epic-comments/**'

jobs:
test-epic-comments:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Check out repository code
uses: actions/checkout@v4

- name: Get Python Version
run: echo "PYTHON_VERSION=$(cat .python-version | grep ^[^#])" >> $GITHUB_ENV

- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: "pipenv"

- name: Install pipenv
run: pip install --user pipenv

- name: Install Python dependencies
working-directory: ./epic-comments
run: make setup-dev

- name: Test epic-comments
working-directory: ./epic-comments
run: make test
File renamed without changes.
28 changes: 28 additions & 0 deletions epic-comments/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,31 @@ pipenv run python epic_comments.py --all-epics
```

Each epic's comments will be written to a file with the epic ID and a current timestamp.

## Development

Set up your development environment:

``` shell
make setup-dev
```

Run `pipenv shell` to enter a shell with all Python dependencies loaded.

Run tests:

``` shell
make test
```

Run the linter:

``` shell
make lint
```

If a test failure isn't clear, you can run pytest in verbose mode:

``` shell
pipenv run pytest -vv epic_comments_test.py
```

0 comments on commit 78347ec

Please sign in to comment.