Repository navigation
139 lines (119 loc) · 3.57 KB
/
Copy pathrelease.yml
File metadata and controls
139 lines (119 loc) · 3.57 KB
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
name: Release
on:
push:
tags: ['v*']
permissions:
contents: read
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Check tag matches hapapp_utils.__version__
run: |
version=$(PYTHONPATH=src python -c "import hapapp_utils; print(hapapp_utils.__version__)")
if [ "v${version}" != "${GITHUB_REF_NAME}" ]; then
echo "Tag ${GITHUB_REF_NAME} does not match hapapp_utils.__version__ (${version})"
exit 1
fi
- name: Check the tagged commit is on the release branch
run: |
git fetch origin release
if ! git merge-base --is-ancestor "${GITHUB_SHA}" FETCH_HEAD; then
echo "Tag ${GITHUB_REF_NAME} points to a commit that is not on the release branch"
exit 1
fi
test:
needs: check
runs-on: ubuntu-latest
defaults:
run:
shell: bash -el {0}
steps:
- uses: actions/checkout@v4
- name: Install Python, BLAST+, MMseqs2 and Easel
uses: mamba-org/setup-micromamba@v2
with:
environment-name: hapapp-utils
create-args: >-
python=3.13
blast
mmseqs2
easel
condarc: |
channels:
- conda-forge
- bioconda
- name: Install the package
run: python -m pip install -e ".[test]"
- name: Run tests
run: python -m pytest -v
dist:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Build sdist and wheel
run: |
python -m pip install build==1.6.1 twine==7.0.0
python -m build
twine check dist/*
- name: Install wheel and check its version
run: |
python -m pip install dist/*.whl
installed=$(hapapp-utils --version)
if [ "${installed}" != "hapapp-utils ${GITHUB_REF_NAME#v}" ]; then
echo "The wheel reports '${installed}', but the tag is ${GITHUB_REF_NAME}"
exit 1
fi
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
publish-pypi:
needs: dist
if: github.repository == 'Breeding-Insight/HapApp_utils'
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/hapapp-utils
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- uses: pypa/gh-action-pypi-publish@release/v1
release:
needs: publish-pypi
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: HapApp_utils ${{ github.ref_name }}
body: |
Install from PyPI:
```bash
pip install hapapp-utils
```
`hapapp-utils` also needs BLAST+, and `build-db` needs MMseqs2. See the
[installation guide](https://hapapp.readthedocs.io/en/latest/getting-started/installation.html)
and the [changelog](https://hapapp.readthedocs.io/en/latest/development/changelog.html).
files: dist/*