Skip to content

Merge pull request #340 from plotly/run-tests-on-dist #4

Merge pull request #340 from plotly/run-tests-on-dist

Merge pull request #340 from plotly/run-tests-on-dist #4

Workflow file for this run

name: Generate release
on:
push:
tags:
- "v*"
workflow_dispatch:
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: "v18.16.0"
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Setup dependencies
# Set up the virtual environment and install dev dependencies (JS & Python)
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
uv venv
source .venv/bin/activate
uv pip install ".[dev]"
npm i
shell: bash
- name: Run tests
# Run all tests before generating the distribution
run: |
source .venv/bin/activate
npm run build
npm run test
shell: bash
- name: Generate distribution
# Run setup.py to generate the distribution
run: |
source .venv/bin/activate
npm run dist
npm pack && mv *.tgz dist/
- name: Validate distribution
# Run tests again using the generated wheel file
run: |
uv venv test-dist
source dist/bin/activate
WHL_FILE=$(ls dist/*.whl)
uv pip install "${WHL_FILE}[dev]"
npm run test
shell: bash
- uses: ncipollo/release-action@v1
with:
artifacts: "dist/*.whl,dist/*.tar.gz"
draft: true