Skip to content

Commit

Permalink
Merge pull request #576 from nextstrain/fix/dataset-list-crash
Browse files Browse the repository at this point in the history
fix: fix crash in dataset list command on macos
  • Loading branch information
corneliusroemer committed Oct 25, 2021
2 parents b5f3cec + fce4f8d commit 7b5cbce
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 44 deletions.
78 changes: 43 additions & 35 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
- restore_cache:
name: 'Restore previous checksum.txt from cache'
keys:
- cache-nextclade-v6-builder-container-{{ checksum "checksum.current.txt" }}
- cache-nextclade-v7-builder-container-{{ checksum "checksum.current.txt" }}

- run:
name: 'Compare checksum.txt to cached one, halt if no changes'
Expand Down Expand Up @@ -80,7 +80,7 @@ jobs:
- save_cache:
name: 'Save new checksum.txt to cache'
key: cache-nextclade-v6-builder-container-{{ checksum "checksum.previous.txt" }}
key: cache-nextclade-v7-builder-container-{{ checksum "checksum.previous.txt" }}
paths:
- checksum.previous.txt

Expand All @@ -101,7 +101,7 @@ jobs:
- restore_cache:
name: 'Restore WebAssembly module build cache'
keys:
- cache-nextclade-v6-web-wasm-{{ arch }}-{{ checksum "conanfile.wasm.txt" }}
- cache-nextclade-v7-web-wasm-{{ arch }}-{{ checksum "conanfile.wasm.txt" }}

- run:
name: 'Build WebAssembly module'
Expand All @@ -112,14 +112,14 @@ jobs:
- save_cache:
name: 'Save WebAssembly module build cache'
key: cache-nextclade-v6-web-wasm-{{ arch }}-{{ checksum "conanfile.wasm.txt" }}
key: cache-nextclade-v7-web-wasm-{{ arch }}-{{ checksum "conanfile.wasm.txt" }}
paths:
- .cache

- restore_cache:
name: 'Restore web application build cache'
keys:
- cache-nextclade-v6-web-js-{{ arch }}-{{ checksum "packages/web/yarn.lock" }}
- cache-nextclade-v7-web-js-{{ arch }}-{{ checksum "packages/web/yarn.lock" }}

- run:
name: 'Build web application'
Expand All @@ -128,7 +128,7 @@ jobs:
- save_cache:
name: 'Save web application build cache'
key: cache-nextclade-v6-web-js-{{ arch }}-{{ checksum "packages/web/yarn.lock" }}
key: cache-nextclade-v7-web-js-{{ arch }}-{{ checksum "packages/web/yarn.lock" }}
paths:
- packages/web/.cache
- packages/web/.build/production/tmp/cache
Expand Down Expand Up @@ -188,7 +188,7 @@ jobs:
- restore_cache:
name: 'Restore build cache'
keys:
- cache-nextclade-v6-cache-{{ arch }}-{{ checksum "conanfile.txt" }}
- cache-nextclade-v7-cache-{{ arch }}-{{ checksum "conanfile.txt" }}

- run:
name: 'Run "Builder" container'
Expand All @@ -198,7 +198,7 @@ jobs:
- save_cache:
name: 'Save build cache'
key: cache-nextclade-v6-cache-{{ arch }}-{{ checksum "conanfile.txt" }}
key: cache-nextclade-v7-cache-{{ arch }}-{{ checksum "conanfile.txt" }}
paths:
- .cache

Expand Down Expand Up @@ -242,42 +242,50 @@ jobs:
- restore_cache:
name: 'Restore homebrew cache'
keys:
- cache-nextclade-v6-homebrew-{{ arch }}-{{ checksum "Brewfile" }}
- cache-nextclade-v7-homebrew-{{ arch }}-{{ checksum "Brewfile" }}

- run:
name: 'Install build tools'
command: |
set -x
brew bundle
mkdir -p .cache
python3 -m venv .cache/venv
source .cache/venv/bin/activate
pip3 install --upgrade -r requirements.txt
conan profile new default --detect
environment:
HOMEBREW_NO_AUTO_UPDATE: 1
CONAN_USER_HOME: '/Users/distiller/project/.cache'

- save_cache:
name: 'Save homebrew cache'
key: cache-nextclade-v6-homebrew-{{ arch }}-{{ checksum "Brewfile" }}
key: cache-nextclade-v7-homebrew-{{ arch }}-{{ checksum "Brewfile" }}
paths:
- '~/Library/Caches/Homebrew'
- '/usr/local/Homebrew'

- restore_cache:
name: 'Restore build cache'
keys:
- cache-nextclade-v6-cache-{{ arch }}-{{ checksum "conanfile.txt" }}-<< parameters.macos_arch >>
- cache-nextclade-v7-cache-{{ arch }}-{{ checksum "conanfile.txt" }}-<< parameters.macos_arch >>

- run:
name: Run macOS << parameters.macos_arch >> build
command: |
echo "DATA_FULL_DOMAIN=${DATA_FULL_DOMAIN}" >> .env
source .cache/venv/bin/activate
echo "DATA_FULL_DOMAIN=https://data.master.clades.nextstrain.org" >> .env
make prod
environment:
CONAN_USER_HOME: '/Users/distiller/project/.cache'
HOST_ARCH: << parameters.macos_arch >>

- save_cache:
name: 'Save build cache'
key: cache-nextclade-v6-cache-{{ arch }}-{{ checksum "conanfile.txt" }}-<< parameters.macos_arch >>
key: cache-nextclade-v7-cache-{{ arch }}-{{ checksum "conanfile.txt" }}-<< parameters.macos_arch >>
paths:
- .cache

