diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 5a650851c3..5251898abe 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -2,88 +2,164 @@ name: packages on: push: tags: - - 'v[0-9]+.[0-9]+.[0-9]+' - - 'v[0-9]+.[0-9]+.[0-9]+a[0-9]+' - - 'v[0-9]+.[0-9]+.[0-9]+b[0-9]+' - - 'v[0-9]+.[0-9]+.[0-9]+rc[0-9]+' + - "v[0-9]+.[0-9]+.[0-9]+" + - "v[0-9]+.[0-9]+.[0-9]+a[0-9]+" + - "v[0-9]+.[0-9]+.[0-9]+b[0-9]+" + - "v[0-9]+.[0-9]+.[0-9]+rc[0-9]+" # Dry-run only workflow_dispatch: schedule: - - cron: '0 19 * * SUN' + - cron: "0 19 * * SUN" + +defaults: + run: + shell: bash -el {0} env: - PYTHON_VERSION: "3.9" - NODE_VERSION: "18" + PACKAGE: "panel" + PYTHON_VERSION: "3.11" + NODE_VERSION: "20" MPLBACKEND: "Agg" + SETUPTOOLS_ENABLE_FEATURES: "legacy-editable" jobs: + waiting_room: + name: Waiting Room + runs-on: ubuntu-latest + needs: [conda_build, pip_install, npm_build, cdn_build] + 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" + conda_build: - name: Build Conda Package - runs-on: 'ubuntu-latest' - defaults: - run: - shell: bash -l {0} + name: Build Conda + runs-on: "ubuntu-latest" steps: - - name: remove nodejs - run: | - sudo rm /usr/local/bin/node - sudo rm /usr/local/bin/npm - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: "100" - - uses: conda-incubator/setup-miniconda@v2 + - name: Fetch unshallow + run: git fetch --prune --tags --unshallow -f + - uses: conda-incubator/setup-miniconda@v3 with: miniconda-version: "latest" - python-version: ${{ env.PYTHON_VERSION }} - uses: actions/setup-node@v4 with: node-version: ${{ env.NODE_VERSION }} - - name: Fetch unshallow - run: git fetch --prune --tags --unshallow -f - - name: Set output - id: vars - run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT - name: conda setup run: | - conda config --set always_yes True - conda config --append channels pyviz/label/dev - conda config --append channels bokeh/label/dev - conda install -y conda-build anaconda-client build + conda install -y conda-build build - name: conda build run: | source ./scripts/build_conda.sh - echo "CONDA_FILE="$CONDA_PREFIX/conda-bld/noarch/panel-$VERSION-py_0.tar.bz2"" >> $GITHUB_ENV - - uses: actions/upload-artifact@v3 + echo "CONDA_FILE="$CONDA_PREFIX/conda-bld/noarch/$PACKAGE-$VERSION-py_0.tar.bz2"" >> $GITHUB_ENV + - uses: actions/upload-artifact@v4 if: always() with: - name: conda_build - if-no-files-found: error + name: conda path: ${{ env.CONDA_FILE }} - - name: conda dev deploy - if: (github.event_name == 'push' && (contains(steps.vars.outputs.tag, 'a') || contains(steps.vars.outputs.tag, 'b') || contains(steps.vars.outputs.tag, 'rc'))) + 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@v2 + with: + miniconda-version: "latest" + - name: conda setup + run: | + 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 deploy - if: (github.event_name == 'push' && !(contains(steps.vars.outputs.tag, 'a') || contains(steps.vars.outputs.tag, 'b') || contains(steps.vars.outputs.tag, 'rc'))) + - 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 - npm_build: - name: Build NPM Package - runs-on: 'ubuntu-latest' - needs: [conda_build, pip_build] - defaults: - run: - shell: bash -l {0} + pip_build: + name: Build PyPI + runs-on: "ubuntu-latest" steps: - - name: remove nodejs + - uses: actions/checkout@v4 + with: + fetch-depth: "100" + - name: Fetch unshallow + run: git fetch --prune --tags --unshallow -f + - uses: actions/setup-python@v5 + with: + python-version: ${{ env.PYTHON_VERSION }} + - uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION }} + - name: Install build run: | - sudo rm /usr/local/bin/node - sudo rm /usr/local/bin/npm - - uses: actions/checkout@v3 + python -m pip install build + - name: Build package + run: python -m build . + - 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: Test package + run: python -c "import $PACKAGE; print($PACKAGE.__version__)" + + 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/" + + npm_build: + name: Build NPM + runs-on: "ubuntu-latest" + steps: + - uses: actions/checkout@v4 with: fetch-depth: "100" - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: ${{ env.PYTHON_VERSION }} - uses: actions/setup-node@v4 @@ -99,49 +175,56 @@ jobs: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_API_TOKEN }}" > $HOME/.npmrc npm whoami npm -v + - name: package install + run: | + python -m pip install -ve . - name: npm build run: | - SETUPTOOLS_ENABLE_FEATURES="legacy-editable" python -m pip install -ve . cd ./panel TARBALL=$(npm pack .) echo "TARBALL=$TARBALL" >> $GITHUB_ENV npm publish --dry-run $TARBALL cd .. - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 if: always() with: - name: npm_build + name: npm if-no-files-found: error path: ./panel/${{ env.TARBALL }} + + npm_publish: + name: Publish NPM + runs-on: "ubuntu-latest" + needs: [npm_build, waiting_room] + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') + steps: + - uses: actions/download-artifact@v4 + with: + name: npm + - uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION }} + - name: Set environment variables + run: | + echo "TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + echo "TARBALL=$(ls *.tgz)" >> $GITHUB_ENV - name: npm dev deploy - if: (github.event_name == 'push' && (contains(steps.vars.outputs.tag, 'a') || contains(steps.vars.outputs.tag, 'b') || contains(steps.vars.outputs.tag, 'rc'))) + if: contains(env.TAG, 'a') || contains(env.TAG, 'b') || contains(env.TAG, 'rc') run: | - cd ./panel npm publish --tag dev $TARBALL - cd .. - name: npm main deploy - if: (github.event_name == 'push' && !(contains(steps.vars.outputs.tag, 'a') || contains(steps.vars.outputs.tag, 'b') || contains(steps.vars.outputs.tag, 'rc'))) + if: (!(contains(env.TAG, 'a') || contains(env.TAG, 'b') || contains(env.TAG, 'rc'))) run: | - cd ./panel npm publish --tag latest $TARBALL - cd .. - cdn: + cdn_build: name: Build CDN - runs-on: 'ubuntu-latest' - needs: [conda_build, pip_build] - defaults: - run: - shell: bash -l {0} + runs-on: "ubuntu-latest" steps: - - name: remove nodejs - run: | - sudo rm /usr/local/bin/node - sudo rm /usr/local/bin/npm - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: "100" - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: ${{ env.PYTHON_VERSION }} - uses: actions/setup-node@v4 @@ -149,82 +232,38 @@ jobs: node-version: ${{ env.NODE_VERSION }} - name: Fetch unshallow run: git fetch --prune --tags --unshallow -f - - name: Set output - id: vars - run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT - - name: build pyodide wheels for CDN + - name: build pyodide wheels run: | - python -m pip install packaging tomli + python -m pip install packaging python ./scripts/build_pyodide_wheels.py --verify-clean - SETUPTOOLS_ENABLE_FEATURES="legacy-editable" python -m pip install -ve . - - uses: actions/upload-artifact@v3 + - name: build CDN + run: | + python -m pip install -ve . + - uses: actions/upload-artifact@v4 if: always() with: - name: cdn_wheels + name: cdn if-no-files-found: error path: | - ./panel/dist/wheels/panel*.whl - ./panel/dist/wheels/bokeh*.whl + ./panel/dist/ + ./panel/package.json + + cdn_publish: + name: Publish CDN + runs-on: "ubuntu-latest" + needs: [cdn_build, waiting_room] + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: "1" + - uses: actions/download-artifact@v4 + with: + name: cdn + path: panel/ - name: Deploy to cdn.holoviz.org env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - AWS_DEFAULT_REGION: 'us-east-1' + AWS_DEFAULT_REGION: "us-east-1" run: python scripts/cdn_upload.py - - pip_build: - name: Build PyPI Package - runs-on: 'ubuntu-latest' - defaults: - run: - shell: bash -l {0} - env: - CHANS_DEV: "-c pyviz/label/dev -c bokeh/label/dev -c conda-forge" - PKG_TEST_PYTHON: "--test-python=py39" - CHANS: "-c pyviz" - PYPI: "https://upload.pypi.org/legacy/" - steps: - - name: remove nodejs - run: | - sudo rm /usr/local/bin/node - sudo rm /usr/local/bin/npm - - uses: actions/checkout@v3 - with: - fetch-depth: "100" - - uses: conda-incubator/setup-miniconda@v2 - with: - miniconda-version: "latest" - - uses: actions/setup-node@v4 - with: - node-version: ${{ env.NODE_VERSION }} - - name: Fetch unshallow - run: git fetch --prune --tags --unshallow -f - - name: conda setup - run: | - conda config --set always_yes True - conda install -c pyviz "pyctdev>=0.5" - doit ecosystem_setup - doit env_create $CHANS_DEV --python=$PYTHON_VERSION - - name: env setup - run: | - eval "$(conda shell.bash hook)" - conda activate test-environment - conda install ${{ env.CHANS_DEV }} "pip<21.2.1" - doit develop_install $CHANS_DEV -o build - pip uninstall -y panel - doit pip_on_conda - - name: pip build - run: | - eval "$(conda shell.bash hook)" - conda activate test-environment - doit ecosystem=pip package_build $PKG_TEST_PYTHON --test-group=flakes - - name: git status - run: | - git status - git diff - - name: pip upload - if: github.event_name == 'push' - run: | - eval "$(conda shell.bash hook)" - conda activate test-environment - doit ecosystem=pip package_upload -u ${{ secrets.PPU }} -p ${{ secrets.PPP }} -r $PYPI diff --git a/conda.recipe/meta.yaml b/conda.recipe/meta.yaml index 3112df6ebb..daa05b49c2 100644 --- a/conda.recipe/meta.yaml +++ b/conda.recipe/meta.yaml @@ -40,7 +40,7 @@ test: - pytest-asyncio - pytest-xdist commands: - # - pip check + - pip check - panel --help - pytest --pyargs panel.tests -n logical --dist loadgroup diff --git a/scripts/build_conda.sh b/scripts/build_conda.sh index 4b47650355..f2a5cc5dfa 100755 --- a/scripts/build_conda.sh +++ b/scripts/build_conda.sh @@ -11,4 +11,4 @@ git diff --exit-code VERSION=$(find dist -name "*.whl" -exec basename {} \; | cut -d- -f2) export VERSION -conda build conda.recipe/ --no-anaconda-upload --no-verify +conda build conda.recipe/ --no-anaconda-upload --no-verify -c bokeh