-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 74a4b92
Showing
33 changed files
with
56,368 additions
and
0 deletions.
There are no files selected for viewing
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,27 @@ | ||
name: "Setup Python Environment" | ||
description: "Set up Python environment for the given Python version" | ||
|
||
inputs: | ||
python-version: | ||
description: "Python version for setup-python" | ||
required: true | ||
default: "3.10" | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ inputs.python-version }} | ||
|
||
- name: Install uv | ||
run: pipx install uv | ||
env: | ||
UV_VERSION: "0.4.10" | ||
shell: bash | ||
|
||
- name: Install Python dependencies | ||
# This will install eo-tides and all required dependencies specified in | ||
# uv.lock. To install optional dependencies, include --all-extras | ||
run: uv sync --frozen --all-extras | ||
shell: bash |
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,80 @@ | ||
name: Main | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
types: [opened, synchronize, reopened, ready_for_review] | ||
|
||
jobs: | ||
quality: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out | ||
uses: actions/checkout@v4 | ||
|
||
- uses: actions/cache@v4 | ||
with: | ||
path: ~/.cache/pre-commit | ||
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} | ||
|
||
- name: Set up the environment | ||
uses: ./.github/actions/setup-python-env | ||
|
||
- name: Run checks | ||
run: make check | ||
|
||
run-tests: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.9", "3.10", "3.11", "3.12"] | ||
fail-fast: false | ||
max-parallel: 5 | ||
defaults: | ||
run: | ||
shell: bash | ||
steps: | ||
- name: Check out | ||
uses: actions/checkout@v4 | ||
|
||
- name: Extract model data | ||
run: | | ||
# Extract tide modelling test files | ||
tar -xvzf ./tests/data/tide_models_tests.tar.gz -C ./tests/data | ||
# Add environment variable to allow functions to locate data | ||
echo "DEA_TOOLS_TIDE_MODELS=./tests/data/tide_models_tests" >> $GITHUB_ENV | ||
- name: Set up the environment | ||
uses: ./.github/actions/setup-python-env | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Run Python unit tests | ||
run: uv run python -m pytest tests --cov --cov-config=pyproject.toml --cov-report=xml --verbose | ||
|
||
- name: Run Jupyter Notebook integration tests | ||
run: uv run python -m pytest --nbval-lax docs/notebooks/Model_tides.ipynb | ||
|
||
- name: Check typing | ||
run: uv run mypy | ||
|
||
- name: Upload coverage reports to Codecov with GitHub Action on Python 3.10 | ||
uses: codecov/codecov-action@v4 | ||
if: ${{ matrix.python-version == '3.10' }} | ||
env: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | ||
|
||
check-docs: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up the environment | ||
uses: ./.github/actions/setup-python-env | ||
|
||
- name: Check if documentation can be built | ||
run: uv run mkdocs build -s |
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,67 @@ | ||
name: release-main | ||
|
||
on: | ||
release: | ||
types: [published] | ||
branches: [main] | ||
|
||
jobs: | ||
set-version: | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Export tag | ||
id: vars | ||
run: echo tag=${GITHUB_REF#refs/*/} >> $GITHUB_OUTPUT | ||
if: ${{ github.event_name == 'release' }} | ||
|
||
- name: Update project version | ||
run: | | ||
sed -i "s/^version = \".*\"/version = \"$RELEASE_VERSION\"/" pyproject.toml | ||
env: | ||
RELEASE_VERSION: ${{ steps.vars.outputs.tag }} | ||
if: ${{ github.event_name == 'release' }} | ||
|
||
- name: Upload updated pyproject.toml | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: pyproject-toml | ||
path: pyproject.toml | ||
|
||
publish: | ||
runs-on: ubuntu-latest | ||
needs: [set-version] | ||
steps: | ||
- name: Check out | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up the environment | ||
uses: ./.github/actions/setup-python-env | ||
|
||
- name: Download updated pyproject.toml | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: pyproject-toml | ||
|
||
- name: Build package | ||
run: uvx --from build pyproject-build --installer uv | ||
|
||
# - name: Publish package | ||
# run: uvx twine upload dist/* | ||
# env: | ||
# TWINE_USERNAME: __token__ | ||
# TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | ||
|
||
deploy-docs: | ||
needs: publish | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up the environment | ||
uses: ./.github/actions/setup-python-env | ||
|
||
- name: Deploy documentation | ||
run: uv run mkdocs gh-deploy --force |
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,122 @@ | ||
# Contributing to `eo-tides` | ||
|
||
Contributions are welcome, and they are greatly appreciated! | ||
Every little bit helps, and credit will always be given. | ||
|
||
You can contribute in many ways: | ||
|
||
# Types of Contributions | ||
|
||
## Report Bugs | ||
|
||
Report bugs at https://github.com/GeoscienceAustralia/eo-tides/issues | ||
|
||
If you are reporting a bug, please include: | ||
|
||
- Your operating system name and version. | ||
- Any details about your local setup that might be helpful in troubleshooting. | ||
- Detailed steps to reproduce the bug. | ||
|
||
## Fix Bugs | ||
|
||
Look through the GitHub issues for bugs. | ||
Anything tagged with "bug" and "help wanted" is open to whoever wants to implement a fix for it. | ||
|
||
## Implement Features | ||
|
||
Look through the GitHub issues for features. | ||
Anything tagged with "enhancement" and "help wanted" is open to whoever wants to implement it. | ||
|
||
## Submit Feedback | ||
|
||
The best way to send feedback is to file an issue at https://github.com/GeoscienceAustralia/eo-tides/issues. | ||
|
||
If you are proposing a new feature: | ||
|
||
- Explain in detail how it would work. | ||
- Keep the scope as narrow as possible, to make it easier to implement. | ||
- Remember that this is a volunteer-driven project, and that contributions | ||
are welcome :) | ||
|
||
# Get Started! | ||
|
||
Ready to contribute? Here's how to set up `eo-tides` for local development. | ||
Please note this documentation assumes you already have `uv` and `Git` installed and ready to go. | ||
|
||
1. Fork the `eo-tides` repo on GitHub. | ||
|
||
2. Clone your fork locally: | ||
|
||
```bash | ||
cd <directory_in_which_repo_should_be_created> | ||
git clone [email protected]:YOUR_NAME/eo-tides.git | ||
``` | ||
|
||
3. Now we need to install the environment. Navigate into the directory | ||
|
||
```bash | ||
cd eo-tides | ||
``` | ||
|
||
Then, install and activate the environment with: | ||
|
||
```bash | ||
uv sync | ||
``` | ||
|
||
4. Install pre-commit to run linters/formatters at commit time: | ||
|
||
```bash | ||
uv run pre-commit install | ||
``` | ||
|
||
5. Create a branch for local development: | ||
|
||
```bash | ||
git checkout -b name-of-your-bugfix-or-feature | ||
``` | ||
|
||
Now you can make your changes locally. | ||
|
||
6. Don't forget to add test cases for your added functionality to the `tests` directory. | ||
|
||
7. When you're done making changes, check that your changes pass the formatting tests. | ||
|
||
```bash | ||
make check | ||
``` | ||
|
||
Now, validate that all unit tests are passing: | ||
|
||
```bash | ||
make test | ||
``` | ||
|
||
9. Before raising a pull request you can also run tox to | ||
run the tests across different versions of Python: | ||
|
||
```bash | ||
tox | ||
``` | ||
|
||
This requires you to have multiple versions of python installed. | ||
This step is also triggered in the CI/CD pipeline, so you could also choose to skip this step locally. | ||
|
||
10. Commit your changes and push your branch to GitHub: | ||
|
||
```bash | ||
git add . | ||
git commit -m "Your detailed description of your changes." | ||
git push origin name-of-your-bugfix-or-feature | ||
``` | ||
|
||
11. Submit a pull request through the GitHub website. | ||
|
||
# Pull Request Guidelines | ||
|
||
Before you submit a pull request, check that it meets these guidelines: | ||
|
||
1. The pull request should ideally include tests. | ||
|
||
2. If the pull request adds functionality, the docs should be updated. | ||
Put your new functionality into a function with a docstring, and add the feature to the list in `README.md`. |
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,21 @@ | ||
# Install uv | ||
FROM python:3.12-slim | ||
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv | ||
|
||
# Change the working directory to the `app` directory | ||
WORKDIR /app | ||
|
||
# Copy the lockfile and `pyproject.toml` into the image | ||
ADD uv.lock /app/uv.lock | ||
ADD pyproject.toml /app/pyproject.toml | ||
|
||
# Install dependencies | ||
RUN uv sync --frozen --no-install-project | ||
|
||
# Copy the project into the image | ||
ADD . /app | ||
|
||
# Sync the project | ||
RUN uv sync --frozen | ||
|
||
CMD [ "python", "eo_tides/foo.py"] |
Oops, something went wrong.