-
Notifications
You must be signed in to change notification settings - Fork 33
139 lines (119 loc) · 5.19 KB
/
build.yml
File metadata and controls
139 lines (119 loc) · 5.19 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
# Release workflow:
# 1. merge dev into main
# 2. git tag v<new-version> (on main)
# 3. git push origin main --tags
# CI + PyPI publish triggered by v* tag pushes. Only publishes sdist (no wheels,
# since compiled C++ components need to be built from source on the target system).
# PyPI publish requires the tag to be on main.
name: Build and Test
on:
push:
tags:
- 'v*'
jobs:
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Checkout tags
run: git fetch --unshallow origin +refs/tags/*:refs/tags/*
- name: Set docker tag variable
run: |
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
else
echo "TAG=latest" >> $GITHUB_ENV
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']
fail-fast: false
env:
TERM: xterm
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Checkout ham submodule
run: |
git submodule update --init packages/ham
- name: Checkout ig-sw submodule
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 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
run: |
python -m pip install --upgrade pip
python -m pip install -e . -v
- 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.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: Verify tag is on main
if: matrix.os == 'ubuntu-latest' && startsWith(github.ref, 'refs/tags/v')
run: |
if ! git branch -r --contains HEAD | grep -q 'origin/main'; then
echo "ERROR: tag is not on main branch, skipping PyPI publish"
exit 1
fi
- name: Build and publish to PyPI
if: matrix.os == 'ubuntu-latest' && startsWith(github.ref, 'refs/tags/v')
run: |
python -m pip install build twine
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/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}