-
Notifications
You must be signed in to change notification settings - Fork 77
162 lines (140 loc) · 5.37 KB
/
test-build-spack.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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
name: Build ESMF Using Spack
env:
compiler: gcc@latest
esmf_version: 'esmf@develop'
nuopc_app_version: 'develop'
on:
workflow_dispatch:
inputs:
compiler:
description: 'Compiler version like [email protected] or gcc@latest (latest available version on runner)'
required: false
type: string
default: 'gcc@latest'
esmf_version:
description: 'ESMF version or tag like esmf@develop or esmf@=8.5.0b23'
required: false
type: string
default: 'esmf@develop'
nuopc_app_version:
description: 'NUOPC Application Prototypes version or tag like develop or v8.5.0b23'
required: false
type: string
default: 'develop'
schedule:
- cron: '0 6 * * *'
jobs:
set-matrix:
runs-on: ubuntu-24.04
outputs:
matrix: ${{ steps.list_comp_pkgs.outputs.matrix }}
nuopc_app_version: ${{ steps.list_comp_pkgs.outputs.nuopc_app_version }}
steps:
# generete matrix
- name: Generate Matrix by Listing Compiler and ESMF Packages
id: list_comp_pkgs
run: |
# output variables for debugging
echo "INPUT: >${{ inputs.esmf_version }}< >${{ inputs.nuopc_app_version }}<"
echo "ENV : >${{ env.esmf_version }}< >${{ env.nuopc_app_version }}<"
# create matrix JSON file
if [ -z "${{ inputs.compiler }}" ]; then
str1="{\"compiler\": [\"${{ env.compiler }}\"],"
else
str1="{\"compiler\": [\"${{ inputs.compiler }}\"],"
fi
if [ -z "${{ inputs.esmf_version }}" ]; then
str2="\"esmf\": [\"${{ env.esmf_version }}+external-parallelio\", \"${{ env.esmf_version }}~external-parallelio\"]}"
echo "nuopc_app_version=${{ env.nuopc_app_version }}" >> $GITHUB_OUTPUT
else
str2="\"esmf\": [\"${{ inputs.esmf_version }}+external-parallelio\", \"${{ inputs.esmf_version }}~external-parallelio\"]}"
echo "nuopc_app_version=${{ inputs.nuopc_app_version }}" >> $GITHUB_OUTPUT
fi
# output contect for debugging
echo "matrix=${str1}${str2}"
# output for next step
echo "matrix=${str1}${str2}" >> $GITHUB_OUTPUT
build:
needs: set-matrix
runs-on: ubuntu-24.04
strategy:
matrix: ${{ fromJson(needs.set-matrix.outputs.matrix) }}
steps:
# check out base repo
- name: Checkout Base Repository
uses: actions/checkout@v3
# prepare core environment
- name: Install Core Development Tools
run: |
sudo apt-get -qq update
sudo apt-get -qq install tar unzip file curl gringo
sudo apt-get -qq install build-essential binutils-dev gfortran gdb
sudo apt-get -qq install gfortran-12 gfortran-13
sudo apt-get -qq install python3-dev
# restore Intel oneAPI compiler installation from cache
- name: Restore Intel oneAPI Compiler Installation
uses: actions/cache@v3
if: ${{ startsWith(matrix.compiler, 'oneapi') }}
with:
path: /opt/intel/oneapi
key: intel-${{ runner.os }}-${{ matrix.compiler }}
restore-keys: |
intel-${{ runner.os }}-${{ matrix.compiler }}
# install compiler
- name: Install Intel oneAPI Compiler
if: ${{ startsWith(matrix.compiler, 'oneapi') }}
run: |
cd ${{ github.workspace }}/.github/workflows
scripts/install_oneapi.sh -c ${{ matrix.compiler }}
# concretize test environment
- name: Concretize Spack Environment Using YAML Specification
run: |
${{ github.workspace }}/.github/workflows/scripts/spack_concretize.sh \
-a x86_64 \
-c ${{ matrix.compiler }} \
-d ${{ matrix.esmf }} \
-i ~/.spack-ci \
-r ${{ github.workspace }}
# install test environment
- name: Install ESMF with Spack
run: |
${{ github.workspace }}/.github/workflows/scripts/spack_install.sh \
-r ${{ github.workspace }}
# checkout NUOPC app prototypes
- name: Checkout NUOPC App Prototypes
uses: actions/checkout@v3
with:
repository: esmf-org/nuopc-app-prototypes
path: ${{ github.workspace }}/nuopc-app-prototypes
ref: ${{ needs.set-matrix.outputs.nuopc_app_version }}
# test installation using NUOPC app prototypes
- name: Run NUOPC App Prototypes
run: |
${{ github.workspace }}/.github/workflows/scripts/run_nuopc_app_proto.sh \
-c ${{ matrix.compiler }} \
-r ${{ github.workspace }}/nuopc-app-prototypes \
-s ~/.spack-ci
# compress run directory of NUOPC app prototypes
- name: Prepare NUOPC App Prototypes Artifacts Directory
run: |
cd ${{ github.workspace }}/nuopc-app-prototypes
mkdir Artifacts
mv NUOPC-PROTO-RESULTS Artifacts/
# push test results to artifacts
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: Artifacts for ${{ matrix.compiler }} ${{ matrix.esmf }}
path: ${{ github.workspace }}/nuopc-app-prototypes/Artifacts
retention-days: 5
# force to fail if there is any failed nuopc app prototypes
- name: Check Result of NUOPC App Prototypes
run: |
if [[ "${{ env.NUOPC_APP_PROTO_PASS }}" == "false" ]]; then
echo "Some of NUOPC app prototypes are failed! Exiting ..."
exit 1
else
echo "All tests are passed."
exit 0
fi
shell: bash