Skip to content

Commit 53cd44b

Browse files
committed
Merge branch 'master' into develop
2 parents 2f44cc3 + e526bae commit 53cd44b

File tree

2 files changed

+141
-36
lines changed

2 files changed

+141
-36
lines changed

.github/workflows/check_results.yml

Lines changed: 83 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
name: check_results
4848

4949
on:
50+
push:
5051
workflow_dispatch:
5152
inputs:
5253
build_branch:
@@ -65,23 +66,41 @@ on:
6566
description: 'Build new worker based on "mdk_branch" value'
6667
required: true
6768
default: true
68-
push:
69+
70+
71+
workflow_call:
72+
inputs:
73+
build_branch:
74+
description: 'Branch of build script repo - https://github.com/OasisLMF/build'
75+
required: true
76+
type: string
77+
platform_version:
78+
description: 'OasisPlatform Version to test using'
79+
required: true
80+
type: string
81+
mdk_branch:
82+
description: 'Branch to test from Oasislmf repo - https://github.com/OasisLMF/OasisLMF'
83+
required: true
84+
type: string
85+
build_worker:
86+
description: 'Build new worker based on "mdk_branch" value'
87+
required: true
88+
type: string
89+
piwind_branch:
90+
description: 'Branch of PiWind to test (Only needed for remote triggers)'
91+
required: true
92+
type: string
93+
6994

7095
env:
7196
# Build repo vars
7297
BUILD_REPO: OasisLMF/build # fixed repo for shared build scripts
7398
BUILD_WORKSPACE: oasis_build # dir to clone build repo to
74-
BUILD_BRANCH: "${{ github.event_name == 'repository_dispatch' && github.event.inputs.build_branch || 'master' }}" # build repo branch to use
7599
MODEL_SH: /buildscript/utils.sh # Bash script functions (loads the shared build bash functions)
76100

77-
# 'Create' a new `coreoasis/model_worker` image but git installing oasislmf using the "MDK_BRANCH" value
78-
BUILD_WORKER: "${{ github.event_name == 'repository_dispatch' && github.event.inputs.build_worker || 'true' }}" # enable / disable
79-
MDK_BRANCH: "${{ github.event_name == 'repository_dispatch' && github.event.inputs.mdk_branch || 'develop' }}" # branch to git install from
80-
TAG_RELEASE: ${{ github.ref_name }}-${{ github.run_number }} # tag for new `coreoasis/model_worker` image
81-
82101
# OasisPlatform options
102+
TAG_RELEASE: ${{ github.ref_name }}-${{ github.run_number }} # tag for new `coreoasis/model_worker` image
83103
LAST_RELEASE_TAG: '' # (Not needed here)
84-
TAG_OASIS: "${{ github.event_name == 'repository_dispatch' && github.event.inputs.platform_version || 'latest' }}" # Verion of OasisPlatform to run tests with
85104
MODEL_WORKSPACE: ${{ github.workspace }}/piwind_workspace # PiWind path month for model_worker
86105
MODEL_BRANCH: ${{ github.ref_name }}
87106
IMAGE_WORKER: coreoasis/model_worker # Docker image to use as worker
@@ -94,22 +113,34 @@ env:
94113
# Docker test max timeout (seconds)
95114
TEST_MAX_RUNTIME: 300
96115

