-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 352_inflow_properties_additon
- Loading branch information
Showing
13 changed files
with
347 additions
and
178 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,7 @@ jobs: | |
run: | | ||
git config --local user.name "$GITHUB_ACTOR" | ||
git config --local user.email "[email protected]" | ||
git switch -c "pre-commit-$(sha256sum ${{ runner.temp }}/config_file_hashes | head -c 8)" | ||
git switch -c "pre-commit-update" | ||
pre-commit autoupdate --freeze | ||
- name: Create pull requests | ||
|
@@ -42,7 +42,7 @@ jobs: | |
fi | ||
git add .pre-commit-config.yaml | ||
git commit -m "[CI] Update .pre-commit-config.yaml" | ||
git push --set-upstream origin "pre-commit-$(sha256sum ${{ runner.temp }}/config_file_hashes | head -c 8)" | ||
git push --set-upstream origin "pre-commit-update:pre-commit-$(sha256sum .pre-commit-config.yaml | head -c 8)" | ||
# Create PR on GitHub using GitHub CLI. | ||
gh pr create --base main --title "[CI] Update .pre-commit-config.yaml" \ | ||
--body "Created automatically by GitHub Actions." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
name: Pull request checks | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- "main" | ||
workflow_dispatch: | ||
|
||
jobs: | ||
tests: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
py-ver: ["py39", "py310", "py311", "py312"] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Cache conda environment | ||
id: conda-env-cache | ||
uses: actions/cache@v3 | ||
with: | ||
key: conda|${{runner.os}}-${{runner.arch}}|${{ hashFiles(format('requirements/locks/{0}-lock-linux-64.txt', matrix.py-ver)) }} | ||
path: ~/conda-env | ||
- name: Create conda environment | ||
if: steps.conda-env-cache.outputs.cache-hit != 'true' | ||
run: | | ||
# Check cache hasn't pulled a partial key match. | ||
test ! -e "${HOME}/conda-env" | ||
conda create --prefix="${HOME}/conda-env" --file=requirements/locks/${{ matrix.py-ver }}-lock-linux-64.txt | ||
- name: Add conda environment to PATH | ||
run: echo "${HOME}/conda-env/bin" >> $GITHUB_PATH | ||
- name: Run tests | ||
env: | ||
PY_COLORS: "1" | ||
run: | | ||
python3 -m pip install -e . | ||
pytest --verbose --cov --cov-append | ||
mv .coverage ".coverage.${{ matrix.py-ver }}" | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: coverage-data-${{ matrix.py-ver }} | ||
path: .coverage.* | ||
retention-days: 1 | ||
|
||
coverage-report: | ||
if: github.event_name == 'pull_request' | ||
runs-on: ubuntu-latest | ||
needs: tests | ||
permissions: | ||
contents: read | ||
pull-requests: write | ||
steps: | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.x" | ||
- name: Get week number for cache | ||
id: week | ||
run: echo "week=$(date '+W%V')" >> $GITHUB_OUTPUT | ||
- uses: actions/cache@v3 | ||
with: | ||
key: coverage-report|${{ env.pythonLocation }}|${{ steps.week.outputs.week }} | ||
path: ~/.cache/pip | ||
- name: Install coverage | ||
run: python3 -m pip install coverage | ||
- uses: actions/checkout@v4 | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
pattern: coverage-data-* | ||
merge-multiple: true | ||
- name: Generate coverage report | ||
run: | | ||
coverage combine | ||
coverage html | ||
- name: Add report to PR | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
run: | | ||
# This links to a hosted version of the HTML report. | ||
tar -czf coverage-report.tar.gz htmlcov/ | ||
report_url="$(curl -sSf --data-binary @coverage-report.tar.gz https://tmpweb.net)" | ||
badge_options="$(coverage json --fail-under=0 -qo - | jq -r .totals.percent_covered_display)%25-blue?style=for-the-badge" | ||
echo "[![Coverage](https://img.shields.io/badge/coverage-${badge_options})](${report_url})" >> ${{ runner.temp }}/cov-report.md | ||
# Edit last comment if it exists, else create new one. | ||
if ! gh pr comment --edit-last ${{ github.head_ref }} --body-file ${{ runner.temp }}/cov-report.md ; then | ||
gh pr comment ${{ github.head_ref }} --body-file ${{ runner.temp }}/cov-report.md | ||
fi | ||
pre-commit: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.x" | ||
- uses: actions/cache@v3 | ||
with: | ||
key: pre-commit|${{runner.os}}-${{runner.arch}}|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }} | ||
path: ~/.cache/pre-commit | ||
- name: Set up pre-commit | ||
run: python3 -m pip install pre-commit | ||
- uses: actions/checkout@v4 | ||
- name: Run pre-commit | ||
run: pre-commit run --show-diff-on-failure --color=always --all-files | ||
|
||
build-docs: | ||
if: github.event_name == 'pull_request' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Cache conda environment | ||
id: conda-env-cache | ||
uses: actions/cache@v3 | ||
with: | ||
key: conda|${{runner.os}}-${{runner.arch}}|${{hashFiles('requirements/locks/py312-lock-linux-64.txt')}} | ||
path: ~/conda-env | ||
- name: Create conda environment | ||
if: steps.conda-env-cache.outputs.cache-hit != 'true' | ||
run: | | ||
# Check cache hasn't pulled a partial key match. | ||
test ! -e "${HOME}/conda-env" | ||
conda create --prefix="${HOME}/conda-env" --file=requirements/locks/py312-lock-linux-64.txt | ||
- name: Add conda environment to PATH | ||
run: echo "${HOME}/conda-env/bin" >> $GITHUB_PATH | ||
- name: Build documentation with Sphinx | ||
run: | | ||
# Install module so it can be imported during docs generation. | ||
python3 -m pip install . | ||
# Generate the documentation | ||
sphinx-build -d "docs/build/doctree" "docs/source" "docs/build/html" --color -W -bhtml | ||
- name: Upload documentation artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: html-docs | ||
path: docs/build/html/ | ||
retention-days: 10 | ||
if-no-files-found: error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.