Skip to content

Commit

Permalink
Merge branch 'chore/setup-releases' into rust
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-aksamentov committed Feb 11, 2025
2 parents e68cf59 + b595cbb commit b9e767f
Show file tree
Hide file tree
Showing 17 changed files with 794 additions and 311 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*
!/\.nvmrc
!/\.out/
!/dev/docker/files/
!/rust-toolchain.toml
151 changes: 75 additions & 76 deletions .github/workflows/cli.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Build CLI binaries and publish them to GitHub Releases.
name: cli

on:
push:
branches: [ 'rust-ci' ]
branches: [ 'master', 'release', 'rust' ]

pull_request:

Expand Down Expand Up @@ -370,77 +369,77 @@ jobs:
git -c color.ui=always diff --exit-code 'docs/docs/reference.md' || (echo "Looks like command-line interface has changed, but the autogenerated CLI reference documentation at 'docs/docs/reference.md' is not up-to-date. Please build the fresh version of pangraph, then run 'cd docs && ./generate-reference-docs <path_to_pangraph> docs/docs/reference.md', then verify and commit changes to the file docs/docs/reference.md." >&2; exit 1)
# publish-to-github-releases:
# name: "Publish to GitHub Releases"
# needs: [ build-cli, run-unit-tests, run-lints, run-smoke-tests, run-linux-distros-test ]
# if: endsWith(github.ref, '/release-cli')
# runs-on: ubuntu-24.04
#
# steps:
# - name: "Checkout code"
# uses: actions/checkout@v4
# with:
# fetch-depth: 1
# submodules: true
#
# - name: "Download build artifacts"
# uses: actions/download-artifact@v4
# with:
# pattern: pangraph-*
# merge-multiple: true
# path: ".out"
#
# - name: "Install deploy dependencies"
# run: |
# mkdir -p "${HOME}/bin"
# curl -fsSL "https://github.com/cli/cli/releases/download/v2.10.1/gh_2.10.1_linux_amd64.tar.gz" | tar xz -C "${HOME}/bin" --strip-components=2 gh_2.10.1_linux_amd64/bin/gh
# curl -fsSL "https://github.com/TomWright/dasel/releases/download/v1.24.3/dasel_linux_amd64" -o "${HOME}/bin/dasel" && chmod +x "${HOME}/bin/dasel"
# curl -fsSL "https://github.com/orhun/git-cliff/releases/download/v0.7.0/git-cliff-0.7.0-x86_64-unknown-linux-gnu.tar.gz" | tar -C "${HOME}/bin" --strip-components=1 -xz "git-cliff-0.7.0/git-cliff"
# curl -fsSL "https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64" -o ${HOME}/bin/jq && chmod +x ${HOME}/bin/jq
#
# - name: "Publish build artifacts to GitHub releases"
# run: |
# export PATH="${PATH}:${HOME}/bin"
# export GITHUB_TOKEN="${{ secrets.NEHERLAB_BOT_GITHUB_TOKEN }}"
# ./scripts/publish_github \
# --artifacts_dir ".out" \
# --repo "${{ github.repository }}" \
# --git_sha "${{ github.sha }}"

# publish-to-docker-hub:
# name: "Publish to Docker Hub"
# needs: [ build-cli, run-unit-tests, run-lints, run-smoke-tests, run-linux-distros-test ]
# if: endsWith(github.ref, '/release-cli')
# runs-on: ubuntu-24.04
#
# steps:
# - name: "Checkout code"
# uses: actions/checkout@v4
# with:
# fetch-depth: 1
# submodules: true
#
# - name: "Download build artifacts"
# uses: actions/download-artifact@v4
# with:
# pattern: pangraph-*
# merge-multiple: true
# path: ".out"
#
# - name: "Install deploy dependencies"
# run: |
# mkdir -p "${HOME}/bin"
# curl -fsSL "https://github.com/TomWright/dasel/releases/download/v1.24.3/dasel_linux_amd64" -o "${HOME}/bin/dasel" && chmod +x "${HOME}/bin/dasel"
#
# - name: "Login to Docker Hub"
# uses: docker/login-action@v3
# with:
# registry: docker.io
# username: ${{ secrets.NEHERLAB_BOT_DOCKERHUB_USERNAME }}
# password: ${{ secrets.NEHERLAB_BOT_DOCKERHUB_TOKEN }}
#
# - name: "Build and publish Docker container images to Docker Hub"
# run: |
# export PATH="${PATH}:${HOME}/bin"
# chmod +x ./.out/*
# ./scripts/publish_docker --push
publish-to-github-releases:
name: "Publish to GitHub Releases"
needs: [ build-cli, run-unit-tests, run-lints, run-smoke-tests, run-linux-distros-test, check-cli-docs ]
if: endsWith(github.ref, '/release-cli')
runs-on: ubuntu-24.04

