-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaction.yml
149 lines (131 loc) · 5.4 KB
/
action.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
name: 'Build preCICE'
description: 'Installs preCICE in the given prefix and adds it to the path.'
inputs:
precice-version:
required: true
default: 'develop'
description: 'The version of preCICE to use. Can be a branch or tag or SHA. Defaults to `develop`'
build-tests:
required: false
default: 'OFF'
description: 'Whether to build tests. Default is `OFF`'
install-prefix:
required: false
default: '$HOME/precice'
description: 'The installation prefix for preCICE. Default is `$HOME/precice`'
runs:
using: "composite"
steps:
- name: check for release # if the version is a release, install from prebuilt binaries
id: check
shell: bash
run: |
if [[ ${{ inputs.precice-version }} =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "release=true" >> $GITHUB_OUTPUT
else
echo "release=false" >> $GITHUB_OUTPUT
fi
- name: install common dependencies
shell: bash
run: |
CMD=$([ "$(id -u)" -ne 0 ] && echo "sudo" || echo "")
$CMD apt update
$CMD apt install -y wget git
- name: install prebuilt binaries
if: steps.check.outputs.release == 'true'
shell: bash
run: |
VERSION=${{ inputs.precice-version }}
MAJORVERSION=${VERSION:1:1}
wget https://github.com/precice/precice/releases/download/${VERSION}/libprecice${MAJORVERSION}_${VERSION#v}_$(lsb_release -cs).deb
CMD=$([ "$(id -u)" -ne 0 ] && echo "sudo" || echo "")
$CMD apt install -y ./libprecice${MAJORVERSION}_${VERSION#v}_$(lsb_release -cs).deb
rm libprecice${MAJORVERSION}_${VERSION#v}_$(lsb_release -cs).deb
- name: Get preCICE version hash
if: steps.check.outputs.release == 'false'
id: get-hash
shell: bash
run: |
echo "precice-hash=$(git ls-remote --exit-code --heads https://github.com/precice/precice.git ${{ inputs.precice-version }} | awk '{print $1}')" >> $GITHUB_OUTPUT
- name: cache preCICE
id: cache
if: steps.check.outputs.release == 'false'
uses: actions/cache@v3
with:
path: ${{ inputs.install-prefix }}
key: ${{ runner.os }}-precice-${{ steps.get-hash.outputs.precice-hash }}
restore-keys: |
${{ runner.os }}-precice-${{ steps.get-hash.outputs.precice-hash }}
- name: debug
if: steps.check.outputs.release == 'false'
shell: bash
run: |
echo "cache-hit=${{ steps.cache.outputs.cache-hit }}"
echo "precice-hash=${{ steps.get-hash.outputs.precice-hash }}"
echo "precice-version=${{ inputs.precice-version }}"
echo "install-prefix=${{ inputs.install-prefix }}"
- name: check out repository
if: steps.check.outputs.release == 'false' && steps.cache.outputs.cache-hit != 'true'
uses: actions/checkout@v3
with:
repository: precice/precice
ref: ${{ inputs.precice-version }}
path: precice
env:
GITHUB_WORKSPACE: $HOME
- name: install dependencies
if: steps.check.outputs.release == 'false'
run: |
CMD=$([ "$(id -u)" -ne 0 ] && echo "sudo" || echo "")
$CMD apt install -y build-essential cmake libeigen3-dev libxml2-dev libboost-all-dev petsc-dev python3-dev python3-numpy
shell: bash
- name: Generate build directory
if: steps.check.outputs.release == 'false' && steps.cache.outputs.cache-hit != 'true'
shell: bash
working-directory: precice
env:
GITHUB_WORKSPACE: $HOME
run: mkdir -p build
- name: Show preCICE state
if: steps.check.outputs.release == 'false' && steps.cache.outputs.cache-hit != 'true'
shell: bash
working-directory: precice
run: git log -n 1
- name: Configure
if: steps.check.outputs.release == 'false' && steps.cache.outputs.cache-hit != 'true'
shell: bash
working-directory: precice/build
env:
GITHUB_WORKSPACE: $HOME
run: |
cmake --version
cmake -DCMAKE_INSTALL_PREFIX=${{ inputs.install-prefix }} -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=${{ inputs.build-tests }} ..
- name: Compile
if: steps.check.outputs.release == 'false' && steps.cache.outputs.cache-hit != 'true'
shell: bash
working-directory: precice/build
env:
GITHUB_WORKSPACE: $HOME
run: |
make -j $(nproc)
make install
- name: Add to path
if: steps.check.outputs.release == 'false' && steps.cache.outputs.cache-hit != 'true'
shell: bash
run: |
echo "PATH=${{ inputs.install-prefix }}/bin:$PATH" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=${{ inputs.install-prefix }}/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
echo "PKG_CONFIG_PATH=${{ inputs.install-prefix }}/lib/pkgconfig:$PKG_CONFIG_PATH" >> $GITHUB_ENV
echo "CPATH=${{ inputs.install-prefix }}/include:$CPATH" >> $GITHUB_ENV
echo "CMAKE_PREFIX_PATH=${{ inputs.install-prefix }}:$CMAKE_PREFIX_PATH" >> $GITHUB_ENV
- name: More debugging
if: steps.check.outputs.release == 'false' && steps.cache.outputs.cache-hit != 'true'
shell: bash
run: |
ls -l ${{ inputs.install-prefix }}
- name: cache preCICE
if: steps.check.outputs.release == 'false' && steps.cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
with:
path: ${{ inputs.install-prefix }}
key: ${{ runner.os }}-precice-${{ steps.get-hash.outputs.precice-hash }}