-
Notifications
You must be signed in to change notification settings - Fork 2
212 lines (206 loc) · 7.52 KB
/
mpas-app.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
name: MPAS App
on:
push:
branches: [ develop, main ]
pull_request:
branches: [ develop, main ]
types: [ labeled ]
workflow_dispatch:
jobs:
mpas-app-lint-check:
runs-on: ubuntu-latest
steps:
-
name: Checkout repository
uses: actions/checkout@v4
-
name: Format Check
run: |
pip install flake8 black isort
flake8 apps/mpas/bin
black apps/mpas/bin --check --diff
isort apps/mpas/bin --check --diff --profile black
test-mpas-app-amd64:
if: ${{ github.event.label.name == 'Test-MPAS-App' }}
runs-on: ubuntu2204-16c-64g-600ssd
timeout-minutes: 360
permissions:
packages: write
contents: read
steps:
-
name: Checkout repository
uses: actions/checkout@v4
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
logout: false
-
name: Prune pre-loaded GHA docker images
run: |
docker images
docker image prune -a -f
docker images
-
name: Start Slurm cluster containers
run: |
cd tests
export DOCKER_CLIENT_TIMEOUT=600
export COMPOSE_HTTP_TIMEOUT=600
docker compose version
docker compose -f docker-compose-test.yml config
docker images
docker ps -a
docker compose -f docker-compose-test.yml up -d
-
name: Copy test files to work directory
run: |
docker exec frontend bash -l -c "mkdir -p work; cd work ; cp -r ../chiltepin/* ."
-
name: Install chiltepin package
run: |
docker exec frontend bash -l -c "cd work ; module use /opt/spack-stack/envs/unified-env/install/modulefiles/Core ; module load stack-gcc; module load stack-openmpi; module load stack-python ; python -m venv .chiltepin"
docker exec frontend bash -l -c "cd work ; source .chiltepin/bin/activate ; pip --use-deprecated=legacy-resolver install -e .[test]"
-
name: Run mpas workflow
run: |
docker exec frontend bash -l -c "cd work; source .chiltepin/bin/activate; cd apps/mpas/bin ; python experiment.py ../config/user_config.yaml"
docker exec frontend bash -l -c "cd work/apps/mpas/experiments/test ; ls -lrt ; tail 2023091500/forecast/log.atmosphere.0000.out"
-
name: Debug session
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
timeout-minutes: 60
with:
limit-access-to-actor: true
-
name: Shut down Slurm cluster containers
run: |
cd docker
export DOCKER_CLIENT_TIMEOUT=600
export COMPOSE_HTTP_TIMEOUT=600
docker compose -f docker-compose.yml down
test-mpas-app-arm64:
if: ${{ github.event.label.name == 'Test-MPAS-App' }}
runs-on: LinuxARM64-16core-64G-600Gb
timeout-minutes: 360
permissions:
packages: write
contents: read
steps:
-
# Beta ARM runners do not have Docker installed
name: Install Docker
run: |
# Uninstall incompatible packages
for pkg in docker.io containerd runc; do sudo apt-get remove $pkg; done
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update -y
# Install docker packages
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
# Allow runner use to run docker without sudo
sudo usermod -aG docker $USER
sudo apt-get install acl
sudo setfacl --modify user:$USER:rw /var/run/docker.sock
-
name: Test Docker Installation
run: docker run hello-world
-
name: Checkout repository
uses: actions/checkout@v4
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
logout: false
-
name: Prune pre-loaded GHA docker images
run: |
docker images
docker image prune -a -f
docker images
-
name: Start Slurm cluster containers
run: |
cd tests
export DOCKER_CLIENT_TIMEOUT=600
export COMPOSE_HTTP_TIMEOUT=600
docker compose version
docker compose -f docker-compose-test.yml config
docker images
docker ps -a
docker compose -f docker-compose-test.yml up -d
-
name: Copy test files to work directory
run: |
docker exec frontend bash -l -c "mkdir -p work; cd work ; cp -r ../chiltepin/* ."
-
name: Install chiltepin package
run: |
docker exec frontend bash -l -c "cd work ; module use /opt/spack-stack/envs/unified-env/install/modulefiles/Core ; module load stack-gcc; module load stack-openmpi; module load stack-python ; python -m venv .chiltepin"
docker exec frontend bash -l -c "cd work ; source .chiltepin/bin/activate ; pip --use-deprecated=legacy-resolver install -e ."
-
name: Run mpas workflow
run: |
docker exec frontend bash -l -c "cd work; source .chiltepin/bin/activate; cd apps/mpas/bin ; python experiment.py ../config/user_config.yaml"
docker exec frontend bash -l -c "cd work/apps/mpas/experiments/test ; ls -lrt ; tail 2023091500/forecast/log.atmosphere.0000.out"
-
name: Debug session
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3
timeout-minutes: 60
with:
limit-access-to-actor: true
-
name: Shut down Slurm cluster containers
run: |
cd docker
export DOCKER_CLIENT_TIMEOUT=600
export COMPOSE_HTTP_TIMEOUT=600
docker compose -f docker-compose.yml down
remove-label:
if: ${{ github.event.label.name == 'Test-MPAS-App' && always() }}
runs-on: ubuntu-latest
needs: [test-mpas-app-amd64, test-mpas-app-arm64]
timeout-minutes: 360
permissions:
pull-requests: write
steps:
-
name: Remove Test-MPAS-App label
run: |
curl -L \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.LABEL_PR }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.number }}/labels/Test-MPAS-App