Expand All @@ -291,36 +299,36 @@ jobs:
path: .out/bin/nextclade-MacOS-<< parameters.macos_arch >>
destination: nextclade-MacOS-<< parameters.macos_arch >>

- run:
name: 'Publish binaries to GitHub Releases: MacOS-<< parameters.macos_arch >>'
command: |
OS=darwin ./scripts/download_github_release_tool.sh
./scripts/publish_github_releases.sh
# - run:
# name: 'Publish binaries to GitHub Releases: MacOS-<< parameters.macos_arch >>'
# command: |
# OS=darwin ./scripts/download_github_release_tool.sh
# ./scripts/publish_github_releases.sh

workflows:
version: 2
build:
jobs:
- Update-Builder-Container:
<<: *major_branches_and_cli_release_only

- Build-Web:
context: nextclade_web_<< pipeline.git.branch >>
<<: *major_branches_only
requires:
- Update-Builder-Container

- Build-Linux-x86_64:
context: nextclade_cli_<< pipeline.git.branch >>
<<: *release_cli_only
requires:
- Update-Builder-Container
# - Update-Builder-Container:
# <<: *major_branches_and_cli_release_only
#
# - Build-Web:
# context: nextclade_web_<< pipeline.git.branch >>
# <<: *major_branches_only
# requires:
# - Update-Builder-Container
#
# - Build-Linux-x86_64:
# context: nextclade_cli_<< pipeline.git.branch >>
# <<: *release_cli_only
# requires:
# - Update-Builder-Container

- Build-MacOS:
context: nextclade_cli_<< pipeline.git.branch >>
# context: nextclade_cli_<< pipeline.git.branch >>
matrix:
parameters:
macos_arch:
- x86_64
- arm64
<<: *release_cli_only
# - arm64
# <<: *release_cli_only
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ paper/paper.pdf
tmp
build/
*.bak
Brewfile.lock.json
1 change: 0 additions & 1 deletion Brewfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ brew "autoconf"
brew "automake"
brew "ccache"
brew "cmake"
brew "conan"
brew "coreutils"
brew "cppcheck"
brew "ghr"
Expand Down
2 changes: 1 addition & 1 deletion conanfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ cli11/1.9.1
cxxopts/2.2.1
date/3.0.1
fast-cpp-csv-parser/20191004
fmt/7.1.3
fmt/8.0.1
ghc-filesystem/1.4.0
gtest/1.10.0
jemalloc/5.2.1@local/stable
Expand Down
7 changes: 6 additions & 1 deletion docs/dev/developers-guide-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,19 @@ The easiest way to start the development is to use the included docker container
💡 Quick install for macOS (click to expand)
</summary>
You need to install XCode command line tools. After that you can install remaining required dependencies using [Homebrew](https://brew.sh/) and pip
You need to install XCode command line tools. After that you can install remaining required dependencies using [Homebrew](https://brew.sh/) and pip (into a Python virtual environment)
```
xcode-select --install
cd nextclade
brew bundle --file=Brewfile
mkdir -p .cache
python3 -m venv .cache/venv
source .cache/venv/bin/activate
pip3 install --upgrade -r requirements.txt
```
</details>
</p>
Expand Down
9 changes: 5 additions & 4 deletions packages/nextclade_common/src/datasets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,9 @@ namespace Nextclade {
}

std::string formatDatasets(const std::vector<Dataset>& datasets, bool verbose /* = false */) {
fmt::memory_buffer buf;
fmt::memory_buffer bufRaw;
auto buf = std::back_inserter(bufRaw);

for (const auto& dataset : datasets) {
fmt::format_to(buf, "Dataset\n");
fmt::format_to(buf, "-------\n");
Expand All @@ -369,7 +371,7 @@ namespace Nextclade {

auto numRefs = std::to_string(dataset.datasetRefs.size());
fmt::format_to(buf, "Specific reference sequences ({:}):\n", numRefs);
fmt::format_to(buf, "-----------------------------" + std::string{"-", numRefs.size() + 3} + "\n\n");
// fmt::format_to(buf, "-----------------------------" + std::string{"-", numRefs.size() + 3} + "\n\n");

for (const auto& datasetRef : dataset.datasetRefs) {
const auto& ref = datasetRef.reference;
Expand All @@ -394,7 +396,6 @@ namespace Nextclade {

auto numTags = std::to_string(datasetRef.versions.size());
fmt::format_to(buf, " Specific versions ({:}):\n", datasetRef.versions.size());
fmt::format_to(buf, " ------------------" + std::string{"-", numTags.size() + 3} + "\n\n");

for (const auto& version : datasetRef.versions) {
fmt::format_to(buf, " Version\n");
Expand Down Expand Up @@ -441,7 +442,7 @@ namespace Nextclade {
}
fmt::format_to(buf, "\n");
}
return fmt::to_string(buf);
return fmt::to_string(bufRaw);
}


Expand Down
4 changes: 2 additions & 2 deletions scripts/build_locally.sh
Original file line number Diff line number Diff line change
Expand Up @@ -787,9 +787,9 @@ pushd "${BUILD_DIR}" > /dev/null
print 30 "Install executable";
cmake --install "${BUILD_DIR}" --config "${CMAKE_BUILD_TYPE}" --strip

strip_executable "${NEXTALIGN_CLI}"
# strip_executable "${NEXTALIGN_CLI}"

strip_executable "${NEXTCLADE_CLI}"
# strip_executable "${NEXTCLADE_CLI}"

fi

Expand Down

1 comment on commit 7b5cbce

@vercel
Copy link

@vercel vercel bot commented on 7b5cbce Oct 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.