-
Notifications
You must be signed in to change notification settings - Fork 33
140 lines (121 loc) · 5.58 KB
/
build.yml
File metadata and controls
140 lines (121 loc) · 5.58 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
140
name: Build and Test
on:
push:
branches: [ main, dev ]
pull_request:
branches: [ main, dev ]
jobs:
docker:
runs-on: ubuntu-latest
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
steps:
- uses: actions/checkout@v3
- name: Checkout tags
run: git fetch --unshallow origin +refs/tags/*:refs/tags/*
- name: Set git branch variable
run: echo ::set-env name=BRANCH::$(git branch --show-current)
- name: Set git tag variable
run: if [ $BRANCH == "main" ];then echo ::set-env name=TAG::$(git describe --tags);else echo ::set-env name=TAG::$BRANCH;fi
- name: Checkout submodules
shell: bash
run: |
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
- name: Build the Docker image
run: docker build . -t quay.io/matsengrp/partis:$TAG
# - name: Run tests in the Docker image # eh, would need to install simulation stuff to do this, and not worth it at the moment (the quick test is run at the end of the docker build above)
# run: docker run quay.io/matsengrp/partis:$TAG /bin/bash -c "/partis/test/test.py --run-all"
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-15-intel] # this is the last intel build, will be deprecated dec 2027, and atm we can't run on non-intel macs: https://github.com/psathyrella/partis/issues/330
python-version: ['3.12']
install-method: ['pip', 'pipx']
fail-fast: false
env:
TERM: xterm
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Checkout ham submodule
if: matrix.install-method == 'pip'
run: |
git submodule update --init packages/ham
- name: Checkout ig-sw submodule
if: matrix.install-method == 'pip'
run: |
git submodule update --init packages/ig-sw
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install system dependencies (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt update
sudo apt install -y python3 python3-pip python-is-python3 pipx build-essential cmake libgsl-dev libyaml-cpp-dev scons mafft ncurses-base ncurses-bin r-base
# sudo apt install libbpp-core libbpp-seq # which packages do i actually have to write here?
- name: Install system dependencies (macOS)
if: startsWith(matrix.os, 'macos')
run: |
brew install gsl yaml-cpp scons mafft r
# brew tap jydu/homebrew-biopp
# brew install libbpp-core bppsuite # which packages do i actually have to write here?
brew install --cask font-lato
# - name: Set Homebrew paths for ARM64 Mac # not used atm, but we'll want these if we manage to fix the emmintrin.h/SSE2 issue, so leaving in
# if: matrix.os == 'macos-14'
# run: |
# echo "CPPFLAGS=-I/opt/homebrew/include" >> $GITHUB_ENV
# echo "LDFLAGS=-L/opt/homebrew/lib" >> $GITHUB_ENV
# - name: Install R tree generation packages # could turn this back on, but it's really slow and not super important (and is unnecessary with --no-tree-gen arg below), although note we're still installing R above
# run: |
# R --slave -e 'dir.create(c(Sys.getenv("R_LIBS_USER")), recursive=TRUE); install.packages(c("TreeSim", "TreeSimGM", "geiger", "MASS"), repos="http://cran.rstudio.com/", dependencies=TRUE, lib=c(Sys.getenv("R_LIBS_USER")))'
- name: Install with pip
if: matrix.install-method == 'pip'
run: |
python -m pip install --upgrade pip
python -m pip install -e . -v
- name: Install with pipx
if: matrix.install-method == 'pipx'
run: |
pipx install partis-bcr
- name: Test partis help
run: |
partis --help
- name: Test scripts work
run: |
split-loci.py --help
- name: Run quick test
run: |
partis-test.py --quick
- name: Run full test
run: |
# if [[ "${{ matrix.install-method }}" == "pipx" || "${{ matrix.os }}" == macos* ]]; then
if [[ "${{ matrix.os }}" == macos* ]]; then
partis-test.py --no-simu
partis-test.py --paired --no-simu
else
partis-test.py --no-per-base-mutation --no-tree-gen
partis-test.py --paired --no-per-base-mutation --no-tree-gen
fi
- name: Build and publish to PyPI
if: matrix.install-method == 'pip' && github.event_name == 'push' # && github.ref == 'refs/heads/main' # && matrix.os == 'ubuntu-latest'
run: |
python -m pip install build twine
if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
python setup.py bdist_wheel --plat-name manylinux1_x86_64
python -m build --sdist 2>&1 | grep -v 'adding .test/\|adding .data/\|creating partis_bcr.*/test/\|copying docs/\|copying data/\|copying packages/\|copying python/.*/test/\|copying build/.*/test/'
python -m twine check dist/*
python -m twine upload dist/*
else
python -m build --wheel 2>&1 | grep -v 'adding .test/\|adding .data/\|creating partis_bcr.*/test/\|copying docs/\|copying data/\|copying packages/\|copying python/.*/test/\|copying build/.*/test/'
python -m twine check dist/*.whl
python -m twine upload dist/*.whl
fi
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}