steps:
- name: "Checkout code"
uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: true

- name: "Download build artifacts"
uses: actions/download-artifact@v4
with:
pattern: pangraph-*
merge-multiple: true
path: ".out"

- name: "Install deploy dependencies"
run: |
mkdir -p "${HOME}/bin"
curl -fsSL "https://github.com/cli/cli/releases/download/v2.10.1/gh_2.10.1_linux_amd64.tar.gz" | tar xz -C "${HOME}/bin" --strip-components=2 gh_2.10.1_linux_amd64/bin/gh
curl -fsSL "https://github.com/TomWright/dasel/releases/download/v2.8.1/dasel_linux_amd64" -o "${HOME}/bin/dasel" && chmod +x "${HOME}/bin/dasel"
curl -fsSL "https://github.com/stedolan/jq/releases/download/jq-1.7.1/jq-linux64" -o ${HOME}/bin/jq && chmod +x ${HOME}/bin/jq
- name: "Publish build artifacts to GitHub releases"
run: |
export PATH="${PATH}:${HOME}/bin"
export GITHUB_TOKEN="${{ secrets.NEHERLAB_BOT_GITHUB_TOKEN }}"
./dev/publish-github \
--artifacts_dir ".out" \
--repo "${{ github.repository }}" \
--git_sha "${{ github.sha }}"
publish-to-docker-hub:
name: "Publish to Docker Hub"
needs: [ build-cli, run-unit-tests, run-lints, run-smoke-tests, run-linux-distros-test, check-cli-docs ]
if: endsWith(github.ref, '/release-cli')
runs-on: ubuntu-24.04

steps:
- name: "Checkout code"
uses: actions/checkout@v4
with:
fetch-depth: 1
submodules: true

- name: "Download build artifacts"
uses: actions/download-artifact@v4
with:
pattern: pangraph-*
merge-multiple: true
path: ".out"

- name: "Install deploy dependencies"
run: |
mkdir -p "${HOME}/bin"
curl -fsSL "https://github.com/TomWright/dasel/releases/download/v2.8.1/dasel_linux_amd64" -o "${HOME}/bin/dasel" && chmod +x "${HOME}/bin/dasel"
- name: "Login to Docker Hub"
uses: docker/login-action@v3
with:
registry: docker.io
username: ${{ secrets.NEHERLAB_BOT_DOCKERHUB_USERNAME }}
password: ${{ secrets.NEHERLAB_BOT_DOCKERHUB_TOKEN }}

