Skip to content
Closed
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
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
# Project configs
/pyproject.toml @ecmwf/AnemoiSecurity
/.pre-commit-config.yaml @ecmwf/AnemoiSecurity
/.release-please-config.json @ecmwf/AnemoiSecurity
43 changes: 43 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# This is the configuration file for the labeler action.
# It assigns labels to pull requests based on the files changed in the PR.
# See more here: https://github.com/actions/labeler
dependencies:
- changed-files:
- any-glob-to-any-file:
- "**/requirements.txt"
- "**/setup.py"
- "**/pyproject.toml"
- "**/Pipfile"
- "**/Pipfile.lock"
- "**/requirements/*.txt"
- "**/requirements/*.in"

documentation:
- changed-files:
- any-glob-to-any-file:
- "**/docs/**/*"
- "*.md"
- "*.rst"

config:
- changed-files:
- any-glob-to-any-file:
- "**/src/**/config/**/*"
- "**/src/anemoi/inference/config.py"

CI/CD:
- changed-files:
- any-glob-to-any-file:
- "**/.pre-commit-config.yaml"
- ".github/**/*"
- "tox.ini"
- ".coveragerc"

tests:
- changed-files:
- any-glob-to-any-file:
- "**/tests/**/*"
- "**/test/**/*"
- "**/test_*.py"
- "**/test.py"
- "**/conftest.py"
15 changes: 15 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## Description
<!-- What issue or task does this change relate to? -->

## What problem does this change solve?
<!-- Describe if it's a bugfix, new feature, doc update, or breaking change -->

## What issue or task does this change relate to?
<!-- link to Issue Number -->

## Additional notes ##
<!-- Include any additional information, caveats, or considerations that the reviewer should be aware of. -->

***As a contributor to the Anemoi framework, please ensure that your changes include unit tests, updates to any affected dependencies and documentation, and have been tested in a parallel setting (i.e., with multiple GPUs). As a reviewer, you are also responsible for verifying these aspects and requesting changes if they are not adequately addressed. For guidelines about those please refer to https://anemoi.readthedocs.io/en/latest/***

By opening this pull request, I affirm that all authors agree to the [Contributor License Agreement.](https://github.com/ecmwf/codex/blob/main/Legal/contributor_license_agreement.md)
22 changes: 22 additions & 0 deletions .github/workflows/pr-conventional-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# This workflow ensures that the PR title follows the Conventional Commit format.
name: "[PR] Ensure Conventional Commit Title"

on:
pull_request_target:
types:
- opened
- edited
- synchronize
- reopened

permissions:
pull-requests: read

jobs:
main:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66 changes: 66 additions & 0 deletions .github/workflows/pr-label-ats.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# This workflow checks that the appropriate ATS labels are applied to a pull request:
# - "ATS Approval Not Needed": pass
# - "ATS Approved": pass
# - "ATS Approval Needed": fail
# - Missing ATS label: fail

name: "[PR] ATS labels"

on:
pull_request:
types:
- opened
- edited
- reopened
- labeled
- unlabeled
- synchronize

permissions:
pull-requests: read

jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Get PR details
uses: actions/github-script@v7
id: check-pr
with:
script: |
const pr = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number,
});
const labels = pr.data.labels.map(label => label.name);
core.setOutput('labels', JSON.stringify(labels));
core.setOutput('author', context.payload.pull_request.user.login);

- name: Evaluate ATS labels
run: |
AUTHOR='${{ steps.check-pr.outputs.author }}'
if [ "$AUTHOR" == "DeployDuck" ] || [ "$AUTHOR" == "pre-commit-ci[bot]" ]; then
echo "Bot PR, skipping."
exit 0
fi
LABELS=$(echo '${{ steps.check-pr.outputs.labels }}' | jq -r '.[]')
echo "Labels found:"
echo -e "$LABELS\n"
echo "Result:"
if echo "$LABELS" | grep -qi "ATS approval not needed"; then
echo "ATS approval not needed. Passing."
EXIT_CODE=0
elif echo "$LABELS" | grep -qi "ATS approved"; then
echo "ATS Approved. Passing."
EXIT_CODE=0
elif echo "$LABELS" | grep -qi "ATS approval needed"; then
echo "ATS Approval Needed. Failing."
EXIT_CODE=1
else
echo "No ATS approval labels found. Please assign the appropriate ATS label. Failing."
EXIT_CODE=1
fi
echo -e "\nFor more information on ATS labels, see:"
echo "https://anemoi.readthedocs.io/en/latest/contributing/guidelines.html#labelling-guidelines"
exit $EXIT_CODE
48 changes: 48 additions & 0 deletions .github/workflows/pr-label-conventional-commits.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# This workflow assigns labels to a pull request based on the Conventional Commits format.
# This is necessary for release-please to work properly.
name: "[PR] Label Conventional Commits"

