Skip to content

Commit

Permalink
Merge pull request #215 from w-bonelli/fix-release
Browse files Browse the repository at this point in the history
ci(release): fix formatting step, remove pull_request_prepare.py, update release docs
  • Loading branch information
jmccreight committed Jul 18, 2023
2 parents e186c72 + e9393b0 commit 8f8aeea
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 51 deletions.
17 changes: 2 additions & 15 deletions .github/RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ utilities for `pywatershed`.
- [Releasing `pywatershed`](#releasing-pywatershed)
- [Utility scripts](#utility-scripts)
- [Updating version numbers](#updating-version-numbers)
- [Preparing for PRs](#preparing-for-prs)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

Expand Down Expand Up @@ -102,12 +101,7 @@ To release a new version:
## Utility scripts

The automated release procedure uses a few scripts, located in
`.github/scripts`:

- `update_version.py` `pull_request_prepare.py`

The former should never need to be run manually. The latter is convenient for
formatting source files before opening PRs.
`.github/scripts`.

### Updating version numbers

Expand All @@ -130,11 +124,4 @@ repository's files, use the `--get` (short `-g`) flag:

```shell python .github/scripts/update_version.py -g ```

### Preparing for PRs

The `pull_request_prepare.py` script lints Python source code files by running
`black` and `isort` on the `pywatershed` subdirectory. This script should be run
before opening a pull request, as CI will fail if the code is not properly
formatted. For instance, from the project root:

```shell python .github/scripts/pull_request_prepare.py ```
**Note**: this script should not need to be run manually, as it is run automatically in the release automation.
21 changes: 0 additions & 21 deletions .github/scripts/pull_request_prepare.py

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
echo "and run"
echo " isort ./pywatershed ./autotest"
echo "and then commit the changes."
isort --check --diff ./pywatershed
isort --check --diff ./pywatershed ./autotest
- name: Run black
run: |
Expand All @@ -90,7 +90,7 @@ jobs:
echo "and run"
echo " black ./pywatershed ./autotest"
echo "and then commit the changes."
black --check --diff ./pywatershed
black --check --diff ./pywatershed ./autotest
- name: Run flake8
run: |
Expand Down
16 changes: 6 additions & 10 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,6 @@ jobs:
with:
fetch-depth: 0

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.9
cache: 'pip'
cache-dependency-path: pyproject.toml

- name: Install Dependencies via Micromamba
uses: mamba-org/setup-micromamba@v1
with:
Expand Down Expand Up @@ -91,12 +84,13 @@ jobs:
ref="${{ github.ref_name }}"
version="${ref#"v"}"
python .github/scripts/update_version.py -v "$version"
python .github/scripts/pull_request_prepare.py
python -c "import pywatershed; print('Version: ', pywatershed.__version__)"
echo "version=$version" >> $GITHUB_OUTPUT
- name: Format files
run: python .github/scripts/pull_request_prepare.py
run: |
isort ./pywatershed
black ./pywatershed
- name: Touch changelog
run: touch HISTORY.md
Expand Down Expand Up @@ -156,7 +150,9 @@ jobs:
git config core.sharedRepository true
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add -A
git add HISTORY.md
git add pywatershed
git add version.txt
git commit -m "ci(release): set version to ${{ steps.version.outputs.version }}, update changelog"
git push origin "${{ github.ref_name }}"
Expand Down
16 changes: 13 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ We welcome community development! We ask contributors to follow a few guideline
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->


- [Found a bug?](#found-a-bug)
- [Missing a feature?](#missing-a-feature)
- [Submission guidelines](#submission-guidelines)
Expand Down Expand Up @@ -49,13 +50,22 @@ To submit a pull request (PR) please follow these steps:

3. Make your changes in a new branch. Be sure to include test cases.

4. Run `isort` and `black` on the `pywatershed` module. The `.github/scripts/pull_request_prepare.py` Python script is a convenient wrapper for this.
4. Run `isort` and `black` on the `pywatershed` module.

Python source code files should be formatted by running `black` and `isort` on the
`pywatershed` subdirectory before opening a pull request, as CI will fail if the code
is not properly formatted. For instance, from the project root:

```shell
black --check --diff pywatershed
isort --check --diff pywatershed
```

**Note**: PRs must pass format checks in GitHub Actions before they can be accepted.
**Note**: PRs must pass format checks in GitHub Actions before they can be accepted.

5. Run the full test suite and make sure all tests pass.

**Note**: PRs must pass all tests in GitHub Actions before they can be accepted.
**Note**: PRs must pass all tests in GitHub Actions before they can be accepted.

6. Commit your changes with a descriptive message that follows [conventional commit](https://github.com/modflowpy/flopy/blob/develop/CONTRIBUTING.md#commit) guidelines. Adherence to these conventions allows changelogs and release notes to be generated automatically from the commit history.

Expand Down

0 comments on commit 8f8aeea

Please sign in to comment.