-
Notifications
You must be signed in to change notification settings - Fork 27
165 lines (141 loc) · 5.64 KB
/
Copy pathbit-compare-host.yml
File metadata and controls
165 lines (141 loc) · 5.64 KB
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
name: bit-compare-host
# Controls when the action will run
on:
# Trigger on pushes to main only. Feature branches and cycle LTS branches
# are validated via their pull request — running on push as well would
# double-spend minutes for internal PRs, and LTS branches are protected.
push:
branches:
- main
# Trigger the workflow on all pull requests
pull_request: ~
# Allow workflow to be dispatched on demand
workflow_dispatch: ~
concurrency:
group: bit-compare-host-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
CACHE_SUFFIX: v1 # Increase to force new cache to be created
jobs:
ci:
name: ci
strategy:
fail-fast: false # false: try to complete all jobs
matrix:
name:
- linux gcc-12
- linux gcc-13
- linux gcc-14
include:
- name: linux gcc-12
os: ubuntu-24.04
gcc: '12'
- name: linux gcc-13
os: ubuntu-24.04
gcc: '13'
- name: linux gcc-14
os: ubuntu-24.04
gcc: '14'
runs-on: ${{ matrix.os }}
timeout-minutes: 240
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Derive cycle from bundle.yml
run: |
set -eu
version=$(awk '/^name[[:space:]]*:[[:space:]]*ifs-bundle/{found=1} found && /^version[[:space:]]*:/{print $NF; exit}' bundle.yml)
IFS=. read -r MAJ MIN PAT <<< "$version"
OIFS_VERSION="${MAJ}r${MIN}"
CYCLE_BRANCH="openifs-lts/CY${MAJ}R${MIN}.${PAT}"
if [ -z "$(git ls-remote --heads origin "$CYCLE_BRANCH")" ]; then
echo "Cycle branch ${CYCLE_BRANCH} not found on remote — falling back to main"
CYCLE_BRANCH=main
fi
echo "OIFS_VERSION=${OIFS_VERSION}" >> $GITHUB_ENV
echo "CYCLE_BRANCH=${CYCLE_BRANCH}" >> $GITHUB_ENV
- name: Environment
env:
PR_BASE_REF: ${{ github.event.pull_request.base.ref }}
run: |
set -eu
# WORK_DIR sits outside github.workspace because the test phase copies
# the workspace into WORK_DIR/build_dir_test/...; a destination inside
# the source would recurse into itself in shutil.copytree.
WORK_DIR="${{ runner.temp }}/_oifs_host_ci"
echo "CI_DIR=${{ github.workspace }}/scripts/ci/host_ci" >> $GITHUB_ENV
echo "WORK_DIR=${WORK_DIR}" >> $GITHUB_ENV
echo "NORMS_DIR=${WORK_DIR}/control_saved_norms" >> $GITHUB_ENV
echo "REPORTS_DIR=${WORK_DIR}/ci_reports" >> $GITHUB_ENV
CONTROL_BRANCH="${PR_BASE_REF:-$CYCLE_BRANCH}"
echo "CONTROL_BRANCH=${CONTROL_BRANCH}" >> $GITHUB_ENV
- name: Install build dependencies (apt)
run: |
set -eu
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
gcc-${{ matrix.gcc }} g++-${{ matrix.gcc }} gfortran-${{ matrix.gcc }} \
cmake ninja-build make \
libopenmpi-dev openmpi-bin \
libnetcdf-dev libnetcdff-dev netcdf-bin \
libboost-dev libboost-date-time-dev libboost-filesystem-dev \
libboost-serialization-dev libboost-program-options-dev \
liblapack-dev libeigen3-dev libomp-dev \
python3-venv python3-yaml python3-ruamel.yaml \
git wget bc ca-certificates
- name: Select compiler
run: |
set -eu
echo "CC=gcc-${{ matrix.gcc }}" >> $GITHUB_ENV
echo "CXX=g++-${{ matrix.gcc }}" >> $GITHUB_ENV
echo "FC=gfortran-${{ matrix.gcc }}" >> $GITHUB_ENV
echo "F77=gfortran-${{ matrix.gcc }}" >> $GITHUB_ENV
echo "F90=gfortran-${{ matrix.gcc }}" >> $GITHUB_ENV
- name: Cache control NORMs
uses: actions/cache@v4
with:
path: ${{ env.NORMS_DIR }}
key: control-norms-host-gcc${{ matrix.gcc }}-${{ env.OIFS_VERSION }}-${{ github.event.pull_request.base.sha || github.sha }}-${{ env.CACHE_SUFFIX }}
- name: Set up Python venv
run: |
set -eu
python3 -m venv "${WORK_DIR}/venv"
source "${WORK_DIR}/venv/bin/activate"
python3 -m pip install --upgrade pip
python3 -m pip install gitpython pyyaml
- name: Render CI config
run: |
set -eu
mkdir -p "${WORK_DIR}"
cat > "${WORK_DIR}/ci_test_host.yml" <<EOF
openifs_version : "${OIFS_VERSION}"
openifs_repo_url : "https://github.com/${{ github.repository }}.git"
control_branch : "${CONTROL_BRANCH}"
test_branch : "${{ github.workspace }}"
compiler_version : "${{ matrix.gcc }}"
openifs_build_host_dir : "${WORK_DIR}"
ci_reports : "${REPORTS_DIR}"
control_saved_norms_dir : "${NORMS_DIR}"
clone_openifs_control : True
force_reclone : True
reuse_control_if_present : True
openifs_test_extra_flags : "--without-single-precision --cmake=BUILD_ifsbench=OFF --clean"
EOF
- name: Build & Test
id: build-test
run: |
set -eu
cd "$CI_DIR"
source "${WORK_DIR}/venv/bin/activate"
echo "::group::ci-oifs-host.py"
python3 ci-oifs-host.py -c "${WORK_DIR}/ci_test_host.yml"
echo "::endgroup::"
- name: Upload reports
if: always()
uses: actions/upload-artifact@v4
with:
name: bit-compare-host-reports-gcc${{ matrix.gcc }}
path: ${{ env.REPORTS_DIR }}/
if-no-files-found: warn