diff --git a/.github/workflows/weekly-preview.yml b/.github/workflows/weekly-preview.yml index 3640ceefd0..7b5dd442aa 100644 --- a/.github/workflows/weekly-preview.yml +++ b/.github/workflows/weekly-preview.yml @@ -6,9 +6,18 @@ permissions: on: schedule: - cron: "0 2 * * 0" # 02:00 of every Sunday + pull_request: + branches: + - dev + +env: + PYTHON_VER: '3.10' + PYTORCH_VER: '2.8.0' + PIP_EXTRA_INDEX_URL: "https://download.pytorch.org/whl/cpu" # forces CPU PyTorch installation, should be faster jobs: static-checks: + if: github.event_name == 'schedule' # only check on cron run, these checks are redundant in a PR runs-on: ubuntu-latest strategy: matrix: @@ -25,10 +34,10 @@ jobs: - uses: actions/checkout@v7 with: persist-credentials: false - - name: Set up Python 3.10 + - name: Set up Python ${{ env.PYTHON_VER }} uses: actions/setup-python@v6 with: - python-version: '3.10' + python-version: ${{ env.PYTHON_VER }} cache: 'pip' - name: Install dependencies run: | @@ -40,22 +49,24 @@ jobs: $(pwd)/runtests.sh --build --clean $(pwd)/runtests.sh --build --${{ matrix.opt }} - packaging: + publish: if: github.repository == 'Project-MONAI/MONAI' runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 with: - ref: dev + # get the ref for the PR branch or dev if this is a cron job + ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || 'dev' }} fetch-depth: 0 persist-credentials: false - - name: Set up Python 3.10 + - name: Set up Python ${{ env.PYTHON_VER }} uses: actions/setup-python@v6 with: - python-version: '3.10' - - name: Install setuptools + python-version: ${{ env.PYTHON_VER }} + cache: 'pip' + - name: Install tools run: | - python -m pip install --user --upgrade setuptools wheel packaging + python -m pip install -U pip build - name: Build distribution run: | export HEAD_COMMIT_ID=$(git rev-parse HEAD) @@ -72,9 +83,15 @@ jobs: git tag "1.7.dev${YEAR_WEEK}" git log -1 git tag --list - python setup.py sdist bdist_wheel - + python -m build + ls -lh dist + - name: Test Installation + run: | + pip install dist/*.whl + pip list + (cd "$(mktemp -d)" && python -c 'import monai; print(monai.__version__)') - name: Publish to PyPI + if: github.event_name == 'schedule' # only publish on cron run uses: pypa/gh-action-pypi-publish@release/v1 with: user: __token__