-
Notifications
You must be signed in to change notification settings - Fork 42
139 lines (121 loc) · 4.54 KB
/
test.yml
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
# workflow is for testing a version of Oasislmf vs piwind's
# expected results:
# either:
# 1) given an oasislmf package file "oasislmf_package" build
# a new model worker with that package and run tests
#
# 2) given an oasislmf git branch "oasislmf_branch", pip install
# the the oasislmf into a worker image and run tests
name: PiWind Testing
on:
push:
branches:
- main
- stable**
pull_request:
branches:
- main
- stable**
workflow_dispatch:
inputs:
oasislmf_branch:
description: "Branch from oasislmf to test piwind with [git ref]"
required: True
type: string
workflow_call:
inputs:
piwind_branch:
description: "PiWind branch to test results [git ref]"
required: True
type: string
oasislmf_branch:
description: "Branch from oasislmf to test piwind with [git ref]"
required: false
type: string
oasislmf_package:
description: "Oasislmf package build to test [pkg_filename]"
required: false
type: string
ods_package:
description: "ods_tools package build to test [pkg_filename]"
required: false
type: string
platform_version:
description: "Platform Version tag [semvar]"
required: false
type: string
pytest_opts:
description: 'pass extra options to pytest'
required: false
type: string
storage_suffix:
description: 'Edit storage name'
required: false
type: string
env:
oasislmf_branch: 'main'
oasislmf_package: ''
piwind_branch: ${{ github.ref }}
platform_tag: 'latest'
jobs:
params:
name: Update params
runs-on: ubuntu-latest
outputs:
piwind_branch: ${{ steps.export_param.outputs.piwind_branch }}
oasislmf_branch: ${{ steps.export_param.outputs.oasislmf_branch }}
oasislmf_package: ${{ steps.export_param.outputs.oasislmf_package }}
ods_package: ${{ steps.export_param.outputs.ods_package }}
platform_version: ${{ steps.export_param.outputs.platform_version }}
steps:
- name: Set Inputs
run: |
[[ -z "${{ inputs.piwind_branch }}" ]] || echo "piwind_branch=${{ inputs.piwind_branch }}" >> $GITHUB_ENV
[[ -z "${{ inputs.platform_version }}" ]] || echo "platform_tag=${{ inputs.platform_version }}" >> $GITHUB_ENV
echo "oasislmf_branch=${{ inputs.oasislmf_branch }}" >> $GITHUB_ENV
echo "oasislmf_package=${{ inputs.oasislmf_package }}" >> $GITHUB_ENV
echo "ods_package=${{ inputs.ods_package }}" >> $GITHUB_ENV
- name: Update params (Push)
if: github.event_name == 'push'
run: |
echo "oasislmf_branch=${{ github.ref_name }}" >> $GITHUB_ENV
echo "piwind_branch=${{ github.ref_name }}" >> $GITHUB_ENV
- name: Update params (Pull Request)
if: github.event_name == 'pull_request'
run: |
# Check if PR is from OasisPiWind / OasisLMF and set other target
if [[ -z "${{ inputs.piwind_branch }}" ]]; then
# Pull Request from PiWind (Set MDK)
echo "oasislmf_branch=${{ github.base_ref }}" >> $GITHUB_ENV
else
# Pull Request from OasisLMF (Set piwind)
echo "piwind_branch=${{ github.base_ref }}" >> $GITHUB_ENV
fi
- id: export_param
name: Output params
run: |
if [[ -n "${{ inputs.oasislmf_package }}" ]]; then
# If oasislmf package is given remove branch install option
echo "oasislmf_branch=" >> $GITHUB_ENV
else
echo "oasislmf_branch=${{ env.oasislmf_branch }}" >> $GITHUB_OUTPUT
fi
echo "piwind_branch=${{ env.piwind_branch }}" >> $GITHUB_OUTPUT
echo "oasislmf_package=${{ env.oasislmf_package }}" >> $GITHUB_OUTPUT
echo "ods_package=${{ env.ods_package }}" >> $GITHUB_OUTPUT
echo "platform_version=${{ env.platform_tag }}" >> $GITHUB_OUTPUT
test:
name: PiWind Integration
uses: ./.github/workflows/integration.yml
secrets: inherit
needs: [params]
with:
piwind_branch: ${{ needs.params.outputs.piwind_branch }}
ods_package: ${{ needs.params.outputs.ods_package }}
oasislmf_package: ${{ needs.params.outputs.oasislmf_package }}
oasislmf_branch: ${{ needs.params.outputs.oasislmf_branch }}
worker_tag: ${{ needs.params.outputs.platform_version }}
server_tag: ${{ needs.params.outputs.platform_version }}
debug_mode: 1
pytest_opts: ${{ inputs.pytest_opts }}
storage_suffix: ${{ inputs.storage_suffix }}