From d4bb5e7ac21d87ddddd7f0ad1ec0f81ea861e49a Mon Sep 17 00:00:00 2001 From: Cornelius Roemer Date: Fri, 12 Jul 2024 16:09:32 +0200 Subject: [PATCH 1/4] Add build for osx-arm64 --- .github/workflows/ci.yaml | 3 ++- README.md | 2 +- devel/build | 4 +--- devel/conda-subdir | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b1b7391..79edd4e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -42,7 +42,8 @@ jobs: matrix: os: - ubuntu-22.04 - - macos-13 + - macos-13 # x86_64 + - macos-14 # arm64 name: build and test (os=${{ matrix.os }}) runs-on: ${{ matrix.os }} diff --git a/README.md b/README.md index 1ff86fe..0ad9ad0 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ To build this package locally, run: The final built package will be written to `build/locked//nextstrain-base-*.conda`, where `` is a Conda -subdir, e.g. `linux-64` or `osx-64`. +subdir, i.e. `linux-64`, `osx-64` or `osx-arm64`. [CI][] builds store the entire `build/` and `locked/` directories as an artifact attached to each CI run. You can download the artifacts to inspect diff --git a/devel/build b/devel/build index 2c4f866..5579d98 100755 --- a/devel/build +++ b/devel/build @@ -11,9 +11,7 @@ main() { export PATH="$env/bin:$PATH" export VERSION="${VERSION:-$(./devel/generate-version)}" - # Set CONDA_SUBDIR unless it's already set. This helps macOS users on - # arm64 chips use and produce osx-64 Conda packages instead of osx-arm64 - # packages (which we don't yet support). + # Set CONDA_SUBDIR unless it's already set. CONDA_SUBDIR="${CONDA_SUBDIR:-$(./devel/conda-subdir)}" export CONDA_SUBDIR diff --git a/devel/conda-subdir b/devel/conda-subdir index 1ea9037..52b51c0 100755 --- a/devel/conda-subdir +++ b/devel/conda-subdir @@ -15,7 +15,7 @@ case "$kernel/$machine" in echo "osx-64";; Darwin/arm64) - echo "osx-64";; + echo "osx-arm64";; *) echo "unsupported kernel/machine: $kernel/$machine" >&2 From 548e88243171f89f25bd27ed6b3960fdcfb7dbbf Mon Sep 17 00:00:00 2001 From: Victor Lin <13424970+victorlin@users.noreply.github.com> Date: Mon, 3 Feb 2025 15:31:41 -0800 Subject: [PATCH 2/4] devel: Replace unzip with p7zip The osx-arm64 build of unzip provided by conda cannot extract the info file from the conda package. The error is apparent when running with unzip directly: skipping: info-nextstrain-base-20250203T230808Z-h60d57d3_0.tar.zst need PK compat. v4.5 (can do v2.1) p7zip does not have this issue. --- devel/extract-pkg-info | 2 +- devel/setup | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/devel/extract-pkg-info b/devel/extract-pkg-info index a8b0650..28be10d 100755 --- a/devel/extract-pkg-info +++ b/devel/extract-pkg-info @@ -22,7 +22,7 @@ main() { package="$1" file="$2" - unzip -p "$package" "info-$(basename "$package" .conda).tar.zst" \ + 7z e -so "$package" "info-$(basename "$package" .conda).tar.zst" \ | unzstd --stdout \ | tar --extract --to-stdout "info/$file" } diff --git a/devel/setup b/devel/setup index 008d880..d68e8dd 100755 --- a/devel/setup +++ b/devel/setup @@ -25,8 +25,8 @@ create() { yq # for extracting files from .conda packages + p7zip tar - unzip zstd # to get gnu `date` on macOS From 0f546223bbebdd7fcdbae04c3432640217eb2ef1 Mon Sep 17 00:00:00 2001 From: Thomas Sibley Date: Tue, 4 Feb 2025 22:10:57 -0800 Subject: [PATCH 3/4] ci: Make failure to generate a job summary non-fatal It seems unnecessary to tank the build just because we fail to generate a package diff. --- .github/workflows/ci.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 79edd4e..db45113 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -87,6 +87,7 @@ jobs: nextstrain-base - name: Generate summary + continue-on-error: true run: | ./devel/download-latest ./devel/diff-pkgs nextstrain-base-*.conda build/locked/*/nextstrain-base-*.conda \ From ae05e8c190c2cdd65ac92a9feaf3a028ac7b59ef Mon Sep 17 00:00:00 2001 From: Thomas Sibley Date: Tue, 4 Feb 2025 22:13:14 -0800 Subject: [PATCH 4/4] devel/download-latest: Explicitly error if no packages can be found Avoids letting the issue surface as more distant and perplexing errors in jq and wget. --- devel/download-latest | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/devel/download-latest b/devel/download-latest index 31b10c0..ea51443 100755 --- a/devel/download-latest +++ b/devel/download-latest @@ -7,12 +7,14 @@ export PATH="$env/bin:$PATH" CONDA_SUBDIR="${CONDA_SUBDIR:-$("$repo"/devel/conda-subdir)}" export CONDA_SUBDIR -wget "$( +url="$( curl -fsSL https://api.anaconda.org/package/nextstrain/nextstrain-base/files | jq -r ' map(select(.labels|index("main"))) | map(select(.attrs.subdir == env.CONDA_SUBDIR)) + | if length == 0 then ("error: download-latest: no packages found\n" | halt_error) else . end | max_by([.version, .attrs.build_number]) | .download_url | if startswith("//") then "https:\(.)" else . end ' )" +wget "$url"