116+
# Input vars (defaults)
117+
PIWIND_BRANCH: ${{ github.ref_name }}
118+
BUILD_BRANCH: 'master' # build repo branch to use
119+
BUILD_WORKER: 'true' # enable / disable
120+
MDK_BRANCH: 'develop' # branch to git install from
121+
TAG_OASIS: 'latest' # Verion of OasisPlatform to run tests with
122+
97123
jobs:
98124
check_results:
99125
runs-on: ubuntu-latest
100126
steps:
101-
- name: clone PiWind repository
102-
uses: actions/checkout@v3
103-
with:
104-
submodules: true
105-
path: ${{ env.MODEL_WORKSPACE }}
106-
- name: clone build repository
107-
uses: actions/checkout@v3
108-
with:
109-
repository: ${{ env.BUILD_REPO }}
110-
ref: ${{ env.BUILD_BRANCH }}
111-
path: ${{ env.BUILD_WORKSPACE }}
112-
- name: set default vars
127+
- name: Set input - piwind_branch
128+
if: inputs.piwind_branch != ''
129+
run: echo "PIWIND_BRANCH=${{ inputs.piwind_branch }}" >> $GITHUB_ENV
130+
- name: Set input - build_branch
131+
if: inputs.build_branch != ''
132+
run: echo "BUILD_BRANCH=${{ inputs.build_branch }}" >> $GITHUB_ENV
133+
- name: Set input - build_worker
134+
if: inputs.build_worker != ''
135+
run: echo "BUILD_WORKER=${{ inputs.build_worker }}" >> $GITHUB_ENV
136+
- name: Set input - mdk_branch
137+
if: inputs.mdk_branch != ''
138+
run: echo "MDK_BRANCH=${{ inputs.mdk_branch }}" >> $GITHUB_ENV
139+
- name: Set input - platform_version
140+
if: inputs.platform_version != ''
141+
run: echo "TAG_OASIS=${{ inputs.platform_version }}" >> $GITHUB_ENV
142+
143+
- name: Set Docker compose ENV
113144
run: |
114145
echo "TAG_OASIS=${TAG_OASIS}" >> $GITHUB_ENV
115146
echo "TAG_RELEASE=${TAG_RELEASE#*\/}" >> $GITHUB_ENV
@@ -127,9 +158,38 @@ jobs:
127158
echo "PATH_KEYS_DATA=${MODEL_WORKSPACE}/keys_data/PiWind" >> $GITHUB_ENV # same as keys_data
128159
echo "TEST_DATA_DIR=${MODEL_WORKSPACE}/tests" >> $GITHUB_ENV
129160
echo "MULTI_PERIL=1" >> $GITHUB_ENV # Set the GUL alloc rule to 1 in compose
130-
- name: Disable MDK worker build for master based branches
131-
if: env.MODEL_BRANCH == 'master' || contains(env.MODEL_BRANCH, 'hotfix')
132-
run: echo "BUILD_WORKER=false" >> $GITHUB_ENV
161+
162+
- name: Set Production mode for testing master branch (MDK)
163+
if: |
164+
github.event_name == 'push' &&
165+
(env.MDK_BRANCH == 'master' || contains(env.MDK_BRANCH, 'hotfix'))
166+
run: |
167+
echo "BUILD_WORKER=false" >> $GITHUB_ENV
168+
echo "PIWIND_BRANCH=master" >> $GITHUB_ENV
169+
- name: Set Production mode for testing master branch (PiWind)
170+
if: |
171+
github.event_name == 'push' &&
172+
(env.PIWIND_BRANCH == 'master' || contains(env.PIWIND_BRANCH, 'hotfix'))
173+
run: |
174+
echo "BUILD_WORKER=false" >> $GITHUB_ENV
175+
echo "MDK_BRANCH=master" >> $GITHUB_ENV
176+
177+
- name: clone PiWind repository
178+
uses: actions/checkout@v3
179+
with:
180+
repository: OasisLMF/OasisPiWind
181+
fetch-depth: 1
182+
ref: ${{ env.PIWIND_BRANCH }}
183+
path: ${{ env.MODEL_WORKSPACE }}
184+
- name: clone build repository
185+
uses: actions/checkout@v3
186+
with:
187+
repository: ${{ env.BUILD_REPO }}
188+
fetch-depth: 1
189+
ref: ${{ env.BUILD_BRANCH }}
190+
path: ${{ env.BUILD_WORKSPACE }}
191+
192+
133193
- name: build worker
134194
# see open issue on if statements
135195
# https://github.com/actions/runner/issues/1173

.github/workflows/run_mdk.yml

Lines changed: 58 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# ==============================================================================
22
# Workflow description:
33
# Runs the command line interface of OasisLMF package on the PiWind model.
4-
# Multiple versions of python are tested and be extending via
4+
# Multiple versions of python are tested and be extending via
55
# the `py-version` test matrix.
66
#
77
# Loss results are not checked and the workflow should only fail on:
@@ -13,7 +13,7 @@
1313
name: run_mdk
1414

1515
on:
16-
#repository_dispatch:
16+
push:
1717
workflow_dispatch:
1818
inputs:
1919
build_branch:
@@ -28,16 +28,37 @@ on:
2828
description: 'Loss modes to test, options are one of "[gul, il, ri]"'
2929
required: true
3030
default: ri
31-
push:
31+
32+
workflow_call:
33+
inputs:
34+
build_branch:
35+
description: 'Branch of build script repo - https://github.com/OasisLMF/build'
36+
required: true
37+
type: string
38+
mdk_branch:
39+
description: 'Branch to test from Oasislmf repo - https://github.com/OasisLMF/OasisLMF'
40+
required: true
41+
type: string
42+
mdk_run_type:
43+
description: 'Loss modes to test, options are one of "[gul, il, ri]"'
44+
required: true
45+
type: string
46+
piwind_branch:
47+
description: 'Branch of PiWind to test (Only needed for remote triggers)'
48+
required: true
49+
type: string
3250

