Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

black-workflow #968

Merged
merged 1 commit into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: GitHub CI

# Execute this for every pull request (opened, reopened, and synchronized)
on: [pull_request]

jobs:
pre-commit-checks:
name: 'Core / Pre-Commit Checks'
runs-on: ubuntu-latest

steps:
-
name: Checkout Repo
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
-
name: Checkout target commit
run: git -c protocol.version=2 fetch --no-tags --prune --no-recurse-submodules --depth=1 origin ${{ github.event.pull_request.base.ref }}
-
name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
-
# Store the current date to use it as cache key
name: Get current date
id: date
run: echo "date=$(date +%Y-%m-%d)" >> "${GITHUB_OUTPUT}"
-
name: Cache dependencies
uses: actions/cache@v4
with:
path: |
~/.cache/pip
~/.cache/pre-commit
key: ${{ github.event.pull_request.head.ref }}-${{ steps.date.outputs.date }}
restore-keys: |
${{ github.event.pull_request.head.ref }}
${{ github.event.pull_request.base.ref }}
develop
main
-
name: Install pre-commit and hooks
run: |
pip install pre-commit
pre-commit install --install-hooks
-
name: Run pre-commit checks
run: pre-commit run --show-diff-on-failure --from-ref ${{ github.event.pull_request.base.sha }} --to-ref ${{ github.event.pull_request.head.sha }}
20 changes: 13 additions & 7 deletions doc/guide/Guide_CLIMADA_conventions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,16 @@
"\n",
" ```shell\n",
" git fetch -t\n",
" git checkout develop-white\n",
" git checkout develop-black\n",
" ```\n",
" \n",
"2. Switch to your feature branch and merge `develop-white` (in order to get the latest changes in `develop` before switching to `black`):\n",
"\n",
" ```shell\n",
" git checkout YOUR_BRANCH\n",
" git pull\n",
" pre-commit uninstall || pip install pre-commit\n",
" git merge --no-ff develop-white\n",
" ```\n",
" If merge conflicts arise, resolve them and conclude the merge as instructed by Git.\n",
Expand All @@ -241,13 +244,13 @@
" ```shell\n",
" git merge --no-ff develop-black\n",
" ```\n",
" * If merge conflicts arise, resolve them and conclude the merge as instructed by Git.\n",
" Most conflicts will probably be resolved by choosing \"Ours\" over \"Theirs\" or the \"Current Change\" over the \"Incoming Change\".\n",
" Still, be careful!\n",
" * Once all conflicts are resolved, check if the tests pass.\n",
" If so, the formatting was successful.\n",
" If you cannot import Climada, one of the merges inflicted erroneous syntax.\n",
" You will have to fix this manually before you commit the merge.\n",
" Resolve all conflicts by choosing \"Ours\" over \"Theirs\" (\"Current Change\" over the \"Incoming Change\").\n",
" \n",
" ```shell\n",
" git checkout --ours .\n",
" git add -u\n",
" git commit\n",
" ```\n",
" \n",
"6. Now, get up to date with the latest `develop` branch:\n",
"\n",
Expand All @@ -258,6 +261,9 @@
" git merge --no-ff develop\n",
" ```\n",
" Again, fix merge conflicts if they arise and check if the tests pass.\n",
" Accept the incoming changes for the tutorials 1_main, Exposures, LitPop Impact, Forecast and TropicalCyclone unless you made changes to those.\n",
" Again, the file with the most likely merging conflicts is CHANGELOG.md, which should probably be resolved by accepting both changes.\n",
" \n",
" \n",
"7. Finally, push your latest changes:\n",
"\n",
Expand Down