remove pipx from gh build #289
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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 }} |