diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 5e54ea7a..53b4109e 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -5,8 +5,8 @@ Delete sections and checklist items that don't apply to your change. ## Related issue - + ## Type of change diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 714ed496..ece349f5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -79,7 +79,7 @@ jobs: # Builds the docs (with the coverage report under /coverage) on every run; # deploys them to https://wbgeo.github.io/ only from main, and only once the repository - # variable DEPLOY_DOCS is "true" (GitLab CI still deploys the docs while both pipelines run). + # variable DEPLOY_DOCS is "true" (and the secret DOCS_DEPLOY_KEY is set). docs: needs: test runs-on: ubuntu-latest diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 9c0bba76..00000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,132 +0,0 @@ -# Use MR pipelines when an MR is open, branch pipelines otherwise (avoids duplicate pipelines) -workflow: - rules: - - if: $CI_PIPELINE_SOURCE == "merge_request_event" - - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS - when: never - - if: $CI_COMMIT_BRANCH - - if: $CI_COMMIT_TAG - -test: - image: python:3.12 - stage: test - rules: - - if: $CI_PIPELINE_SOURCE == "merge_request_event" - - if: $CI_COMMIT_BRANCH - - if: $CI_COMMIT_TAG - before_script: - - python -V # Print out python version for debugging - - pip install virtualenv # Pip's cache doesn't store the python packages - - virtualenv venv - - source venv/bin/activate - - apt update && apt install -y musl-dev libc-dev libgl1 ffmpeg libgl1 libglx-mesa0 xvfb libglu1-mesa libxi-dev libxmu-dev libglu1-mesa-dev libxinerama-dev - # specify the private registries explicitly with a token (as otherweise anubis might cause 400) - - pip install -r requirements.txt --extra-index-url https://gitlab-ci-token:${CI_JOB_TOKEN}@git.rwth-aachen.de/api/v4/projects/102532/packages/pypi/simple --extra-index-url https://gitlab-ci-token:${CI_JOB_TOKEN}@git.rwth-aachen.de/api/v4/projects/129570/packages/pypi/simple - - pip install pytest coverage - script: - - python -m coverage run -m pytest --junitxml=report.xml -v --durations=0 - after_script: - - pip install coverage - - coverage xml - - coverage html - artifacts: - when: always - reports: - junit: report.xml - coverage_report: - coverage_format: cobertura - path: coverage.xml - paths: - - htmlcov/ - expire_in: 2 weeks - cache: - key: - files: - - requirements.txt - paths: - - .cache/pip - policy: pull-push - when: always - variables: # Change pip's cache directory to be inside the project directory because we can only cache local items. - PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip" - # prevent thread oversubscription - OMP_NUM_THREADS: "1" - OPENBLAS_NUM_THREADS: "1" - MKL_NUM_THREADS: "1" - NUMBA_NUM_THREADS: "1" - - -# deploy coverage report & pages -pages: - image: python:3.12 - stage: deploy - variables: - PAGES_PREFIX: "" # No prefix by default (main) - pages: # specifies that this is a Pages job and publishes the default public directory - path_prefix: "$PAGES_PREFIX" - environment: - name: "Pages ${PAGES_PREFIX}" - url: $CI_PAGES_URL - rules: - - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Run on default branch (with default PAGES_PREFIX) - - if: $CI_PIPELINE_SOURCE == "merge_request_event" # Conditionally change the prefix for Merge Requests - when: manual # Run pages manually on Merge Requests - allow_failure: true - variables: - PAGES_PREFIX: 'mr-$CI_MERGE_REQUEST_IID' # Prefix with the mr-, like `mr-123` - dependencies: - - test - before_script: - ## Install ssh-agent if not already installed, it is required by Docker. - ## (change apt-get to yum if you use an RPM-based image) - - 'command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client git -y )' - ## Run ssh-agent (inside the build environment) - - eval $(ssh-agent -s) - ## Give the right permissions, otherwise ssh-add will refuse to add files - ## Add the SSH key stored in SSH_PRIVATE_KEY file type CI/CD variable to the agent store - - chmod 400 "$GITHUB_DOCS_DEPLOY_KEY" - - ssh-add "$GITHUB_DOCS_DEPLOY_KEY" - ## Create the SSH directory and give it the right permissions - - mkdir -p ~/.ssh - - chmod 700 ~/.ssh - - echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config - - git config --global user.name "CI" - - git config --global user.email "ci@wbgeo.github.io" - script: - # add __init__.py files, required for docs - - find core -type d -exec touch {}/__init__.py \; - - pip install mkdocs-material mkdocstrings[python] mkdocs-gen-files mkdocs-literate-nav - - mkdocs build --site-dir public - - mkdir -p htmlcov # create folder, if test did not run (on a MR) - - mv htmlcov/ public/coverage - # mirror to github - - mkdir gh-pages - - cd gh-pages - - git init - - git remote add origin "git@github.com:WBGeo/wbgeo.github.io.git" - - git fetch --depth=1 origin gh-pages || true - - git checkout --orphan gh-pages - # cleanup old - - git rm -rf . || true - # copy docs & add - - cp -r ../public/. . - - git add . - - git commit -m "Deploy ${CI_COMMIT_SHA}" - - git push --force origin gh-pages - cache: - key: ${CI_COMMIT_REF_SLUG} - paths: - - ~/.cache/ - artifacts: - paths: - - public/ - -# You can override the included template(s) by including variable overrides -# SAST customization: https://docs.gitlab.com/user/application_security/sast/#available-cicd-variables -# Secret Detection customization: https://docs.gitlab.com/user/application_security/secret_detection/pipeline/configure/ -# Dependency Scanning customization: https://docs.gitlab.com/user/application_security/dependency_scanning/dependency_scanning_sbom/#customizing-analyzer-behavior -# Container Scanning customization: https://docs.gitlab.com/user/application_security/container_scanning/#customizing-analyzer-behavior -# Note that environment variables can be set in several places -# See https://docs.gitlab.com/ci/variables/#cicd-variable-precedence -include: - - template: Jobs/Dependency-Scanning.v2.gitlab-ci.yml diff --git a/AGENTS.md b/AGENTS.md index a695b8d2..c72b47d9 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -69,7 +69,7 @@ python -m pytest tests -q # full suite, roughly 8-15 ``` - Run the tests of the code you touched after each change; run the full suite - before opening or updating a merge request. + before opening or updating a pull request. - Long-running end-to-end tests are marked `@pytest.mark.integration` and `@pytest.mark.slow`. - `--show-plots` / `--show-plots-always` open plots from tests that support them. @@ -208,21 +208,24 @@ The essentials: docker compose up -d py_runner ``` -## Git, issues and merge requests - -- The public home of the project is https://github.com/WBGeo/codebase; the - **issues** live there. The team currently still develops on an internal GitLab - instance and mirrors `main` to GitHub; the full move is tracked in - https://github.com/WBGeo/codebase/issues/10. -- Work on a branch, open a merge (pull) request against `main`, and run the full - test suite first. -- **Reference issues by full URL** in commits and merge requests, e.g. - `Closes https://github.com/WBGeo/codebase/issues/4`. While development still - runs through the internal instance, a bare `#4` would point to the wrong issue - tracker; the URL form works everywhere and closes the GitHub issue once the - commit reaches `main`. +## Git, issues and pull requests + +- The project lives at https://github.com/WBGeo/codebase: code, issues, pull + requests and CI (GitHub Actions). The former GitLab instance is archived. +- Work on a branch (or a fork), run the full test suite, and open a pull request + against `main`. `main` only accepts pull requests: one approving review by a + code owner (`.github/CODEOWNERS`), resolved review threads and the checks + `test`, `docs` and `dependency-review`. New commits dismiss earlier approvals. + Merge with a merge commit or rebase. +- **Reference issues** in commits and pull requests with `Closes #4` (closes the + issue once the change reaches `main`) or `Part of #4`; use the full URL for + issues in other repositories, e.g. + `https://github.com/WBGeo/case-studies/issues/1`. +- The Docker images (`docker-compose.yml`, GOLEM) and the package index for + `py_api_wbgeo` (`requirements.txt`) are still hosted in the GitLab registry; + keep those URLs until they move. - Don't commit local files: the Docker dev mounts, `own_data/`, caches such as `*/input_data/topography_cache/`, or credentials (a local `.env` holds tokens, e.g. for LiquidEarth). - Docs and docstrings link to https://wbgeo.github.io/ and to github.com URLs, - never to the internal GitLab instance (it is not publicly accessible). + never to the archived GitLab instance (it is not publicly accessible). diff --git a/Contributing.md b/Contributing.md index 5989e31a..a459376e 100644 --- a/Contributing.md +++ b/Contributing.md @@ -77,8 +77,8 @@ how components and types work. 5. **Update the documentation**: docstrings, the component manuals in `docs/components/` (e.g. when a component is renamed) and the developer guide where relevant. -6. **Open a pull request** against `main`, describe what and why, and reference the issue by - full URL, e.g. `Closes https://github.com/WBGeo/codebase/issues/`. The template contains +6. **Open a pull request** against `main`, describe what and why, and reference the issue, + e.g. `Closes #` (or `Part of #` if it stays open). The template contains a short checklist. 7. **Review.** The owners of the changed areas (see [`.github/CODEOWNERS`](.github/CODEOWNERS)) are asked for a review automatically.