Skip to content

Commit 2c59d0b

Browse files
committed
ci: migrate first CIs
1 parent f8e5b39 commit 2c59d0b

File tree

4 files changed

+147
-0
lines changed

4 files changed

+147
-0
lines changed

.github/workflows/label-public-pr.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Manage labels of pull requests that originate from forks
2+
name: label-public-pr
3+
4+
on:
5+
pull_request_target:
6+
types: [opened, synchronize]
7+
8+
jobs:
9+
label:
10+
uses: ecmwf-actions/reusable-workflows/.github/workflows/label-pr.yml@v2
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: "Ensure Conventional Commit in PR title"
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- edited
8+
- synchronize
9+
- reopened
10+
11+
permissions:
12+
pull-requests: read
13+
14+
jobs:
15+
main:
16+
name: Validate PR title
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: amannn/action-semantic-pull-request@v5
20+
env:
21+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: Test PR
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
push:
7+
branches:
8+
- develop
9+
schedule:
10+
- cron: "9 2 * * 0" # at 9:02 on sunday
11+
12+
jobs:
13+
quality:
14+
uses: ecmwf-actions/reusable-workflows/.github/workflows/qa-precommit-run.yml@v2
15+
with:
16+
skip-hooks: "no-commit-to-branch"
17+
18+
checks:
19+
runs-on: ubuntu-latest
20+
strategy:
21+
matrix:
22+
python-version: ["3.11"]
23+
24+
steps:
25+
- uses: actions/checkout@v3
26+
27+
- name: Set up Python ${{ matrix.python-version }}
28+
uses: actions/setup-python@v4
29+
with:
30+
python-version: ${{ matrix.python-version }}
31+
32+
- name: Install basic dependencies
33+
run: |
34+
python -m pip install --upgrade pip
35+
pip install pytest pytest-md pytest-emoji
36+
37+
- name: Detect changed packages
38+
id: changed-packages
39+
run: |
40+
CHANGED_FILES=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }})
41+
echo "training_changed=$(echo "$CHANGED_FILES" | grep -q '^training/.*\.py$' && echo 'true' || echo 'false')" >> $GITHUB_OUTPUT
42+
echo "graphs_changed=$(echo "$CHANGED_FILES" | grep -q '^graphs/.*\.py$' && echo 'true' || echo 'false')" >> $GITHUB_OUTPUT
43+
echo "models_changed=$(echo "$CHANGED_FILES" | grep -q '^models/.*\.py$' && echo 'true' || echo 'false')" >> $GITHUB_OUTPUT
44+
45+
- name: Install training package
46+
run: |
47+
if [[ ${{ steps.changed-packages.outputs.training_changed }} == 'true' ]]; then
48+
echo "Installing training from local source"
49+
pip install -e ./training[tests]
50+
else
51+
echo "Installing training from PyPI"
52+
pip install anemoi-training[tests]
53+
fi
54+
55+
- name: Install graphs package
56+
run: |
57+
if [[ ${{ steps.changed-packages.outputs.graphs_changed }} == 'true' ]]; then
58+
echo "Installing graphs from local source"
59+
pip install -e ./graphs[tests]
60+
else
61+
echo "Installing graphs from PyPI"
62+
pip install anemoi-graphs[tests]
63+
fi
64+
65+
- name: Install models package
66+
run: |
67+
if [[ ${{ steps.changed-packages.outputs.models_changed }} == 'true' ]]; then
68+
echo "Installing models from local source"
69+
pip install -e ./models[tests]
70+
else
71+
echo "Installing models from PyPI"
72+
pip install anemoi-models[tests]
73+
fi
74+
75+
- name: Run pytest for changed training package
76+
if: steps.changed-packages.outputs.training_changed == 'true'
77+
uses: ecmwf-actions/reusable-workflows/.github/workflows/qa-pytest-pyproject.yml@v2
78+
with:
79+
python-version: ${{ matrix.python-version }}
80+
install-dependencies: false
81+
custom-pytest: pytest training/tests
82+
83+
- name: Run pytest for changed graphs package
84+
if: steps.changed-packages.outputs.graphs_changed == 'true'
85+
uses: ecmwf-actions/reusable-workflows/.github/workflows/qa-pytest-pyproject.yml@v2
86+
with:
87+
python-version: ${{ matrix.python-version }}
88+
install-dependencies: false
89+
custom-pytest: pytest graphs/tests
90+
91+
- name: Run pytest for changed models package
92+
if: steps.changed-packages.outputs.models_changed == 'true'
93+
uses: ecmwf-actions/reusable-workflows/.github/workflows/qa-pytest-pyproject.yml@v2
94+
with:
95+
python-version: ${{ matrix.python-version }}
96+
install-dependencies: false
97+
custom-pytest: pytest models/tests
98+
99+
- name: Run integration tests
100+
if: success()
101+
uses: ecmwf-actions/reusable-workflows/.github/workflows/qa-pytest-pyproject.yml@v2
102+
with:
103+
python-version: ${{ matrix.python-version }}
104+
install-dependencies: false

tests/test_integration.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# (C) Copyright 2025 Anemoi contributors.
2+
#
3+
# This software is licensed under the terms of the Apache Licence Version 2.0
4+
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
5+
#
6+
# In applying this licence, ECMWF does not waive the privileges and immunities
7+
# granted to it by virtue of its status as an intergovernmental organisation
8+
# nor does it submit to any jurisdiction.
9+
10+
11+
def test_dummy():
12+
pass

0 commit comments

Comments
 (0)