forked from NOAA-EMC/global-workflow
-
Notifications
You must be signed in to change notification settings - Fork 0
173 lines (161 loc) · 4.78 KB
/
pw_aws_ci.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
name: gw-ci-aws
# TEST_DIR contains 2 directories;
# 1. HOMEgfs: clone of the global-workflow
# 2. RUNTESTS: A directory containing EXPDIR and COMROT for experiments
# e.g. $> tree ./TEST_DIR
# ./TEST_DIR
# ├── HOMEgfs
# └── RUNTESTS
# ├── COMROT
# │ └── ${pslot}
# └── EXPDIR
# └── ${pslot}
on:
workflow_dispatch:
inputs:
pr_number:
description: 'PR Number (use 0 for non-PR)'
required: true
default: '0'
os:
description: 'Operating System'
required: true
type: choice
options:
- rocky
- centos
env:
TEST_DIR: ${{ github.workspace }}/${{ github.run_id }}
MACHINE_ID: noaacloud
jobs:
run-start-clusters:
runs-on: ubuntu-latest
env:
PW_PLATFORM_HOST: noaa.parallel.works
steps:
- name: Checkout pw-cluster-automation repository
uses: actions/checkout@v4
with:
repository: TerrenceMcGuinness-NOAA/pw-cluster-automation
path: pw-cluster-automation
ref: pw_cluster_noaa
- name: Run startClusters
run: |
mkdir -p ~/.ssh
echo "${{ secrets.ID_RSA_AWS }}" > ~/.ssh/id_rsa
echo "${{ secrets.PW_API_KEY }}" > ~/.ssh/pw_api.key
chmod 700 ~/.ssh
chmod 600 ~/.ssh/id_rsa
chmod 600 ~/.ssh/pw_api.key
if [ "${{ github.event.inputs.os }}" == "rocky" ]; then
clustername="globalworkflowciplatformrocky8"
elif [ "${{ github.event.inputs.os }}" == "centos" ]; then
clustername="awsemctmcgc7i48xlargeciplatform"
fi
python3 pw-cluster-automation/startClusters.py $clustername
fetch-branch:
needs: run-start-clusters
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.GITHUBTOKEN }}
outputs:
branch: ${{ steps.get-branch.outputs.branch }}
repo: ${{ steps.get-branch.outputs.repo }}
steps:
- name: Fetch branch name and repo for PR
id: get-branch
run: |
pr_number=${{ github.event.inputs.pr_number }}
if [ "$pr_number" -eq "0" ]; then
branch=${{ github.event.inputs.ref }}
repo=${{ github.repository }}
else
branch=$(gh pr view $pr_number --repo $repo --json headRefName --jq '.headRefName')
repo_owner=$(gh pr view $pr_number --repo $repo --json headRepositoryOwner --jq '.headRepositoryOwner.login')
repo_name=$(gh pr view $pr_number --repo $repo --json headRepository --jq '.headRepository.name')
repo="$repo_owner/$repo_name"
fi
{
echo "branch=$branch"
echo "repo=$repo"
} >> $GITHUB_OUTPUT
checkout:
needs: fetch-branch
runs-on:
- self-hosted
- aws
- parallelworks
- ${{ github.event.inputs.os }}
timeout-minutes: 600
steps:
- name: Checkout global-workflow
uses: actions/checkout@v4
with:
path: ${{ github.run_id }}/HOMEgfs
submodules: 'recursive'
repository: ${{ needs.fetch-branch.outputs.repo }}
ref: ${{ needs.fetch-branch.outputs.branch }}
build-link:
needs: checkout
runs-on:
- self-hosted
- aws
- parallelworks
- ${{ github.event.inputs.os }}
steps:
- name: Build components
run: |
cd ${{ env.TEST_DIR }}/HOMEgfs/sorc
./build_all.sh -j 8
- name: Link artifacts
run: |
cd ${{ env.TEST_DIR }}/HOMEgfs/sorc
./link_workflow.sh
create-experiments:
needs: build-link
runs-on:
- self-hosted
- aws
- parallelworks
- ${{ github.event.inputs.os }}
strategy:
matrix:
case: ["C48_ATM"]
steps:
- name: Create Experiments ${{ matrix.case }}
env:
RUNTESTS: ${{ env.TEST_DIR }}/RUNTESTS
pslot: ${{ matrix.case }}.${{ github.run_id }}
run: |
mkdir -p ${{ env.RUNTESTS }}
cd ${{ env.TEST_DIR }}/HOMEgfs
source workflow/gw_setup.sh
source ci/platforms/config.noaacloud
./workflow/create_experiment.py --yaml ci/cases/pr/${{ matrix.case }}.yaml --overwrite
run-experiments:
needs: create-experiments
runs-on:
- self-hosted
- aws
- parallelworks
- ${{ github.event.inputs.os }}
strategy:
matrix:
case: ["C48_ATM"]
steps:
- name: Run Experiment ${{ matrix.case }}
run: |
cd ${{ env.TEST_DIR }}/HOMEgfs
./ci/scripts/run-check_ci.sh ${{ env.TEST_DIR }} ${{ matrix.case }}.${{ github.run_id }} HOMEgfs
clean-up:
needs: run-experiments
runs-on:
- self-hosted
- aws
- parallelworks
- ${{ github.event.inputs.os }}
steps:
- name: Clean up workspace
run: |
echo "Cleaning up workspace"
rm -rf ${{ env.TEST_DIR }}