-
Notifications
You must be signed in to change notification settings - Fork 1
168 lines (164 loc) · 6.49 KB
/
testing.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
163
164
165
166
167
168
name: testing scenarios
# Controls when the action will run.
on:
# run on push
push:
# schedule test for nightly build
schedule:
- cron: "22 0 * * *"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Note: the defaults are repeated within the env section
# of some of the jobs so any change to the default
# need to be done twice!
inputs:
logLevel:
description: 'Log level'
required: true
default: 'Warning'
branch:
# note: this should be either 'master' or a tag of the form
# vN where 'N' is a legal python package version
# e.g. N=2.9.0rc1
# otherwise the distributions will not be generated
# and the build will fail
description: 'core modules tag e.g. (master | v2.9.0) [master]'
required: true
default: 'master'
fembranch:
# note: this should be either 'master' or a tag of the form
# vN where 'N' is a legal python package version
# e.g. N=2.9.0rc1
# otherwise the distributions will not be generated
# and the build will fail
description: 'dune-fem modules tag e.g. (master | v2.9.0.1) [master]'
required: true
default: 'master'
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# generate test file matrix
getTests:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.setmatrix.outputs.matrix }}
steps:
- name: printParameters
run: |
echo "Workflow parameters"
echo "Using github branch : ${GITHUB_REF#refs/heads/}"
echo "Using log level : ${{ github.event.inputs.logLevel }}"
echo "Using dune-core branch: ${{ github.event.inputs.branch }}"
echo "Using dune-fem branch: ${{ github.event.inputs.fembranch }}"
- name: checkout source code
uses: actions/checkout@v1
- id: setmatrix
run: |
matrixArray=$(find ./testing -name '*.sh') # Creates array of all files .sh withing testing
# Start Generate Json String
echo "$matrixArray" | \
jq --slurp --raw-input 'split("\n")[:-1]' | \
jq "{\"filepath\": .[], \"os\":\"ubuntu-latest\" }, {\"filepath\": .[], \"os\": \"macOS-latest\" }" | \
jq -sc "{ \"include\": . }" > tmp
cat ./tmp
# End Generate Json String
matrixStringifiedObject=$(cat ./tmp) # Use this as jq @sh not working right
# echo "::set-output name=matrix::$matrixStringifiedObject"
# this is the new version to fix deprecated set-output
echo "matrix=$matrixStringifiedObject" >> $GITHUB_OUTPUT
# build packages
build:
name: build
runs-on: [ubuntu-latest]
env:
BRANCH: master
FEMBRANCH: master
steps:
- name: environmentCore
if: github.event.inputs.branch != ''
run: echo "BRANCH=${{ github.event.inputs.branch }}" >> $GITHUB_ENV
- name: environmentFem
if: github.event.inputs.fembranch != ''
run: echo "FEMBRANCH=${{ github.event.inputs.fembranch }}" >> $GITHUB_ENV
- name: starting
uses: actions/checkout@v3
- name: clone dune branch ${{ env.BRANCH }} and build python packages
run: |
pip install scikit-build
./clone-modules $BRANCH $FEMBRANCH "none"
- name: upload artifacts
uses: actions/upload-artifact@v3
with:
name: packages
path: dist/
# test packages
test:
name: testing tutorial
needs: [ build, getTests ]
env:
LOGLEVEL: Warning
BRANCH: master
FEMBRANCH: master
strategy:
fail-fast: false
# Note:
# 1) macOS does not install petsc4py
matrix: ${{fromJson(needs.getTests.outputs.matrix)}}
runs-on: ${{ matrix.os }}
steps:
- name: starting
uses: actions/checkout@v3
- name: environment
if: github.event.inputs.logLevel != ''
run: echo "LOGLEVEL=${{ github.event.inputs.logLevel }}" >> $GITHUB_ENV
- name: environmentCore
if: github.event.inputs.branch != ''
run: echo "BRANCH=${{ github.event.inputs.branch }}" >> $GITHUB_ENV
- name: environmentFem
if: github.event.inputs.fembranch != ''
run: echo "FEMBRANCH=${{ github.event.inputs.fembranch }}" >> $GITHUB_ENV
- name: Install dependencies
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
# note: using 'apt-get -o Acquire::Retries=3' to dance around connectivity issues to Azure,
# use apt-spy2 to select closest apt mirror,
# which helps avoid connectivity issues in Azure;
# see https://github.com/actions/virtual-environments/issues/675
# APT-SPY2 fails also
# sudo gem install apt-spy2
# sudo apt-spy2 check
# sudo apt-spy2 fix --commit
# after selecting a specific mirror, we need to run 'apt-get update'
sudo apt-get update -o Acquire::Retries=3
sudo apt-get install libopenmpi-dev openmpi-bin libsuperlu-dev libsuitesparse-dev petsc-dev paraview python3-paraview gmsh libboost-all-dev python3-numpy python3-matplotlib python3-scipy python3-mpi4py python3-ufl
elif [ "$RUNNER_OS" == "macOS" ]; then
# fixes an issue with homebrew can probably be remove once the issue is resolved
# https://github.com/orgs/Homebrew/discussions/4612#discussioncomment-6356325
export HOMEBREW_NO_INSTALL_FROM_API=
brew config
brew untap homebrew/core homebrew/cask
brew config
# normal service resumes...
brew update
brew install [email protected] || true
brew install [email protected] || true
brew install openmpi superlu suite-sparse gmsh boost pkg-config || true
fi
shell: bash
- name: download artifacts
uses: actions/download-artifact@v3
# if all packages exist on pypi then no artifacts are uploaded so don't fail
continue-on-error: true
with:
name: packages
path: dist
- name: Run test
run: |
export DUNEPY_DISABLE_PLOTTING=1
export DUNE_LOG_LEVEL=$LOGLEVEL
echo "Running: ${{ matrix.filepath }}"
ls -R
tar xzf dist/repos.tar.gz
mkdir test
cd test
bash -e ../${{ matrix.filepath }} $BRANCH $FEMBRANCH $RUNNER_OS
shell: bash