-
Notifications
You must be signed in to change notification settings - Fork 58
136 lines (111 loc) · 4.64 KB
/
test_and_publish.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
name: Test and deploy code
on: [push]
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: ["3.8", "3.9", "3.10"]
defaults: # Needed for conda
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
with:
lfs: true
submodules: true
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
mamba-version: "*"
miniforge-variant: Mambaforge
channels: acellera,conda-forge,defaults
- name: Install Linux HTMD conda deps
if: matrix.os == 'ubuntu-latest'
run: |
mamba install --file package/htmd-deps/DEPENDENCIES python=${{ matrix.python-version }} -y
- name: Install MacOS HTMD conda deps
if: matrix.os == 'macos-latest'
run: |
mamba install --file package/htmd-deps/DEPENDENCIES_MAC python=${{ matrix.python-version }} -y
- name: Install Windows HTMD conda deps
if: matrix.os == 'windows-latest'
run: |
mamba install --file package/htmd-deps/DEPENDENCIES_WIN python=${{ matrix.python-version }} -y
- name: Install pip dependencies
run: |
pip install flake8 pytest
pip install .
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test
run: |
export HTMD_NONINTERACTIVE=1
pytest --verbose --durations=10 ./htmd/
deploy:
if: startsWith(github.event.ref, 'refs/tags/')
needs: test
runs-on: ${{ matrix.os }}
defaults: # Needed for conda
run:
shell: bash -l {0}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: ["3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v4
- name: Set version envvar
run: echo "BUILD_VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
- name: Check version envvar
run: echo "Building version $BUILD_VERSION"
- uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: writedeps
auto-update-conda: true
python-version: ${{ matrix.python-version }}
mamba-version: "*"
miniforge-variant: Mambaforge
channels: acellera,conda-forge,defaults
- name: Dump exact Linux dependencies yaml file
if: matrix.os == 'ubuntu-latest'
run: |
mamba install --file package/htmd-deps/DEPENDENCIES python=${{ matrix.python-version }} -y
python package/htmd-deps/write_meta_yaml.py package/htmd-deps
- name: Dump exact MacOS dependencies yaml file
if: matrix.os == 'macos-latest'
run: |
mamba install --file package/htmd-deps/DEPENDENCIES_MAC python=${{ matrix.python-version }} -y
python package/htmd-deps/write_meta_yaml.py package/htmd-deps
- name: Dump exact Windows dependencies yaml file
if: matrix.os == 'windows-latest'
run: |
mamba install --file package/htmd-deps/DEPENDENCIES_WIN python=${{ matrix.python-version }} -y
python package/htmd-deps/write_meta_yaml.py package/htmd-deps
- uses: conda-incubator/setup-miniconda@v3
with:
auto-activate-base: true
activate-environment: build
python-version: ${{ matrix.python-version }}
mamba-version: "*"
miniforge-variant: Mambaforge
- name: Build htmd-deps conda package
run: |
echo "Building version $BUILD_VERSION"
mamba install anaconda-client conda-build python=${{ matrix.python-version }} boa
conda mambabuild --python ${{ matrix.python-version }} package/htmd-deps --output-folder ./pkg/ --no-include-recipe --no-anaconda-upload -c acellera -c conda-forge
- name: Build htmd conda package
run: |
echo "Building version $BUILD_VERSION"
conda mambabuild --python ${{ matrix.python-version }} package/htmd --output-folder ./pkg/ --no-include-recipe --no-anaconda-upload -c acellera -c conda-forge
- name: Upload to conda
run: |
anaconda -t ${{ secrets.ANACONDA_TOKEN_BASIC }} upload -u acellera ./pkg/*/htmd-*.tar.bz2