Skip to content

Commit

Permalink
Update build.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
hoxbro committed Jul 31, 2024
1 parent b71e0cf commit 28fa840
Showing 1 changed file with 111 additions and 67 deletions.
178 changes: 111 additions & 67 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,82 +11,126 @@ on:
schedule:
- cron: "0 17 * * SUN"

env:
PYTHON_VERSION: "3.11"
PACKAGE: "lumen"

jobs:
waiting_room:
name: Waiting Room
runs-on: ubuntu-latest
needs: [conda_build, pip_install]
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
# environment:
# name: publish
steps:
- run: echo "All builds have finished, have been approved, and ready to publish"

pixi_lock:
name: Pixi lock
runs-on: ubuntu-latest
steps:
- uses: holoviz-dev/holoviz_tasks/pixi_lock@pixi

conda_build:
name: Build Conda Packages
name: Build Conda
needs: [pixi_lock]
runs-on: "ubuntu-latest"
defaults:
run:
shell: bash -l {0}
env:
CHANS_DEV: "-c pyviz/label/dev"
MPLBACKEND: "Agg"
PYCTDEV_SELF_CHANNEL: "pyviz/label/dev"
steps:
- uses: actions/checkout@v3
- name: Fetch unshallow
run: git fetch --prune --tags --unshallow -f
- uses: conda-incubator/setup-miniconda@v2
- uses: holoviz-dev/holoviz_tasks/pixi_install@pixi
with:
environments: "build"
download-data: false
install: false
- name: conda build
run: pixi run -e build build-conda
- uses: actions/upload-artifact@v4
if: always()
with:
name: conda
path: dist/*.tar.bz2
if-no-files-found: error

conda_publish:
name: Publish Conda
runs-on: ubuntu-latest
needs: [conda_build, waiting_room]
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v4
with:
name: conda
path: dist/
- name: Set environment variables
run: |
echo "TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
echo "CONDA_FILE=$(ls dist/*.tar.bz2)" >> $GITHUB_ENV
- uses: conda-incubator/setup-miniconda@v3
with:
miniconda-version: "latest"
python-version: 3.9
- name: Set output
id: vars
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
- name: conda setup
run: |
conda config --set always_yes True
conda install -c pyviz/label/dev "pyctdev>=0.5"
doit ecosystem_setup
- name: conda build
run: doit package_build $CHANS_DEV --no-pkg-tests
- name: conda dev upload
if: (github.event_name == 'push' && (contains(steps.vars.outputs.tag, 'a') || contains(steps.vars.outputs.tag, 'b') || contains(steps.vars.outputs.tag, 'rc')))
run: doit package_upload --token=${{ secrets.CONDA_UPLOAD_TOKEN }} --label=dev
- name: conda main upload
if: (github.event_name == 'push' && !(contains(steps.vars.outputs.tag, 'a') || contains(steps.vars.outputs.tag, 'b') || contains(steps.vars.outputs.tag, 'rc')))
run: doit package_upload --token=${{ secrets.CONDA_UPLOAD_TOKEN }} --label=dev --label=main
conda install -y anaconda-client
# - name: conda dev upload
# if: contains(env.TAG, 'a') || contains(env.TAG, 'b') || contains(env.TAG, 'rc')
# run: |
# anaconda --token ${{ secrets.CONDA_UPLOAD_TOKEN }} upload --user pyviz --label=dev $CONDA_FILE
# - name: conda main upload
# if: (!(contains(env.TAG, 'a') || contains(env.TAG, 'b') || contains(env.TAG, 'rc')))
# run: |
# anaconda --token ${{ secrets.CONDA_UPLOAD_TOKEN }} upload --user pyviz --label=dev --label=main $CONDA_FILE

pip_build:
name: Build PyPI Packages
name: Build PyPI
needs: [pixi_lock]
runs-on: "ubuntu-latest"
defaults:
run:
shell: bash -l {0}
env:
CHANS_DEV: "-c pyviz/label/dev -c conda-forge"
PKG_TEST_PYTHON: "--test-python=py39"
PYTHON_VERSION: "3.9"
MPLBACKEND: "Agg"
PPU: ${{ secrets.PPU }}
PPP: ${{ secrets.PPP }}
PYPI: "https://upload.pypi.org/legacy/"
PYCTDEV_SELF_CHANNEL: "pyviz/label/dev"
steps:
- uses: actions/checkout@v3
- name: Fetch unshallow
run: git fetch --prune --tags --unshallow -f
- uses: conda-incubator/setup-miniconda@v2
- uses: holoviz-dev/holoviz_tasks/pixi_install@pixi
with:
miniconda-version: "latest"
- name: conda setup
run: |
conda install -c pyviz/label/dev "pyctdev>=0.5"
doit ecosystem_setup
doit env_create $CHANS_DEV --python=$PYTHON_VERSION
conda activate test-environment
conda config --env --remove channels defaults
conda config --env --append channels pyviz/label/dev --append channels conda-forge
- name: env setup
run: |
conda activate test-environment
doit develop_install $CHANS_DEV
doit pip_on_conda
- name: pip build
run: |
conda activate test-environment
doit ecosystem=pip package_build $PKG_TEST_PYTHON --test-group=simple
- name: pip upload
if: github.event_name == 'push'
run: |
conda activate test-environment
doit ecosystem=pip package_upload -u $PPU -p $PPP -r $PYPI
environments: "build"
download-data: false
install: false
- name: Build package
run: pixi run -e build build-pip
- uses: actions/upload-artifact@v4
if: always()
with:
name: pip
path: dist/
if-no-files-found: error

pip_install:
name: Install PyPI
runs-on: "ubuntu-latest"
needs: [pip_build]
steps:
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- uses: actions/download-artifact@v4
with:
name: pip
path: dist/
- name: Install package
run: python -m pip install dist/*.whl
- name: Import package
run: python -c "import $PACKAGE; print($PACKAGE.__version__)"
- name: Install test dependencies
run: python -m pip install "$(ls dist/*whl)[tests]"

pip_publish:
name: Publish PyPI
runs-on: ubuntu-latest
needs: [pip_build, waiting_room]
# if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v4
with:
name: pip
path: dist/
# - name: Publish to PyPI
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# user: ${{ secrets.PPU }}
# password: ${{ secrets.PPP }}
# repository-url: "https://upload.pypi.org/legacy/"

0 comments on commit 28fa840

Please sign in to comment.