on:
pull_request:
branches: [main]
types:
[opened, reopened, labeled, unlabeled]

permissions:
pull-requests: write

jobs:
assign-labels:
runs-on: ubuntu-latest
name: Assign labels in pull request
if: github.event.pull_request.merged == false
steps:
- uses: actions/checkout@v3
- name: Assign labels from Conventional Commits
id: action-assign-labels
uses: mauroalderete/action-assign-labels@v1
with:
pull-request-number: ${{ github.event.pull_request.number }}
github-token: ${{ secrets.GITHUB_TOKEN }}
conventional-commits: |
conventional-commits:
- type: 'fix'
nouns: ['FIX', 'Fix', 'fix', 'FIXED', 'Fixed', 'fixed']
labels: ['bug']
- type: 'feature'
nouns: ['FEATURE', 'Feature', 'feature', 'FEAT', 'Feat', 'feat']
labels: ['enhancement']
- type: 'breaking_change'
nouns: ['BREAKING CHANGE', 'BREAKING', 'MAJOR']
labels: ['breaking change']
- type: 'documentation'
nouns: ['doc','docs','docu','document','documentation']
labels: ['documentation']
- type: 'build'
nouns: ['build','rebuild','ci']
labels: ['CI/CD']
- type: 'config'
nouns: ['config', 'conf', 'configuration']
labels: ['config']
maintain-labels-not-matched: true
apply-changes: true
17 changes: 17 additions & 0 deletions .github/workflows/pr-label-file-based.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This workflow assigns labels to a pull request based on the files changed in the PR.
# The labels are defined in the `.github/labels.yml` file.
name: "[PR] Label File-based"
on:
pull_request_target:
types: [opened, synchronize]

permissions:
contents: read
pull-requests: write

jobs:
labeler:
runs-on: ubuntu-latest
steps:
- name: Assign labels from file changes
uses: actions/labeler@v5
10 changes: 10 additions & 0 deletions .github/workflows/pr-label-public.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Manage labels of pull requests that originate from forks
name: "[PR] Label Forks"

on:
pull_request_target:
types: [opened, synchronize]

jobs:
label:
uses: ecmwf/reusable-workflows/.github/workflows/label-pr.yml@v2
13 changes: 13 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Upload Python Package to PyPI

on:
release:
types: [created]

jobs:
deploy:
uses: ecmwf/reusable-workflows/.github/workflows/cd-pypi.yml@v2
secrets: inherit
25 changes: 25 additions & 0 deletions .github/workflows/python-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# This workflow runs pre-commit checks and pytest tests against multiple platforms and Python versions.
name: Code Quality and Testing

on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches:
- main
schedule:
- cron: "9 2 * * 0" # at 9:02 on sunday

jobs:
quality:
uses: ecmwf/reusable-workflows/.github/workflows/qa-precommit-run.yml@v2
with:
skip-hooks: "no-commit-to-branch"

checks:
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
uses: ecmwf/reusable-workflows/.github/workflows/qa-pytest-pyproject.yml@v2
with:
python-version: ${{ matrix.python-version }}
2 changes: 1 addition & 1 deletion .github/workflows/readthedocs-pr-update.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This workflow adds a link to the experimental documentation build to the PR.
# This does NOT trigger a build of the documentation, this is handled through webhooks.
name: Read the Docs PR Preview
name: "[PR] Read the Docs Preview"
on:
pull_request_target:
types:
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This workflow uses an action to run Release Please to create a release PR.
# It is governed by the config and manifest in the root of the repo.
# For more information see: https://github.com/googleapis/release-please
name: Run Release Please
on:
push:
branches:
- main
- hotfix/*

permissions:
contents: write
pull-requests: write

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: googleapis/release-please-action@v4
with:
# this assumes that you have created a personal access token
# (PAT) and configured it as a GitHub action secret named
# `MY_RELEASE_PLEASE_TOKEN` (this secret name is not important).
token: ${{ secrets.RELEASE_PLEASE_TOKEN }}
# optional. customize path to .release-please-config.json
config-file: .release-please-config.json
# Currently releases are done from main
target-branch: ${{ github.ref_name }}
Loading
Loading