-
Notifications
You must be signed in to change notification settings - Fork 14
210 lines (204 loc) · 8.35 KB
/
ci-install.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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
# Lingfei Wang, 2022, 2023. All rights reserved.
name: Installation script test
on:
schedule:
- cron: '20 7 * * 1'
push:
paths:
- '.github/workflows/ci-install.yml'
- '.github/actions/install-bash/**'
- README.rst
branches:
- master
- dev
workflow_dispatch:
inputs:
ref:
description: 'Commit or branch to run action on'
required: true
default: 'dev'
jobs:
install-script-bash:
runs-on: ubuntu-latest
outputs:
run: ${{ steps.runscript.outputs.run }}
steps:
- name: Show version
id: version
run: |
if [ "a${{ inputs.ref }}" != "a" ]; then
v="${{ inputs.ref }}"
elif [ "a${GITHUB_REF}" != "a" ]; then
v="${GITHUB_REF}"
elif [ "a${{ github.event.repository.default_branch }}" != "a" ]; then
v="${{ github.event.repository.default_branch }}"
else
exit 1
fi
echo "$v"
echo "version=$v" >> $GITHUB_OUTPUT
- uses: actions/checkout@v4
with:
ref: ${{ steps.version.outputs.version }}
- name: Set up Python 3.8
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Obtain install script
id: runscript
run: |
# Install command in README.rst (indented in Installation section)
# Get first code-block in section Installation
linestart=$(grep -n '^Installation' README.rst | awk -F: '{print $1}' | head -n 1)
lineend=$(tail -n +$(( linestart + 2 )) README.rst | grep -n '^==' | awk -F: '{print $1}' | head -n 1)
linestart2=$(tail -n +$linestart README.rst | head -n $lineend | grep -n '^Option [0-9]: with .*bash script' | awk -F: '{print $1}' | head -n 1)
echo "Step 1"
tail -n +$linestart README.rst | head -n $lineend
linestart=$(( linestart + linestart2 ))
lineend=$(tail -n +$(( linestart + 2 )) README.rst | head -n $lineend | grep -n '^--' | awk -F: '{print $1}' | head -n 1)
echo "Step 2"
tail -n +$(( linestart + 2 )) README.rst | head -n $lineend
linestart2=$(tail -n +$linestart README.rst | head -n $lineend | grep -n '^.. code-block::' | awk -F: '{print $1}' | head -n 1)
echo "Step 3"
tail -n +$linestart README.rst | head -n $lineend
lineend2=$(tail -n +$linestart README.rst | head -n $lineend | tail -n +$(( linestart2 + 1 )) | grep -n '^.. code-block::' | awk -F: '{print $1}' | head -n 1)
echo "Step 4"
tail -n +$linestart README.rst | head -n $lineend
echo "Step 5"
tail -n +$linestart README.rst | head -n $lineend | tail -n +$(( linestart2 + 1 ))
s1="$(tail -n +$linestart README.rst | head -n $lineend | tail -n +$linestart2 | head -n $lineend2 | grep '^[[:blank:]]' | sed 's/^[[:space:]]*//g')"
echo "Step 6"
tail -n +$linestart README.rst | head -n $lineend
echo "Step 7"
tail -n +$linestart README.rst | head -n $lineend | tail -n +$linestart2 | head -n $lineend2
echo "Step 8"
echo "$s1"
#If failed here: update this line and the same line in /.github/actions/install-bash/action.yml to match the lines in /README.rst
cmp <(echo "$s1") <(echo "wget https://tinyurl.com/dictys -O - | bash") || exit 1
echo "run=$s1" >> $GITHUB_OUTPUT
install-linux-bash:
runs-on: ubuntu-latest
needs: install-script-bash
steps:
- name: Set up Python 3.8
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Add conda to system path
run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
echo $CONDA/bin >> $GITHUB_PATH
- name: Test install
run: |
echo '::group::Test install output'
${{ needs.install-script-bash.outputs.run }}
echo '::endgroup::'
install-script-conda:
runs-on: ubuntu-latest
outputs:
run: ${{ steps.runscript.outputs.run }}
steps:
- name: Show version
id: version
run: |
if [ "a${{ inputs.ref }}" != "a" ]; then
v="${{ inputs.ref }}"
elif [ "a${GITHUB_REF}" != "a" ]; then
v="${GITHUB_REF}"
elif [ "a${{ github.event.repository.default_branch }}" != "a" ]; then
v="${{ github.event.repository.default_branch }}"
else
exit 1
fi
echo "$v"
echo "version=$v" >> $GITHUB_OUTPUT
- uses: actions/checkout@v4
with:
ref: ${{ steps.version.outputs.version }}
- name: Set up Python 3.8
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Obtain install script
id: run0
run: |
# Install command in README.rst (indented in Installation section)
# Get first code-block in section Installation
linestart=$(grep -n '^Installation' README.rst | awk -F: '{print $1}' | head -n 1)
lineend=$(tail -n +$(( linestart + 2 )) README.rst | grep -n '^==' | awk -F: '{print $1}' | head -n 1)
echo "Step 1"
tail -n +$linestart README.rst | head -n $lineend
linestart2=$(tail -n +$linestart README.rst | head -n $lineend | grep -n '^Option [0-9]: with .*conda$' | awk -F: '{print $1}' | head -n 1)
linestart=$(( linestart + linestart2 ))
echo "Step 2"
tail -n +$(( linestart + 2 )) README.rst | head -n $lineend
lineend=$(tail -n +$(( linestart + 2 )) README.rst | head -n $lineend | grep -n '^--' | awk -F: '{print $1}' | head -n 1)
linestart2=$(tail -n +$linestart README.rst | head -n $lineend | grep -n '^.. code-block::' | awk -F: '{print $1}' | head -n 1)
echo "Step 3"
tail -n +$linestart README.rst | head -n $lineend | tail -n +$(( linestart2 + 1 ))
lineend2=$(tail -n +$linestart README.rst | head -n $lineend | tail -n +$(( linestart2 + 1 )) | grep -n '^.. code-block::' | awk -F: '{print $1}' | head -n 1)
echo "Step 4"
echo "$linestart"
echo "$lineend"
tail -n +$linestart README.rst | head -n $lineend
echo "Step 5"
echo "$linestart2"
echo "$lineend2"
tail -n +$linestart README.rst | head -n $lineend | tail -n +$linestart2 | head -n $lineend2
s1="$(tail -n +$linestart README.rst | head -n $lineend | tail -n +$linestart2 | head -n $lineend2 | grep '^[[:blank:]]' | sed 's/^[[:space:]]*//g')"
#If failed here: update this line and the same line in /.github/actions/install-conda/action.yml to match the lines in /README.rst
cmp <(echo "$s1") <(echo "conda create -y -n dictys -c conda-forge python=3.9 mamba"; echo ". activate dictys"; echo "mamba install -y -c lingfeiwang -c bioconda -c conda-forge -c pytorch dictys pytorch torchvision torchaudio cpuonly") || exit 1
echo "run<<EOF" >> $GITHUB_ENV
echo "$s1" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- id: runscript
uses: actions/github-script@v7
with:
script: |
core.setOutput("run", `${{ env.run }}`);
install-linux-conda:
runs-on: ubuntu-latest
needs: install-script-conda
steps:
- name: Set up Python 3.8
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Add conda to system path
run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
echo $CONDA/bin >> $GITHUB_PATH
- name: Test install
run: |
echo '::group::Test install output'
${{ needs.install-script-conda.outputs.run }}
echo '::endgroup::'
install-linux:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9","3.10",""]
cuda-version: ["11.7",""]
steps:
- name: Show version
id: version
run: |
if [ "a${{ inputs.ref }}" != "a" ]; then
v="${{ inputs.ref }}"
elif [ "a${GITHUB_REF}" != "a" ]; then
v="${GITHUB_REF}"
elif [ "a${{ github.event.repository.default_branch }}" != "a" ]; then
v="${{ github.event.repository.default_branch }}"
else
exit 1
fi
echo "$v"
echo "version=$v" >> $GITHUB_OUTPUT
- uses: actions/checkout@v4
with:
ref: ${{ steps.version.outputs.version }}
- name: Install
uses: ./.github/actions/install-bash
with:
python-version: ${{ matrix.python-version }}
cuda-version: ${{ matrix.cuda-version }}