-
Notifications
You must be signed in to change notification settings - Fork 1
136 lines (127 loc) · 4.43 KB
/
main.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: Python Test and Package
on:
push:
branches:
- main
tags:
- "v*"
pull_request:
branches:
- main
env:
HEDWIG_ENV: dev
jobs:
docs:
runs-on: ubuntu-latest
name: Docs
needs: test
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install -r docs/requirements.txt
- name: Build Sphinx Documentation
run: |
make -C docs html
- name: Upload documentation
if: github.event_name == 'push'
uses: actions/upload-artifact@v1
with:
name: sphinx-docs
path: docs/_build/html
- name: Update gh-pages
if: github.ref == 'refs/heads/main'
run: |
rm docs/_build/html/.buildinfo
touch docs/_build/html/.nojekyll
git update-ref refs/heads/${TARGET_BRANCH} origin/${TARGET_BRANCH}
./.github/workflows/update-gh-pages.sh docs/_build/html
repo_uri="https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
git push $repo_uri ${TARGET_BRANCH}
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
TARGET_BRANCH: "gh-pages"
test:
runs-on: ubuntu-latest
name: Check coverage
permissions:
# Gives the action the necessary permissions for publishing new
# comments in pull requests.
pull-requests: write
# Gives the action the necessary permissions for pushing data to the
# python-coverage-comment-action branch, and for editing existing
# comments (to avoid publishing multiple comments in the same PR)
contents: write
strategy:
matrix:
python-version: ["3.8"]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'
- uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Create LFS file list
run: |
git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id
- name: Restore LFS cache
uses: actions/cache@v2
id: lfs-cache
with:
path: .git/lfs
key: lfs-v1-${{ hashFiles('.lfs-assets-id') }}
restore-keys: lfs-v1-
- name: Git LFS Pull
run: |
git lfs pull
- name: Install dependencies
run: |
sudo apt -y update && sudo apt -y install libgl-dev graphicsmagick libblosc1
IMOD=imod_4.11.24_RHEL7-64_CUDA10.1.sh
export IMOD_DIR=/usr/local/IMOD
export PATH=$IMOD_DIR/bin:$PATH
wget https://bio3d.colorado.edu/imod/AMD64-RHEL5/${IMOD} && sudo sh ${IMOD} -yes && rm -f ${IMOD}
BIO2R_V=0.7.0
BIO2R_Z=bioformats2raw-${BIO2R_V}.zip
export BIO2R_DIR=/usr/local/BIO2R
export PATH=$BIO2R_DIR/bioformats2raw-${BIO2R_V}/bin:$PATH
wget https://github.com/glencoesoftware/bioformats2raw/releases/download/v${BIO2R_V}/${BIO2R_Z} && sudo unzip ${BIO2R_Z} -d ${BIO2R_DIR} && rm -f ${BIO2R_Z}
python -m pip install --upgrade pip
pip install -e . -r requirements.txt
- name: Directory setup
run: |
cp .env.sample .env
- name: Test Coverage
continue-on-error: true
run: |
BIO2R_V=0.7.0
export BIO2R_DIR=/usr/local/BIO2R/bioformats2raw-${BIO2R_V}
export IMOD_DIR=/usr/local/IMOD
export PATH=$BIO2R_DIR/bin:$IMOD_DIR/bin:$PATH
python -m pytest -v --log-cli-level=INFO -m "not (slow or localdata)" --cov-report term --cov=.
- name: Coverage Badge
uses: tj-actions/coverage-badge-py@v2
- name: Coverage comment
id: coverage_comment
uses: py-cov-action/python-coverage-comment-action@v3
with:
GITHUB_TOKEN: ${{ github.token }}
- name: Store Pull Request comment to be posted
uses: actions/upload-artifact@v3
if: steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true'
with:
# If you use a different name, update COMMENT_ARTIFACT_NAME accordingly
name: python-coverage-comment-action
# If you use a different name, update COMMENT_FILENAME accordingly
path: python-coverage-comment-action.txt