- name: "Build and publish Docker container images to Docker Hub"
run: |
export PATH="${PATH}:${HOME}/bin"
chmod +x ./.out/*
./dev/publish-docker --push
10 changes: 10 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,13 @@ jobs:
run: |
cd docs/
./deploy
- name: "Create git tag"
run: |
git config --global user.name "${{ secrets.NEHERLAB_BOT_GITHUB_NAME }}"
git config --global user.email "${{ secrets.NEHERLAB_BOT_GITHUB_EMAIL }}"
version=$(date --utc +%Y-%m-%d_%H-%M-%SZ)
git tag "docs-${version}"
git push origin "docs-${version}"
105 changes: 105 additions & 0 deletions .github/workflows/pypangraph.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: pypangraph

on:
push:
branches: [ 'master', 'release-pypangraph' ]
paths:
- packages/pypangraph/**

pull_request:
paths:
- packages/pypangraph/**

repository_dispatch:
types: build

workflow_dispatch:

workflow_call:

concurrency:
group: pypangraph-${{ github.workflow }}-${{ github.ref_type }}-${{ github.event.pull_request.number || github.ref || github.run_id }}
cancel-in-progress: true

defaults:
run:
shell: bash -euo pipefail {0}

env:
GITHUB_REPOSITORY_URL: ${{ github.server_url }}/${{ github.repository }}


jobs:
build:
name: "Build PyPangraph (${{ matrix.python-version }})"
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
python-version: [ "3.9", "3.10", "3.11", "3.12" ]

steps:
- name: "Checkout code"
- uses: actions/checkout@v4

- name: "Set up Python ${{ matrix.python-version }}"
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}

- name: "Install dependencies"
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest
python -m pip install .
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: "Lint"
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: "Test"
run: |
pytest
publish-to-pypi:
name: "Publish to PyPI"
needs: [ build ]
if: endsWith(github.ref, '/release-pypangraph')
runs-on: ubuntu-24.04

steps:
- name: "Checkout code"
- uses: actions/checkout@v4

- name: "Setup Python"
uses: actions/setup-python@v3
with:
python-version: '3.x'

- name: "Install dependencies"
run: |
python -m pip install --upgrade pip
pip install build
- name: "Build package"
run: python -m build

- name: "Publish package"
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.NEHERLAB_BOT_PYPI_TOKEN }}

- name: "Create git tag"
run: |
git config --global user.name "${{ secrets.NEHERLAB_BOT_GITHUB_NAME }}"
git config --global user.email "${{ secrets.NEHERLAB_BOT_GITHUB_EMAIL }}"
version=$(dasel select -r toml -w - -s ".package.version" -f "packages/pypangraph/pyproject.toml")
git tag "pypangraph-${version}"
git push origin "pypangraph-${version}"
2 changes: 1 addition & 1 deletion dev/docker/files/install-dasel
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -euxo pipefail

curl -fsSL "https://github.com/TomWright/dasel/releases/download/v1.22.1/dasel_linux_amd64" -o "/usr/bin/dasel"
curl -fsSL "https://github.com/TomWright/dasel/releases/download/v2.8.1/dasel_linux_amd64" -o "/usr/bin/dasel"
chmod +x "/usr/bin/dasel"
which dasel
dasel --version
2 changes: 1 addition & 1 deletion dev/docker/files/install-jq
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -euxo pipefail

curl -fsSL -o "/usr/bin/jq" "https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64"
curl -fsSL -o "/usr/bin/jq" "https://github.com/stedolan/jq/releases/download/jq-1.7.1/jq-linux64"
chmod +x "/usr/bin/jq"
which jq
jq --version
36 changes: 36 additions & 0 deletions dev/docker/prod-debian.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# syntax=docker/dockerfile:1
# check=experimental=all
FROM debian:12

SHELL ["bash", "-euxo", "pipefail", "-c"]


RUN set -euxo pipefail \
&& ln -s /usr/bin/pangraph /pangraph \
&& export DEBIAN_FRONTEND=noninteractive \
&& apt-get update -qq --yes \
&& apt-get install -qq --no-install-recommends --yes \
bash \
ca-certificates \
curl \
tar \
>/dev/null \
&& apt-get autoremove --yes >/dev/null \
&& apt-get clean autoclean >/dev/null \
&& rm -rf /var/lib/apt/lists/*


RUN set -euxo pipefail \
&& export MMSEQS_VERSION="17-b804f" \
&& curl -fsSL "https://github.com/soedinglab/MMseqs2/releases/download/${MMSEQS_VERSION}/mmseqs-linux-sse41.tar.gz" \
| tar --strip-components=2 -C "/usr/bin" -xz "mmseqs/bin/mmseqs" \
&& ls "/usr/bin/mmseqs" \
&& /usr/bin/mmseqs --help \
&& mmseqs --help


COPY .out/pangraph-x86_64-unknown-linux-gnu /usr/bin/pangraph
RUN set -euxo pipefail \
&& ls "/usr/bin/pangraph" \
&& /usr/bin/pangraph --help \
&& pangraph --help \
29 changes: 29 additions & 0 deletions dev/extract-release-notes
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env python3

import argparse
import sys


def find_release_notes(input_changelog_md: str):
release_notes = ""
found_release_notes_block = False
with open(input_changelog_md) as f:
for line in f:
if not found_release_notes_block and line.startswith("## "):
found_release_notes_block = True
release_notes += line
elif found_release_notes_block:
if line.startswith("## "):
return release_notes
else:
release_notes += line


if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Extracts last release notes section from a changelog markdown file')
parser.add_argument('input_changelog_md', type=str, help='Input changelog file in markdown format')
args = parser.parse_args()

release_notes = find_release_notes(args.input_changelog_md)

sys.stdout.write(release_notes)
Loading

0 comments on commit b9e767f

Please sign in to comment.