3351
env:
52+
# Fixed
3453
BUILD_REPO: OasisLMF/build
3554
BUILD_WORKSPACE: oasis_build
36-
MODEL_BRANCH: ${{ github.ref_name }}
3755
MODEL_WORKSPACE: ${{ github.workspace }}/piwind_workspace
38-
BUILD_BRANCH: "${{ github.event_name == 'repository_dispatch' && github.event.inputs.build_branch || 'master' }}"
39-
MDK_BRANCH: "${{ github.event_name == 'repository_dispatch' && github.event.inputs.mdk_branch || 'develop' }}"
40-
MDK_RUN: "${{ github.event_name == 'repository_dispatch' && github.event.inputs.mdk_run_type || 'ri' }}"
56+
57+
# Input vars (defaults)
58+
PIWIND_BRANCH: ${{ github.ref_name }}
59+
BUILD_BRANCH: 'master'
60+
MDK_BRANCH: 'develop'
61+
MDK_RUN: 'ri'
4162

4263
jobs:
4364
run_mdk:
@@ -46,11 +67,35 @@ jobs:
4667
matrix:
4768
py-version: [3.8, 3.9]
4869
steps:
49-
- name: clone PiWind repository
50-
uses: actions/checkout@v3
51-
with:
52-
submodules: true
53-
path: ${{ env.MODEL_WORKSPACE }}
70+
71+
- name: Set input - piwind_branch
72+
if: inputs.piwind_branch != ''
73+
run: echo "PIWIND_BRANCH=${{ inputs.piwind_branch }}" >> $GITHUB_ENV
74+
- name: Set input - build_branch
75+
if: inputs.build_branch != ''
76+
run: echo "BUILD_BRANCH=${{ inputs.build_branch }}" >> $GITHUB_ENV
77+
- name: Set input - mdk_branch
78+
if: inputs.mdk_branch != ''
79+
run: echo "MDK_BRANCH=${{ inputs.mdk_branch }}" >> $GITHUB_ENV
80+
- name: Set input - mdk_run
81+
if: inputs.mdk_run_type != ''
82+
run: echo "MDK_RUN=${{ inputs.mdk_run_type }}" >> $GITHUB_ENV
83+
84+
- name: Set Production mode for testing master branch (MDK)
85+
if: |
86+
github.event_name == 'push' &&
87+
(env.MDK_BRANCH == 'master' || contains(env.MDK_BRANCH, 'hotfix'))
88+
run: |
89+
echo "BUILD_WORKER=false" >> $GITHUB_ENV
90+
echo "PIWIND_BRANCH=master" >> $GITHUB_ENV
91+
- name: Set Production mode for testing master branch (PiWind)
92+
if: |
93+
github.event_name == 'push' &&
94+
(env.PIWIND_BRANCH == 'master' || contains(env.PIWIND_BRANCH, 'hotfix'))
95+
run: |
96+
echo "BUILD_WORKER=false" >> $GITHUB_ENV
97+
echo "MDK_BRANCH=master" >> $GITHUB_ENV
98+
5499
- name: clone build repository
55100
uses: actions/checkout@v3
56101
with:
@@ -62,4 +107,4 @@ jobs:
62107
run: |
63108
sed -i 's/FROM.*/FROM python:${{ matrix.py-version }}/g' docker/Dockerfile.mdk-tester
64109
docker build -f docker/Dockerfile.mdk-tester -t mdk-runner:${{ matrix.py-version }} .
65-
docker run mdk-runner:${{ matrix.py-version }} --model-repo-branch ${{ env.MODEL_BRANCH}} --mdk-repo-branch ${{ env.MDK_BRANCH }} --model-run-mode ${{ env.MDK_RUN }}
110+
docker run mdk-runner:${{ matrix.py-version }} --model-repo-branch ${{ env.PIWIND_BRANCH}} --mdk-repo-branch ${{ env.MDK_BRANCH }} --model-run-mode ${{ env.MDK_RUN }}

0 commit comments

Comments
 (0)