Support a coordinate-to-accession map to a graph, mapping an annotation label+coordinate to an accession #4953
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
name: MetaGraph CI | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- 'v*' | |
pull_request: | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
Linux: | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
alphabet: [DNA, Protein] | |
build_type: [Debug, Release] | |
compiler: [g++-11, g++-12, g++-13] | |
build_static: [OFF, ON] | |
with_avx: [OFF, ON] | |
include: | |
- compiler: g++-11 | |
cxx: g++-11 | |
cc: gcc-11 | |
- compiler: g++-12 | |
cxx: g++-12 | |
cc: gcc-12 | |
- compiler: g++-13 | |
cxx: g++-13 | |
cc: gcc-13 | |
exclude: | |
- alphabet: Protein | |
compiler: g++-11 | |
- alphabet: Protein | |
compiler: g++-12 | |
- compiler: g++-11 | |
build_static: ON | |
- compiler: g++-12 | |
build_static: ON | |
- build_type: Debug | |
build_static: ON | |
- build_type: Debug | |
compiler: g++-11 | |
- build_type: Debug | |
compiler: g++-12 | |
- with_avx: OFF | |
build_static: OFF | |
name: Linux (${{ matrix.alphabet }}, ${{ matrix.build_type }}, ${{ matrix.compiler }}${{ matrix.build_static == 'ON' && ', static' || '' }}${{ matrix.with_avx == 'OFF' && ', noAVX' || '' }}) | |
steps: | |
- uses: actions/checkout@v1 | |
- name: checkout submodules | |
run: git submodule update --init --recursive | |
- name: install dependencies | |
run: | | |
sudo apt-get update | |
# If clang, use the default version. Otherwise the compiler install with apt-get. | |
if [[ "${{ matrix.compiler }}" != "clang" ]]; then | |
sudo apt-get install -y ${{ matrix.compiler }} | |
fi | |
sudo apt-get install -y cmake make libbz2-dev libjemalloc-dev libboost-all-dev libdeflate-dev libzstd-dev | |
if [ "${{ matrix.build_static }}" = "ON" ]; then | |
sudo apt-get install -y libcurl4-openssl-dev | |
fi | |
echo "CC=$(which ${{ matrix.cc }})" >> $GITHUB_ENV | |
echo "CXX=$(which ${{ matrix.cxx }})" >> $GITHUB_ENV | |
- name: install dependencies for integration tests | |
run: | | |
pip3 install parameterized | |
sudo apt-get install python3-venv | |
- name: install sdsl-lite | |
run: | | |
cd metagraph/external-libraries/sdsl-lite | |
./install.sh $(pwd) | |
- name: configure | |
run: | | |
mkdir metagraph/build | |
cd metagraph/build | |
cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ | |
-DBUILD_STATIC=${{ matrix.build_static }} \ | |
-DWITH_AVX=${{ matrix.with_avx }} -DWITH_MSSE42=${{ matrix.with_avx }} \ | |
-DCMAKE_DBG_ALPHABET=${{ matrix.alphabet }} .. | |
- name: build metagraph | |
run: cd metagraph/build && make -j"$(getconf _NPROCESSORS_ONLN)" metagraph | |
- name: build unit tests | |
if: matrix.build_static == 'OFF' | |
run: cd metagraph/build && make -j"$(getconf _NPROCESSORS_ONLN)" unit_tests | |
- name: build other | |
if: matrix.build_static == 'OFF' | |
run: cd metagraph/build && make -j"$(getconf _NPROCESSORS_ONLN)" | |
# for potential release | |
- name: rename binary | |
if: matrix.with_avx == 'OFF' | |
run: mv metagraph/build/metagraph_${{ matrix.alphabet }} metagraph/build/metagraph_${{ matrix.alphabet }}_noAVX | |
- name: upload static binary | |
if: ${{ matrix.build_static == 'ON' && matrix.compiler == 'g++-13' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: metagraph_${{ matrix.alphabet }}${{ matrix.with_avx == 'OFF' && '_noAVX' || '' }}_linux_x86 | |
path: metagraph/build/metagraph_${{ matrix.alphabet }}${{ matrix.with_avx == 'OFF' && '_noAVX' || '' }} | |
- name: run unit tests | |
if: matrix.build_static == 'OFF' | |
run: | | |
export LD_LIBRARY_PATH="/usr/local/lib/:$LD_LIBRARY_PATH" | |
cd metagraph/build && ./unit_tests | |
- name: run integration tests | |
uses: nick-fields/retry@v2 | |
with: | |
timeout_minutes: 1000 | |
max_attempts: 5 | |
retry_on: error | |
command: | | |
export LD_LIBRARY_PATH="/usr/local/lib/:$LD_LIBRARY_PATH" | |
cd metagraph/build && make integration_tests | |
MacOS: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
# Apple Silicon Release | |
- alphabet: DNA | |
build_type: Release | |
platform: macos-latest | |
target_arch: arm64 | |
# Intel Release | |
- alphabet: DNA | |
build_type: Release | |
platform: macos-15-intel | |
target_arch: x86_64 | |
# Apple Silicon runner + Rosetta for x86_64 | |
- alphabet: DNA | |
build_type: Release | |
platform: macos-latest | |
target_arch: x86_64 | |
# Debug run on Apple Silicon | |
- alphabet: DNA | |
build_type: Debug | |
platform: macos-latest | |
target_arch: arm64 | |
runs-on: ${{ matrix.platform }} | |
defaults: | |
run: | |
shell: arch -${{ matrix.target_arch }} /bin/bash -eo pipefail {0} | |
steps: | |
- uses: actions/checkout@v1 | |
- name: checkout submodules | |
run: git submodule update --init --recursive | |
- name: (Only for arm64 -> x86_64) Install Rosetta Homebrew in /usr/local | |
if: ${{ matrix.platform == 'macos-latest' && matrix.target_arch == 'x86_64' }} | |
run: | | |
# Install Intel Homebrew into /usr/local if missing | |
if [[ ! -d /usr/local/Homebrew ]]; then | |
echo "Installing Intel Homebrew to /usr/local under Rosetta..." | |
arch -x86_64 /bin/bash -lc '/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"' | |
fi | |
# Replace any legacy wrapper that points to /usr/local/Library/Homebrew | |
if [[ -f /usr/local/bin/brew ]] && grep -q '/usr/local/Library/Homebrew' /usr/local/bin/brew; then | |
echo "Replacing legacy brew wrapper..." | |
sudo rm -f /usr/local/bin/brew | |
fi | |
# Ensure wrapper points to the modern repo location | |
if [[ ! -f /usr/local/bin/brew ]]; then | |
sudo ln -s /usr/local/Homebrew/bin/brew /usr/local/bin/brew | |
fi | |
echo "/usr/local/bin" >> "$GITHUB_PATH" | |
echo "/usr/local/sbin" >> "$GITHUB_PATH" | |
- name: install dependencies | |
run: brew install bzip2 libomp boost jemalloc autoconf automake libdeflate icu4c zstd | |
- name: install dependencies for integration tests | |
run: pip3 install parameterized --break-system-packages --user | |
- name: install sdsl-lite | |
run: | | |
cd metagraph/external-libraries/sdsl-lite | |
./install.sh $(pwd) | |
- name: configure | |
run: | | |
mkdir metagraph/build | |
cd metagraph/build | |
cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ | |
-DCMAKE_DBG_ALPHABET=${{ matrix.alphabet }} \ | |
.. | |
- name: build metagraph | |
run: cd metagraph/build && make -j"$(getconf _NPROCESSORS_ONLN)" metagraph | |
- name: build unit tests | |
run: cd metagraph/build && make -j"$(getconf _NPROCESSORS_ONLN)" unit_tests | |
- name: build other | |
run: cd metagraph/build && make -j"$(getconf _NPROCESSORS_ONLN)" | |
- name: run unit tests | |
run: cd metagraph/build && ./unit_tests | |
- name: run integration tests | |
run: cd metagraph/build && make integration_tests | |
Metagraph-Workflows: | |
name: Test metagraph workflows | |
runs-on: ubuntu-22.04 | |
needs: [Linux] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python 3.10.18 | |
uses: actions/setup-python@v1 | |
with: | |
python-version: 3.10.18 | |
- name: fetch static binary | |
uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
- name: setup metagraph binary | |
run: | | |
sudo ln -s $(pwd)/artifacts/metagraph_DNA_linux_x86/metagraph_DNA /usr/local/bin/metagraph | |
sudo chmod +rx /usr/local/bin/metagraph | |
/usr/local/bin/metagraph --help | |
metagraph --help | |
- name: Install python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pytest | |
pip install -r metagraph/workflows/requirements.txt | |
- name: Test metagraph-workflows pytest | |
run: | | |
cd metagraph/workflows | |
pytest | |
Build-and-Push-Docker: | |
# adapted from https://docs.github.com/en/actions/guides/publishing-docker-images#publishing-images-to-github-packages | |
needs: [Linux, Metagraph-Workflows] | |
runs-on: ubuntu-22.04 | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: checkout submodules | |
run: git submodule update --init --recursive | |
- name: Log in to the Container registry | |
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v3 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
- name: Build Docker image | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
push: false | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Build and push Docker image | |
if: github.event_name != 'pull_request' | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
Release: | |
name: Create Release | |
if: startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-22.04 | |
needs: [Linux, Metagraph-Workflows] | |
steps: | |
- uses: actions/checkout@v1 | |
- name: checkout submodules | |
run: git submodule update --init --recursive | |
- name: fetch static binary | |
uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
- name: Tag name | |
id: tag_name | |
run: | | |
echo ::set-output name=TAG::${GITHUB_REF#refs/tags/} | |
echo ::set-output name=VER::${GITHUB_REF#refs/tags/v} | |
# from https://stackoverflow.com/a/61919791/6869319 | |
- name: read current version | |
id: read_version | |
run: | | |
content=`cat package.json` | |
# the following lines are only required for multi line json | |
content="${content//'%'/'%25'}" | |
content="${content//$'\n'/'%0A'}" | |
content="${content//$'\r'/'%0D'}" | |
# end of optional handling for multi line json | |
echo "::set-output name=packageJson::$content" | |
- name: build source archive including submodules | |
run: | | |
[[ v${{fromJson(steps.read_version.outputs.packageJson).version}} == ${{ steps.tag_name.outputs.TAG }} ]] \ | |
|| (echo "::error file=package.json::Version in package.json (v${{fromJson(steps.read_version.outputs.packageJson).version}}) does not match tag ${{ steps.tag_name.outputs.TAG }}. Update package.json and set the tag again."; \ | |
exit 1) | |
mkdir -p artifacts/sources | |
tag=${{ steps.tag_name.outputs.TAG }} | |
bash .github/workflows/git-archive-all.sh --format tar.gz artifacts/sources/${tag}-sources-with-submodules.tar.gz | |
bash .github/workflows/git-archive-all.sh --format zip artifacts/sources/${tag}-sources-with-submodules.zip | |
- name: create release with static binaries | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
release_name: Version ${{ steps.tag_name.outputs.VER }} | |
body: | | |
The pre-compiled binaries (only for Linux) are statically linked and hence don't require additional libraries to be installed. | |
The *_noAVX binaries are compiled without the modern AVX2 and MSSE4.2 instructions and should be used when the processor does not support these instructions. | |
file: 'artifacts/*/*' | |
file_glob: true | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
tag: ${{ github.ref }} | |
prerelease: true |