Skip to content

Update build-and-publish.yml #691

Update build-and-publish.yml

Update build-and-publish.yml #691

name: Build & Publish
on:
pull_request:
branches:
- main
push:
branches:
- main
release:
types:
- released
env:
IB_VERSION: 10.19.04
DH_VERSION: 0.34.1
jobs:
build-ib-whl:
name: Build IB WHL
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Build
run: |
python3 --version
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements_dhib_env.txt
python3 dhib_env.py ib-wheel --ib_version ${{ env.IB_VERSION }}
find . -name \*.whl
- name: Archive build artifacts
uses: actions/upload-artifact@v2
with:
name: ib-wheels
path: |
dist/ib/*
build-whl:
name: Build WHL
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@master
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools wheel build twine
- name: Set output version
id: version
run: |
TAG_NAME=${{ github.event.release.tag_name }}
if [ -z "${TAG_NAME}" ]
then
if [ "$GITHUB_REF" = "refs/heads/main" ]
then
echo "name=version::0.0.0.rc" >> $GITHUB_OUTPUT
else
PR_NUMBER=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }')
echo "name=version::0.0.0.dev${PR_NUMBER}" >> $GITHUB_OUTPUT
fi
else
echo "name=version::${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT
fi
- name: Build
env:
DH_IB_VERSION: ${{ steps.version.outputs.version }}
DH_VERSION: ${{ env.DH_VERSION }}
run: |
python -m build
- name: Archive build artifacts
uses: actions/upload-artifact@v2
with:
name: wheels
path: |
dist/*
publish-whl:
name: Publish WHL
runs-on: ubuntu-22.04
needs: [build-whl]
if: ${{ github.event_name == 'release' && github.event.action == 'released' }}
steps:
- name: Download Build Artifacts
uses: actions/download-artifact@v3
with:
name: wheels
path: wheel/
- name: Publish WHL to PyPi
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.DEEPHAVENIB_PYPI_TOKEN }}
packages_dir: wheel/
build-sphinx:
name: Build Sphinx
runs-on: ubuntu-22.04
needs: [build-ib-whl, build-whl]
steps:
- uses: actions/checkout@v1
- name: Apt installs
run: |
sudo apt update
sudo apt install -y openjdk-17-jdk
- name: Pip installs
run: pip3 install --upgrade sphinx~=7.3.0 sphinx-autodoc-typehints furo==2024.5.6
- name: Download IB wheels
uses: actions/download-artifact@v3
with:
name: ib-wheels
- name: Install IB Whl
run: pip3 install *.whl
- name: Download wheels
uses: actions/download-artifact@v3
with:
name: wheels
- name: Install Whl
run: pip3 install *.whl
- name: Run Sphinx
working-directory: ./sphinx
env:
JAVA_HOME: /usr/lib/jvm/java-17-openjdk-amd64
run: |
make html
touch build/html/.nojekyll
- name: Archive Sphinx artifacts
uses: actions/upload-artifact@v1
with:
name: documentation-html
path: sphinx/build/html/
- name: Upload JVM Error Logs
uses: actions/upload-artifact@v3
if: failure()
with:
name: check-ci-jvm-err
path: '**/*_pid*.log'
if-no-files-found: ignore
publish-sphinx:
name: Publish Sphinx
runs-on: ubuntu-22.04
needs: [build-sphinx]
if: ${{ github.event_name == 'release' && github.event.action == 'released' }}
steps:
- uses: actions/checkout@v1
- name: Download Sphinx Artifacts
uses: actions/download-artifact@v3
with:
name: documentation-html
path: html/
- name: Deploy Sphinx docs to gh-pages
uses: JamesIves/github-pages-deploy-action@v4.2.3
with:
branch: gh-pages
folder: html/
- name: Upload JVM Error Logs
uses: actions/upload-artifact@v3
if: failure()
with:
name: sphinx-jvm-err
path: '**/*_pid*.log'
if-no-files-found: ignore
docker-pip:
name: Build and Publish Docker (pip-installed Deephaven)
runs-on: ubuntu-22.04
needs: [build-ib-whl, build-whl]
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v5.2
- name: Download IB wheels
uses: actions/download-artifact@v3
with:
name: ib-wheels
path: ib-wheels/
- name: Download wheels
uses: actions/download-artifact@v3
with:
name: wheels
path: wheels/
- name: Log in to the Container registry
uses: docker/login-action@v1.10.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta-base
uses: docker/metadata-action@v4.0.1
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=schedule
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=raw,${{ steps.branch-name.outputs.current_branch }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64,linux/arm64
file: ./.github/workflows/Dockerfile.pip
push: true
tags: ${{ steps.meta-base.outputs.tags }}
labels: ${{ steps.meta-base.outputs.labels }}
build-args: IB_VERSION=${{ env.IB_VERSION }}
env:
IMAGE_NAME: ${{ github.repository }}
docker-dhserver:
name: Build and Publish Docker (Deephaven server image)
runs-on: ubuntu-22.04
needs: [build-ib-whl, build-whl]
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v5.2
- name: Download IB wheels
uses: actions/download-artifact@v3
with:
name: ib-wheels
path: ib-wheels/
- name: Download wheels
uses: actions/download-artifact@v3
with:
name: wheels
path: wheels/
- name: Log in to the Container registry
uses: docker/login-action@v1.10.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta-base
uses: docker/metadata-action@v4.0.1
with:
images: ghcr.io/${{ github.repository }}-dhserver
labels: deephaven_version=${{ env.DH_VERSION }}
tags: |
type=schedule
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=raw,${{ steps.branch-name.outputs.current_branch }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64,linux/arm64
file: ./.github/workflows/Dockerfile.server
push: true
tags: ${{ steps.meta-base.outputs.tags }}
labels: ${{ steps.meta-base.outputs.labels }}
build-args: |
IB_VERSION=${{ env.IB_VERSION }}
DH_VERSION=${{ env.DH_VERSION }}
env:
IMAGE_NAME: ${{ github.repository }}-dhserver